JuliaLang / PackageCompiler.jl

Compile your Julia Package
https://julialang.github.io/PackageCompiler.jl/dev/
MIT License
1.39k stars 185 forks source link

Error occurred while compiling code that includes `using LoopVectorization` #939

Closed JinyanTeng closed 1 month ago

JinyanTeng commented 2 months ago

The error information is shown in the following: PackageCompiler: compiling nonincremental system imageUndefVarError: CPU_NAME not defined

KristofferC commented 2 months ago

I think this is a duplicate of https://github.com/JuliaLang/PackageCompiler.jl/issues/513

JinyanTeng commented 1 month ago

I think this is a duplicate of #513

Actually, Sys.CPU_NAME is a variable defined by the Julia system. I can't understand why "not defined" is happening.

JinyanTeng commented 1 month ago

I encountered another error related to FFTW.jl that is a JuliaMatch package [https://github.com/JuliaMath/FFTW.jl].

Closest candidates are: convert(::Type{String}, ::StringManipulation.Decoration) @ StringManipulation /gpfs1p/nsccwuxi_scau/zhangz/.julia/packages/StringManipulation/5Zfrz/src/decorations.jl:315 convert(::Type{String}, ::Base.JuliaSyntax.Kind) @ Base /gpfs1p/nsccwuxi_scau/zhangz/soft/julia-1.10.2/share/julia/base/JuliaSyntax/src/kinds.jl:975 convert(::Type{String}, ::String) @ Base essentials.jl:321 ...

Stacktrace: [1] setproperty! @ ./Base.jl:40 [inlined] [2] setindex!(b::Base.RefValue{String}, x::Nothing) @ Base ./refvalue.jl:60 [3] top-level scope @ /gpfs1p/nsccwuxi_scau/zhangz/.julia/packages/FFTW/6nZei/src/providers.jl:51 [4] include(mod::Module, _path::String) @ Base ./Base.jl:495 [5] include(x::String) @ FFTW /gpfs1p/nsccwuxi_scau/zhangz/.julia/packages/FFTW/6nZei/src/FFTW.jl:1 [6] top-level scope @ /gpfs1p/nsccwuxi_scau/zhangz/.julia/packages/FFTW/6nZei/src/FFTW.jl:17 [7] include(mod::Module, _path::String) @ Base ./Base.jl:495 [8] _require(pkg::Base.PkgId, env::Nothing) @ Base ./loading.jl:2014 [9] __require_prelocked(uuidkey::Base.PkgId, env::Nothing) @ Base ./loading.jl:1812 [10] #invokelatest#2 @ ./essentials.jl:892 [inlined] [11] invokelatest @ ./essentials.jl:889 [inlined] [12] _require_prelocked @ ./loading.jl:1805 [inlined] [13] _require_prelocked @ ./loading.jl:1802 [inlined] [14] macro expansion @ ./lock.jl:267 [inlined] [15] require(uuidkey::Base.PkgId) @ Base ./loading.jl:1797 [16] top-level scope @ /tmp/jl_uH27I9Ar6b:48 in expression starting at /gpfs1p/nsccwuxi_scau/zhangz/.julia/packages/FFTW/6nZei/src/providers.jl:49 in expression starting at /gpfs1p/nsccwuxi_scau/zhangz/.julia/packages/FFTW/6nZei/src/FFTW.jl:1 in expression starting at /tmp/jl_uH27I9Ar6b:48 ✖ [01m:55s] PackageCompiler: compiling nonincremental system image

topolarity commented 1 month ago

Those both look like issues related to the fact that __init__() does not run during sysimage compilation... That's an unfortunate thorn of our sysimage execution model right now.

Although, I am a bit confused how FFTW.jl was ever working with PackageCompiler (the source has some explicit references to it, so it must have worked at some point). I would have expected the package to always fail when trying to run that top-level code, since the JLL will look initialized for pkgimage builds but not for the sysimage built by PackageCompiler.