Hi everyone. We intend to use julia to create a fully self-contained, completely pre-compiled library for integration in a larger software. I did read several posts, watched YouTube, etc. – there’s a lot but also quite scattered information. Also, there’s (for me) still the confusion about PackageCompiler and juliac. Size of the resulting library is not that critical, but smaller is better, of course. So, my questions are:
[Edit: I state the answers to the questions, as found so far, directly here. Will update whenever having found out something more. Also, follow-up questions are added.]
- What is, as of 2025-08-05, the best way of compiling a standalone library (with C ABI), that does not rely (and thus not include) the julia “runtime”/compiler? (Relying on official releases, no nightly builds etc., and supporting “all” functionality.)
- If I understood correctly, the “runtime” (libjulia) is always required, and in order not to have the compiler (LLVM) bundled, the only way is
juliac
. - The workflow, for now, is to call julia on
<julia-root-folder>/share/julia/juliac/juliac.jl
from the command line, providing options and the input .jl file.
- If I understood correctly, the “runtime” (libjulia) is always required, and in order not to have the compiler (LLVM) bundled, the only way is
- Does a single library (DLL on Windows) result, or does it rely on other libraries that I need to bundle for distribution?
- The resulting binary (exe or DLL) is not self-contained, many (to most/all) libraries in
<julia-root-folder>/bin
are required.
- The resulting binary (exe or DLL) is not self-contained, many (to most/all) libraries in
- [follow-up] Is there a way to identify which ones need to be bundled along the binary to make it work?
- What about packages that rely on third-party binaries? (Relates to the previous point.)
- Is that workflow “officially” documented somewhere?
- It seems not. Correct?
- What will change with the release of julia 1.12? (buzzwords
--trim
,juliac
)- Only with 1.12 (nightly, for now; not rc1), most features of
juliac
, including--trim
become available. - In the future,
juliac
andPackageCompiler.jl
should converge (since they “target the same but the former from the command-line, the latter from within julia”).
- Only with 1.12 (nightly, for now; not rc1), most features of
- Will the “best way” change in the near future? (So, if possible, would it be better to wait for some weeks, or months, before starting this journey?)
- There’s only the way with
juliac
for now, and a nightly build of julia 1.12 is required. Best would be to wait for the official 1.12 release, but these features will retain status “experimental” also at that point.
- There’s only the way with
Thanks for pointing me to the currently right direction; could save me a lot of time searching, reading, and trying. I can also document my “journey” here, or help in updating / extending documentation etc.
Just some of the posts and other resources I found, as reference
- 2018-2020: Building – and releasing – a fully self-contained Application written in julia - Tooling - Julia Programming Language
- May 2022: How do I create a binary from .jl files? - New to Julia - Julia Programming Language
- Latest PackageCompiler docs on building Apps: Libraries · PackageCompiler
- YouTube, September 2024: New Ways to Compile Julia (which is +/- the same as the JuliaCon’24 talk)
- r/Julia late 2023 to January 2024: State of Compile to Binary in late 2023? : r/Julia
- Around the same time: Plans for static compiled binaries? - Internals & Design - Julia Programming Language
Edit: Just wanted to say thanks to everyone working on, or otherwise involved in, julia and especially juliac
and related / enabling stuff! Really awesome to have an interactive language / environment to prototype (but running at C-like speed) and then being able to generate a binary (even if it is not as small as if it had been generated using e.g. C or Rust). Folks just have to understand that the former was the initial (and IMO still primary) focus. Still, I do think that the latter (with nice tooling to make binary generation accessible and straightforward) could boost adoption of julia a lot, since it enabled integration of julia-created modules in any other environment, in binary (and thus closed-source) form.