Since I migrated to Julia 1.9 I get a pre-compilation of the module I am developing each time I start a test script. This was not the case with 1.8, for which I had sometimes to force a recompilation by modifying some of the files. Does anybody know how I can debug this to know what triggers the recompilation.
The module uses CxxWrap to interface to a C++ package. It is defined like this:
module Geant4
using CxxWrap
@wrapmodule("jlGeant4")
function __init__()
@initcxx
end
end #module
You do have to compile once for normal usage and once when running Pkg.test because it sets coverage=true, and we compile different code for those two cases. (Turning on coverage slows down runtime performance.) But if you’ve just run Pkg.test, and you re-run it without changing your source code, it shouldn’t need to Precompiling... any packages.
The only things I can thing of are
are you sure it’s precompiling? Pkg will “reinstall” the test dependencies of your project, but if they’re already installed and precompiled from the previous Pkg.test run, that will basically be a no-op (lots of printing, but very little time, and specifically no Precompiling...).
might there be anything wrong with the clock on your system?
are you changing the DEPOT each time? That will result in fresh compilation
for which I had sometimes to force a recompilation by modifying some of the files
Sounds like you might benefit from include_dependency, if some files are required for your project but don’t fit within the definition of ordinary Julia code.
BTW, this Info message only appears with the interactive option -i, but I’m sure it does the precompilation judging from the time it takes to start the script.
How is Geant4 loaded? Have you modified the LOAD_PATH or set any environment variables? The results of julia -e "using InteractiveUtils; versioninfo()" would be informative here.
What is the output of julia -E "DEPOT_PATH[1]" ?
You might want to check ~/.julia/compiled/v1.9/Geant4 to see if there anything strange with the modified times of the files there.
Geant4.jl mato$ JULIA_DEBUG=loading julia --project=. examples/basic/B2/B2a.jl
┌ Debug: Rejecting stale cache file /Users/mato/.julia/compiled/v1.9/Geant4/GogkO_hxYin.ji because file /Users/mato/Development/Julia/Geant4.jl/gen/build/lib/libGeant4Wrap does not exist
â”” @ Base loading.jl:2798
┌ Debug: Rejecting stale cache file /Users/mato/.julia/compiled/v1.9/Geant4/GogkO_d0CIK.ji (mtime 1.684766294152994e9) because file /Users/mato/Development/Julia/Geant4.jl/src/Geant4.jl (mtime 1.6856198847355766e9) has changed
....
The file that exists is /Users/mato/Development/Julia/Geant4.jl/gen/build/lib/libGeant4Wrap.dylib with the suffix.
What I am doing in the module is:
module Geant4
using CxxWrap
using Geant4_jll
# Check whether the wrappers have been build locally otherwise use the binary package Geant4_julia_jll
gendir = normpath(joinpath(@__DIR__, "../gen"))
if isdir(joinpath(gendir, "build/lib"))
include(joinpath(gendir, "jl/Geant4-export.jl"))
@wrapmodule(joinpath(gendir, "build/lib", "libGeant4Wrap"))
else
using Geant4_julia_jll
include(Geant4_julia_jll.Geant4_exports)
@wrapmodule(Geant4_julia_jll.libGeant4Wrap)
end
....
I do to fully specify the suffix for portability. Probably I should specify it depending on the platform I am.
If you could come up with a MWE that would be fantastic for fixing the regression. (We need a test to see if the problem has been fixed and stays that way.) Either way, it should be reported.