PackageCompiler.jl: Best practices to create cross-platform relocatable app?

Hi community,

I was experimenting with PackageCompiler.jl, and I created a relocatable app, which seems to be portable to other machines running the same operating system.

But how can I compile binaries for every operating system that Julia supports? For example, windows, mac (intel), mac (apple silicon), linux (x86), linux(arm)…etc. What is the best practice here?

Also, the resulting binaries are pretty large (~700MB when zipped). If I compile 10 of these, one for each architecture, what is the best practice to distribute them?

1 Like

@kristoffer.carlsson or @sloede can you help?
I am also looking for an answer to this question and found the question via google.

May be this way (I am not into it though): Support Cosmopolitan libc (APE) · Issue #84 · tshort/StaticCompiler.jl · GitHub

1 Like

When I last checked, no cross-compilation support or Julia was available, which is a bit annoying. Currently, the easiest way to get the binaries is by compiling them on the CI so one does not need to manage those different systems by themselves.

An alternative may be to bundle Julia itself within the application and generate a precompilation cache on the host system. This works well when the app is packaged in a snap, which, upon installation, executes a configure script where precompilation happens, which resolves issues with server-side applications. On MacOS and Windows, cache can be generated on the first run and stored in a separate application folder. To make these things simple, I have made AppBundler.jl

Nevertheless, the option taken on MacOS or Windows, especially a GUI application, must be signed, bundled, and finalised on the host system. Thus, one may as well compile/precompile before doing that.

3 Likes

Sorry, I forgot about this tread. I opened this issue shortly after this, and the answer was basically you can’t do it with PackageCompiler.jl.

Btw, it is still surprising to me that BinaryBuilder.jl can compile cross platform binaries, but PackageCompiler.jl cannot. Feels like if you can do one you should be able to do the other.

1 Like