My experience (1.1 and 1.2 with PackageCompiler) has been that it works well - we are using the binaries in production and the process to generate them is simple (no manual tweaks). But there are some caveats.
Compilation is slow - 3+ minutes for even trivial applications. That means if/when I encounter a bug, either with the compiler or with the resulting binary, it can be a slow process to find a fix/workaround.
Binaries are large because they basically include the entire Julia runtime (~180MB each).
So I’d say if you can live with those limitations, it’s a good solution.
I just want to point out that even with a perfectly working PackageCompiler, it will take a while before you will be able to create functional binaries without fiddling if you want to use a lot of packages. That is because many packages encodes things like absolute paths in their source code (by using the build step of package install to create a file with absolute paths that is then included). This means that they are fundamentally non-relocatable. Fortunately, we have something called the Artifact system in 1.3 which should make the build step pretty much obsolete. It might take a while for packages to start using that and for that new system to work perfectly though.
Thanks. In your reasonable estimation, considering all the knowledge you have, if I were to ask you how long it would be before this state is achieved, what would you say? A year?
It depends a bit what you want. If it is just a simple script or packages that are simple and behave well when it comes to relocatability then on the order of a month maybe. After that, it depends a lot on how the ecosystem will behave when it comes to adopting artifacts and “jll” packages (which are binaries and libraries built on top of the artifact system)
It’s probably worth starting a new thread if you have specific errors you’re trying to debug. The module dependencies you have do make a big difference.
As a basic example though:
$ cat ./hello.jl
Base.@ccallable function julia_main(ARGS::Vector{String})::Cint
println("Hello Julia")
return 0
end
$ PKGDIR=$(julia -e 'println(abspath(joinpath(dirname(Base.find_package("PackageCompiler")),"..")))')
$ julia $PKGDIR/juliac.jl -vae ./hello.jl
$ /tmp/builddir/hello
Binary will run wherever, provided /tmp/builddir/hello.so and libjulia.so are present on the target system.
Thanks for the answer! My bad, I forgot that I was actually using ApplicationBuilder.jl, which wraps PackageCompiler. And there I even opened an issue, but got no response. But you’re right, here is not the best place for this discussion.