Relocating a Julia sysimage

I’m trying to build a sysimage and relocate it to another machine (actually another Docker image) without re-installing all the packages I precompiled (the precompiled packages take precidence anyway when using the sysimage). I successfully built the image (sys_app.so) and copied the artifacts manually (let me know if there’s a more elegant way to do this). However, I can’t actually use one of the precompiled package.

using MyPackage
MyPackage.dosomething(2)

:ERROR ArgumentError: Package MyPackage not found in current path... maybe you meant `import/using .MyPackage

It suggested using a . so following this advice, I used

using .MyPackage
MyPackage.dosomething(2)

which strangely worked. Why do I need to use a . when “using” a precompiled package in the system image? Is there any way not to use this so that I don’t have to change the top-level script? This dot doesn’t seem to be required for packages in the base sysimage, is there any way to give my sysimage packages this behaviour?

2 Likes

Okay, I figured it out. Turns out it’s actually in the docstring (but not the docs). I just have to also copy the Project.toml file over. I guess from this comment, the authors are unsure if even having the . notation is even the right thing to do :rofl:

The nice thing about this is that it offers at least some form of obfuscation, so as to not have source code sitting directly on the docker image (I know some reverse engineering is possible, least they’d have to work at it to see the source code).

1 Like