PackageCompiler does a great job at producing custom system images but deploying them for embedded targets is more complicated than it needs to be.
With the default system image, initializing embedded Julia is a simple matter of calling jl_init()
. Under the hood this does dynamic loading introspection to find which library it is defined in (i.e. libjulia
) and where this library lives on the filesystem, then deduces Julia's bindir
from this information. After this it just calls jl_init_with_image
with the bindir
and the default relative location of the system image.
With a custom system image, the simplest way to initialize ought to be to call jl_init_with_image(NULL, system_image_path)
. However, the NULL
first argument does something completely different than jl_init
to determine bindir
. Specifically it first checks the presence of the JULIA_BINDIR
environment variable. If not present it uses uv_exepath
to deduce bindir
. The latter may be fine when initializing the julia
binary, but for embedded julia it finds the path to the embedding executable, which typically lives somewhere else.
The result is that the embedding program needs to replicate the introspection done in jl_init
itself, or have other ways of knowing where to find Julia's bindir
. This is quite unnecessary since the code is already there in jl_init
, just not available for this use case.
Suggestion:
jl_init()
is changed to an alias for jl_init_with_image(NULL, NULL)
.jl_init_with_image
replaces the uv_exepath
based lookup with the code currently employed in jl_init
.This has two potentially breaking consequences:
jl_init
will honor the JULIA_BINDIR
environment variable. This seems mostly like a positive change.jl_init_with_image(NULL, ...)
will depend on the location of libjulia
instead of the location of the executable. Will this be an acceptable change? Specifically, will it work properly with the julia
executable itself?maxmouchet, schneiderfelipe and liskin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4