I’m trying to compile my project to a standalone executable with PackageCompiler.jl.
I have used PackageCompiler before just for toying around, and I remember compilation times were slow, but now with a real codebase (20 deps, ~1k lines of code) this is taking already more than 2 hours (and counting).
Is having several hours of compilation time for PackageCompiler a normal thing, or there might be a problem in my setup?
Do you have enough free RAM? Which OS? On Windows virus scanners might slow you down. So far I never saw compilation times of more than 15 min on a not too old PC with projects of a few thousand LOC…
I tried again without Revise and stopped the compilation at 1 hour without success.
Btw, I’m also using create_app. I can compile “hello world” apps in about 5 minutes.
I also tried to compile a test application that only includes Plots:
module test_packagecompiler
using Plots
function julia_main()::Cint
println("Generating random plot and saving to file...")
heatmap(rand(100,100))
savefig("random_heatmap.png")
return 0
end
end
… and after 50 minutes, I gave up.
However, I removed Plots from one of the packages I was trying to compile, and it compiled in about 12 minutes!
A funny thing happened, though. The first time I ran it, it took some time in downloading some artifact (MKL) which had apparently forgot to include during the build, but the second time I ran it, it went straight into the results.
So I guess no plotting on compiled apps? That’s curious, because the first thing I ever did with PackageCompier was to add Plots to a sysimage… Why would something work for a compiled sysimage and not for a standalone app?
8Gbytes is not a lot of RAM these days but should be enough.
I would advise openign a new terminal and running these utilities as the compilation is happening
top
htop
iotop
Often a simple ‘top’ will give you insight into what is going on.
This is twice we have a report of very large compilation times. Are we seeing the start of a common problem?
I suspect this is not a bug in Julia, rather that these systems are swapping due to large memory use. Thats just a wet finger stuck up to test the wind of course.
Please report versioninfo()
Just don’t try to compile Plots with PackageCompiler. It is very difficult to make it work and probably not worth the effort. There are lots of other plotting packages that cause less problems.