How to pre-compile an extension?

How can I precompile “RatiosFixedPointNumbersExt”?

I have a script that creates a system image, and if I run Julia with this system image I do not want that it starts precompiling again, it should be instant, but if I run one of my examples it starts precompiling this extension.

I don’t even know to which package this extension belongs.

It seems to come from Ratios.jl:

I guess you could open an issue there so that the dev adds a PrecompileTools.jl workload.

2 Likes

Does your script load both Ratios and FixedPointNumbers? If so, I would have expected the extension to be automatically precompiled (maybe not with an optimal workload, though)

No, at least not directly: KiteModels.jl/Project.toml at main · ufechner7/KiteModels.jl · GitHub

OK, so this might be part of the problem.

(KiteModels) pkg> why Ratios
  Interpolations → Ratios

(KiteModels) pkg> why FixedPointNumbers
ERROR: The following package names could not be resolved:
 * FixedPointNumbers (not found in project or manifest)

KiteModels does load Ratios (as an indirect dependency via Interpolations), but apparently not FixedPointNumbers. Could it be that he latter is loaded via an extra dependency in the example script that causes the unwanted precompilation?

Could you maybe load that other dependency when you build the sysimage? I think it would ensure that the sysimage at least knows about FixedPointNumbers and RatiosFixedPointNumbersExt.

1 Like
julia> using TestEnv

julia> TestEnv.activate()
"/tmp/jl_nbPzwo/Project.toml"

(jl_nbPzwo) pkg> why FixedPointNumbers
  ControlPlots → PyPlot → Colors → ColorTypes → FixedPointNumbers
  ControlPlots → PyPlot → Colors → FixedPointNumbers

I use the test environment for my examples. I will add Colors to the system image.