Compiling and building binaries from your julia code

I just recently put snoopcompile and the static-compilation script into one package: https://github.com/SimonDanisch/PackageCompiler.jl - so that should make things already a bit easier.

@jonathanBieler

After making a fairly large package (Makie) and it’s dependencies precompilable, I came up with the following list:

  • non const globals are problematic, or globals defined in functions - removing those got me to 90% of making the package save for static compilation

  • type unstable code had some inference issues (around 2 occurrence, where I’m still not sure what was happening) - both cases happened with dictionaries… Only way to find those was investigating the segfaults with gdb, but then it was relatively easy to just juggle around the code a bit. - The non const globals might be related since they introduce type instabilities, not sure though…

  • some generated functions needed reordering of the functions they call ( actually, even for normal code all functions that get called in a generated function should be defined before it)

  • I uncovered one out of bounds issue, that somehow was not coming up without static-compilation

  • I used julia-debug to uncover those bugs, but actually, the last errors I was trying to uncover where due to using julia-debug - so Makie just works correctly statically compiled with a release build right now!

  • you’re pretty much on your own and need to use gdb to find the issues and I still don’t know what the underlying julia issues are and when they will get fixed :wink: See: https://github.com/JuliaLang/julia/issues/24533

20 Likes