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

**URL:** <https://discourse.julialang.org/t/packagecompiler-jl-best-practices-to-create-cross-platform-relocatable-app/105408>\
**Category:** General Usage\
**Tags:** package-compiler\
**Created:** [October 26, 2023, 1:39am UTC](https://discourse.julialang.org/t/packagecompiler-jl-best-practices-to-create-cross-platform-relocatable-app/105408 "2023-10-26T01:39:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![biona001](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/biona001/32/16497_2.png) [@biona001](https://discourse.julialang.org/u/biona001)\
**Post date:** [October 26, 2023, 1:39am UTC](https://discourse.julialang.org/t/packagecompiler-jl-best-practices-to-create-cross-platform-relocatable-app/105408/1 "2023-10-26T01:39:18Z")

</div>

Hi community,

I was experimenting with [PackageCompiler.jl](https://github.com/JuliaLang/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](https://julialang.org/downloads/) 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?

---

<div class="post-metadata">

**Author:** ![schlichtanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/schlichtanders/32/32145_2.png) [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Post date:** [April 16, 2024, 1:50pm UTC](https://discourse.julialang.org/t/packagecompiler-jl-best-practices-to-create-cross-platform-relocatable-app/105408/2 "2024-04-16T13:50:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![j-fu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j-fu/32/11373_2.png) [@j-fu](https://discourse.julialang.org/u/j-fu)\
**Post date:** [April 16, 2024, 3:45pm UTC](https://discourse.julialang.org/t/packagecompiler-jl-best-practices-to-create-cross-platform-relocatable-app/105408/3 "2024-04-16T15:45:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Janis\_Erdmanis](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/janis_erdmanis/32/10869_2.png) [@Janis\_Erdmanis](https://discourse.julialang.org/u/Janis_Erdmanis)\
**Post date:** [April 16, 2024, 6:39pm UTC](https://discourse.julialang.org/t/packagecompiler-jl-best-practices-to-create-cross-platform-relocatable-app/105408/4 "2024-04-16T18:39:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![biona001](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/biona001/32/16497_2.png) [@biona001](https://discourse.julialang.org/u/biona001)\
**Post date:** [April 16, 2024, 11:08pm UTC](https://discourse.julialang.org/t/packagecompiler-jl-best-practices-to-create-cross-platform-relocatable-app/105408/5 "2024-04-16T23:08:52Z")

</div>

Sorry, I forgot about this tread. I opened [this issue](https://github.com/JuliaLang/PackageCompiler.jl/issues/879) 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.
