I am having difficulties with compiling my own package.
I have my own package “Foo” functional and registered.
(v1.0) pkg> st
[537997a7] AbstractPlotting v0.9.4
[dd5dd2d0] Foo v0.1.0 [`N:\My Documents\Programming\Julia\Modules\Foo`]
using Foo runs without problems.
compile_package fails with a strange error:
[ Info: activating new environment at C:\Users\m136270\.julia\packages\PackageCompiler\SGFCk\packages\Reflectivity\Project.toml.
Updating registry at `C:\Users\m136270\.julia\registries\General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
Resolving package versions...
ERROR: LoadError: Unsatisfiable requirements detected for package Reflectivity [dd5dd2d0]:
Reflectivity [dd5dd2d0] log:
├─Reflectivity [dd5dd2d0] has no known versions!
└─restricted to versions * by an explicit requirement - no versions left
So I understand, that the newly created environment somehow fails to find my package. Maybe I am missing something?
Thanks in advance for any hint!
I did find the root cause
The point is that
snooping.jl generates a file
using Pkg, PackageCompiler
# let's wrap the snoop file in a try catch...
# This way we still do some snooping even if there is an error in the tests!
@warn("Snoop file errored. Precompile statements were recorded untill error!", exception = e)
Pkg.instantiate fails because “Foo” is not known to the new environment.
My current workaround is to add
Pkg.develop(PackageSpec(path=$(repr(normpath(snoopfile * "\\..\\..")))))
Pkg.instantiate() which works for the case that the snoopfile is located in the default test directory, e.g.
If I find a more elegant solution, I will leave a message here.
I think I just figured out the problem… I’m drafting a solution right now!
Ok, this PR solves one problem: https://github.com/JuliaLang/PackageCompiler.jl/pull/179
I’m writing some tests right now, to verify that it also solves your problem.
Let me know if it already works for you
Btw, I suggest using
thanks for your quick reply. Unfortunately, this PR doesn’t fix my problem, because
Pkg.instantiate() still doesn’t know my local package.
I also realised earlier that
compile_incremental are not aware of my normal environment, e.g. the standard ImageMagick.jl is taken instead of master, although in my standard environment I have done
add ImageMagick#master. Maybe, both things have the same origin?
Unfortunately, I am not enough low-level Julian to come up with a general solution.
Yeah sorry, it still wasn’t not solved But I think I got it now! I’ll push when local tests pass!
pushed the fix to the same branch!
Works like a charm … and it solves the problem that a package working with your local setup can be compiled!
You are my hero
Btw, today I tried to get compile_incremental(:Makie) running.
The process succeeds and writes a sys.dll, I can successfully call julia -Jsys.dll, and do a very quick
scene=Scene() answers on the console and doesn’t open up a Makie window.
P.S.: I added some lines to
snooping.jl iin order to maintain the same versions of the packages:
command *= """
# Take LOAD_PATH from parent process
sourceManifest = joinpath(dirname($(repr(Base.active_project()))), "Manifest.toml")
targetManifest = joinpath(dirname(Base.active_project()), "Manifest.toml")
cp(sourceManifest, targetManifest; force = true)