Ahead-Of-Time (AOT) Compiler

Are there any plans for implementing an ahead-of-time-compiler in Julia that can generate standalone executables?

I believe such a feature would attract a very large set of new (system) programmers typically programming in system languages such as C, C++, D, Zig, Rust and Go.

5 Likes

See the build_executable function in PackageCompiler: GitHub - JuliaLang/PackageCompiler.jl: Compile your Julia Package

2 Likes

Is this really stable!!!?

People are asking for an AOT-compiler for version 1.x of Julia.

1 Like

Should

Pkg.add("PackageCompiler")

work? It fails for me as

 Resolving package versions...
 Installed SnoopCompile ──── v0.2.0
 Installed LibCURL ───────── v0.3.1
 Installed LibExpat ──────── v0.5.0
 Installed PackageCompiler ─ v0.4.0
 Installed HTTPClient ────── v0.2.1
 Installed Libz ──────────── v1.0.0
 Installed BufferedStreams ─ v1.0.0
 Installed ArgParse ──────── v0.6.0
 Installed WinRPM ────────── v0.4.0
 Installed TextWrap ──────── v0.3.0
  Updating `~/.julia/environments/v1.0/Project.toml`
  [9b87118b] + PackageCompiler v0.4.0
  Updating `~/.julia/environments/v1.0/Manifest.toml`
  [c7e460c6] + ArgParse v0.6.0
  [e1450e63] + BufferedStreams v1.0.0
  [0862f596] + HTTPClient v0.2.1
  [b27032c2] + LibCURL v0.3.1
  [522f3ed2] + LibExpat v0.5.0
  [2ec943e9] + Libz v1.0.0
  [9b87118b] + PackageCompiler v0.4.0
  [aa65fe97] + SnoopCompile v0.2.0
  [b718987f] + TextWrap v0.3.0
  [c17dfb99] + WinRPM v0.4.0
  Building LibCURL ────────→ `~/.julia/packages/LibCURL/Qs5og/deps/build.log`
  Building WinRPM ─────────→ `~/.julia/packages/WinRPM/rDDZz/deps/build.log`
  Building PackageCompiler β†’ `~/.julia/packages/PackageCompiler/5u3Km/deps/build.log`
β”Œ Error: Error building `PackageCompiler`: 
β”‚ ERROR: LoadError: syntax: try without catch or finally
β”‚ Stacktrace:
β”‚  [1] include at ./boot.jl:317 [inlined]
β”‚  [2] include_relative(::Module, ::String) at ./loading.jl:1038
β”‚  [3] include(::Module, ::String) at ./sysimg.jl:29
β”‚  [4] include(::String) at ./client.jl:388
β”‚  [5] top-level scope at none:0
β”‚ in expression starting at /home/per/.julia/packages/PackageCompiler/5u3Km/deps/build.jl:4
β”” @ Pkg.Operations /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Pkg/src/Operations.jl:1068

On Julia 1.0.

I wouldn’t necessarily call it stable (it does have a major version number of β€œ0”), but it’s worked for me on a wide variety of use-cases for 0.6. My guess for why it’s failing to build is that it isn’t yet compatible with 1.0. If you’d like to try to help with fixing that, I’d recommend downloading 0.7 and fixing any warnings generated by PackageCompiler.

3 Likes

Any updates on this?

This has seen massive improvements in the last two years. PackageCompiler was rewritten from the ground up. See Kristoffer Carlsson’s talk at this year’s juliacon for an overview of the current state of PackageCompiler:

5 Likes