The front page https://julialang.org says at the “General Purpose” tab that you can “statically compile your code”.
So I have installed PackageCompiler
as I described here.
I am able to create a dynamic binary as follows:
julia ~/.julia/packages/PackageCompiler/oT98U/juliac.jl -vae --compile=all hello.jl
when you examine it:
$ ldd builddir/hello
linux-vdso.so.1 (0x00007ffc27946000)
hello.so => /home/certik/repos/julia_comp/builddir/hello.so (0x0000151ddd2c7000)
libjulia.so.1 => /home/certik/ext/julia-1.1.0/lib/libjulia.so.1 (0x0000151ddcb57000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x0000151ddc766000)
libLLVM-6.0.so => /home/certik/ext/julia-1.1.0/lib/julia/libLLVM-6.0.so (0x0000151dd9a40000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x0000151dd983c000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x0000151dd9634000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x0000151dd9415000)
libstdc++.so.6 => /home/certik/ext/julia-1.1.0/lib/julia/libstdc++.so.6 (0x0000151dd9097000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x0000151dd8cf9000)
libgcc_s.so.1 => /home/certik/ext/julia-1.1.0/lib/julia/libgcc_s.so.1 (0x0000151dd8ae1000)
/lib64/ld-linux-x86-64.so.2 (0x0000151de4c7b000)
it links to Julia and to hello.so
:
$ ldd builddir/hello.so
linux-vdso.so.1 (0x00007ffc48392000)
libjulia.so.1 => /home/certik/ext/julia-1.1.0/lib/libjulia.so.1 (0x000014d4bc419000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x000014d4bc028000)
libLLVM-6.0.so => /home/certik/ext/julia-1.1.0/lib/julia/libLLVM-6.0.so (0x000014d4b9302000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x000014d4b90fe000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x000014d4b8ef6000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x000014d4b8cd7000)
libstdc++.so.6 => /home/certik/ext/julia-1.1.0/lib/julia/libstdc++.so.6 (0x000014d4b8959000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x000014d4b85bb000)
libgcc_s.so.1 => /home/certik/ext/julia-1.1.0/lib/julia/libgcc_s.so.1 (0x000014d4b83a3000)
/lib64/ld-linux-x86-64.so.2 (0x000014d4c433a000)
Which also links to Julia and LLVM (libjulia.so.1
and libLLVM-6.0.so
).
Question 1: How do I create a static binary? (Or are static binaries not supported yet?)
Question 2: Why is the hello.so
library so large (131MB)? (Is there a way to make it smaller?)
$ ll -h builddir/hello.so
-rwxr-xr-x 1 certik certik 131M May 3 11:18 builddir/hello.so*
Question 3: Why does the compilation of this simple script take 2min 38s ? (Is there a way to make it compile faster?)
$ time julia ~/.julia/packages/PackageCompiler/oT98U/juliac.jl -vae --compile=all hello.jl
...
real 2m38.828s
user 2m35.881s
sys 0m6.016s
Thanks for any feedback on this.