# How to create a pre-compiler Julia image from C to reduce init time?

**URL:** <https://discourse.julialang.org/t/how-to-create-a-pre-compiler-julia-image-from-c-to-reduce-init-time/64930>\
**Category:** General Usage\
**Tags:** embedding, sysimage\
**Created:** [July 19, 2021, 3:30pm UTC](https://discourse.julialang.org/t/how-to-create-a-pre-compiler-julia-image-from-c-to-reduce-init-time/64930 "2021-07-19T15:30:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Clonkk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/clonkk/32/20088_2.png) [@Clonkk](https://discourse.julialang.org/u/Clonkk)\
**Post date:** [July 19, 2021, 3:30pm UTC](https://discourse.julialang.org/t/how-to-create-a-pre-compiler-julia-image-from-c-to-reduce-init-time/64930/1 "2021-07-19T15:30:36Z")

</div>

Hello,

I’ve been working on integratring Julia with Nim on [GitHub - Clonkk/nimjl: A bridge between Nim-lang and Julia !](https://github.com/Clonkk/nimjl) and I’d like to be able to save pre-compiled image and load them at start-up.

For that I’m hoping to be able to use the function `jl_save_system_image` and `jl_init_with_image`, but I can’t seem to write a Julia compiled image from C and documentation is sparse on this topic.

I tried a simple code to creat an image with LinearAlgebra (just a dummy example) :

```nohighlight
jl_init();
jl_eval_string("using LinearAlgebra"); 
jl_save_system_image("./example.img");
jl_atexithook(0);

```

But this segfault :

```julia
signal (11): Segmentation fault
in expression starting at none:0
__memmove_sse2_unaligned_erms at /lib64/libc.so.6 (unknown line)
_write_grow at /buildworker/worker/package_linux64/build/src/support/ios.c:249 [inlined]
ios_write at /buildworker/worker/package_linux64/build/src/support/ios.c:412
jl_write_values at /buildworker/worker/package_linux64/build/src/staticdata.c:888 [inlined]
jl_save_system_image_to_stream at /buildworker/worker/package_linux64/build/src/staticdata.c:1563
jl_save_system_image at /buildworker/worker/package_linux64/build/src/staticdata.c:1650

```
