JuliaLang / PackageCompiler.jl

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

Zarr and DimensionalData in same package will not compile on macOS #941

Closed bjarthur closed 2 months ago

bjarthur commented 2 months ago

if only Zarr or DimensionalData is in a package, i can create an app using PackageCompiler on macOS and Ubuntu, but if they both are in the same package, then i can't on MacOS.

click here to see the stacktrace: ``` ⡆ [00m:14s] PackageCompiler: compiling nonincremental system imagecould not load library "" dlopen(.dylib, 0x0001): tried: '.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS.dylib' (no such file), '/Users/arthurb/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/lib/julia/.dylib' (no such file), '/Users/arthurb/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/lib/julia/../.dylib' (no such file), '/Users/arthurb/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/lib/.dylib' (no such file), '/usr/lib/.dylib' (no such file, not in dyld cache), '.dylib' (no such file), '/usr/local/lib/.dylib' (no such file), '/usr/lib/.dylib' (no such file, not in dyld cache) Stacktrace: [1] version_number() @ OpenSSL ~/.julia/packages/OpenSSL/hXs2T/src/OpenSSL.jl:495 [2] top-level scope @ none:1 ⠇ [00m:14s] PackageCompiler: compiling nonincremental system imageeval(m::Module, e::Any) @ Core ./boot.jl:385 [4] var"@static"(__source__::LineNumberNode, __module__::Module, ex::Any) @ Base ./osutils.jl:19 [5] include(mod::Module, _path::String) @ Base ./Base.jl:495 [6] _require(pkg::Base.PkgId, env::String) @ Base ./loading.jl:2014 [7] __require_prelocked(uuidkey::Base.PkgId, env::String) @ Base ./loading.jl:1812 [8] #invokelatest#2 @ ./essentials.jl:892 [inlined] [9] invokelatest @ ./essentials.jl:889 [inlined] [10] _require_prelocked(uuidkey::Base.PkgId, env::String) @ Base ./loading.jl:1805 [11] macro expansion @ ./loading.jl:1790 [inlined] [12] macro expansion @ ./lock.jl:267 [inlined] [13] __require(into::Module, mod::Symbol) @ Base ./loading.jl:1753 [14] #invokelatest#2 @ ./essentials.jl:892 [inlined] [15] invokelatest @ ./essentials.jl:889 [inlined] [16] require(into::Module, mod::Symbol) @ Base ./loading.jl:1748 --- the last 12 lines are repeated 3 more times --- [53] include(mod::Module, _path::String) @ Base ./Base.jl:495 [54] include(x::String) @ Zarr ~/.julia/packages/Zarr/uTqS1/src/Zarr.jl:1 [55] top-level scope @ ~/.julia/packages/Zarr/uTqS1/src/Storage/Storage.jl:167 [56] include(mod::Module, _path::String) @ Base ./Base.jl:495 [57] include(x::String) @ Zarr ~/.julia/packages/Zarr/uTqS1/src/Zarr.jl:1 [58] top-level scope @ ~/.julia/packages/Zarr/uTqS1/src/Zarr.jl:8 [59] include(mod::Module, _path::String) @ Base ./Base.jl:495 [60] _require(pkg::Base.PkgId, env::String) @ Base ./loading.jl:2014 [61] __require_prelocked(uuidkey::Base.PkgId, env::String) @ Base ./loading.jl:1812 [62] #invokelatest#2 @ ./essentials.jl:892 [inlined] [63] invokelatest @ ./essentials.jl:889 [inlined] [64] _require_prelocked(uuidkey::Base.PkgId, env::String) @ Base ./loading.jl:1805 [65] macro expansion @ ./loading.jl:1790 [inlined] [66] macro expansion @ ./lock.jl:267 [inlined] [67] __require(into::Module, mod::Symbol) @ Base ./loading.jl:1753 [68] #invokelatest#2 @ ./essentials.jl:892 [inlined] [69] invokelatest @ ./essentials.jl:889 [inlined] [70] require(into::Module, mod::Symbol) @ Base ./loading.jl:1748 [71] include(mod::Module, _path::String) @ Base ./Base.jl:495 [72] _require(pkg::Base.PkgId, env::Nothing) @ Base ./loading.jl:2014 [73] __require_prelocked(uuidkey::Base.PkgId, env::Nothing) @ Base ./loading.jl:1812 [74] #invokelatest#2 @ ./essentials.jl:892 [inlined] [75] invokelatest @ ./essentials.jl:889 [inlined] [76] _require_prelocked @ ./loading.jl:1805 [inlined] [77] _require_prelocked @ ./loading.jl:1802 [inlined] [78] macro expansion @ ./lock.jl:267 [inlined] [79] require(uuidkey::Base.PkgId) @ Base ./loading.jl:1797 in expression starting at /Users/arthurb/.julia/packages/OpenSSL/hXs2T/src/OpenSSL.jl:508 in expression starting at /Users/arthurb/.julia/packages/OpenSSL/hXs2T/src/OpenSSL.jl:1 in expression starting at /Users/arthurb/.julia/packages/HTTP/PnoHb/src/HTTP.jl:1 in expression starting at /Users/arthurb/.julia/packages/AWS/Fxun1/src/AWS.jl:1 in expression starting at /Users/arthurb/.julia/packages/AWSS3/A97Rh/src/AWSS3.jl:9 in expression starting at /Users/arthurb/.julia/packages/Zarr/uTqS1/src/Storage/s3store.jl:1 in expression starting at /Users/arthurb/.julia/packages/Zarr/uTqS1/src/Storage/Storage.jl:167 in expression starting at /Users/arthurb/.julia/packages/Zarr/uTqS1/src/Zarr.jl:1 in expression starting at /Users/arthurb/projects/shroff/ZarrDDTest/src/ZarrDDTest.jl:1 in expression starting at /var/folders/s5/8d629n5d7nsf37f60_91wzr40000gq/T/jl_2jUHaBMvYB:24 ✖ [00m:14s] PackageCompiler: compiling nonincremental system image ERROR: failed process: Process(`/Users/arthurb/.julia/juliaup/julia-1.10.2+0.aarch64.apple.darwin14/bin/julia --color=yes --startup-file=no --pkgimages=no --cpu-target=generic --sysimage=/var/folders/s5/8d629n5d7nsf37f60_91wzr40000gq/T/jl_5NOe1P/sys.dylib --project=/Users/arthurb/projects/shroff/ZarrDDTest --output-o=/var/folders/s5/8d629n5d7nsf37f60_91wzr40000gq/T/jl_QXYnET89UJ.o /var/folders/s5/8d629n5d7nsf37f60_91wzr40000gq/T/jl_2jUHaBMvYB`, ProcessExited(1)) [1] Stacktrace: [1] pipeline_error @ ./process.jl:565 [inlined] [2] run(::Cmd; wait::Bool) @ Base ./process.jl:480 [3] run @ ./process.jl:477 [inlined] [4] #20 @ ~/.julia/dev/PackageCompiler/ext/TerminalSpinners.jl:157 [inlined] [5] spin(f::PackageCompiler.var"#20#22"{Cmd}, s::PackageCompiler.TerminalSpinners.Spinner{Base.TTY}) @ PackageCompiler.TerminalSpinners ~/.julia/dev/PackageCompiler/ext/TerminalSpinners.jl:164 [6] macro expansion @ ~/.julia/dev/PackageCompiler/ext/TerminalSpinners.jl:157 [inlined] [7] create_sysimg_object_file(object_file::String, packages::Vector{…}, packages_sysimg::Set{…}; project::String, base_sysimage::String, precompile_execution_file::Vector{…}, precompile_statements_file::Vector{…}, cpu_target::String, script::Nothing, sysimage_build_args::Cmd, extra_precompiles::String, incremental::Bool) @ PackageCompiler ~/.julia/dev/PackageCompiler/src/PackageCompiler.jl:134 [8] create_sysimg_object_file @ ~/.julia/dev/PackageCompiler/src/PackageCompiler.jl:311 [inlined] [9] create_sysimage(packages::Vector{…}; sysimage_path::String, project::String, precompile_execution_file::Vector{…}, precompile_statements_file::Vector{…}, incremental::Bool, filter_stdlibs::Bool, cpu_target::String, script::Nothing, sysimage_build_args::Cmd, include_transitive_dependencies::Bool, base_sysimage::Nothing, julia_init_c_file::Nothing, julia_init_h_file::Nothing, version::Nothing, soname::Nothing, compat_level::String, extra_precompiles::String) @ PackageCompiler ~/.julia/dev/PackageCompiler/src/PackageCompiler.jl:628 [10] create_sysimage @ ~/.julia/dev/PackageCompiler/src/PackageCompiler.jl:521 [inlined] [11] create_app(package_dir::String, app_dir::String; executables::Vector{…}, precompile_execution_file::Vector{…}, precompile_statements_file::Vector{…}, incremental::Bool, filter_stdlibs::Bool, force::Bool, c_driver_program::String, cpu_target::String, include_lazy_artifacts::Bool, sysimage_build_args::Cmd, include_transitive_dependencies::Bool, include_preferences::Bool, script::Nothing) @ PackageCompiler ~/.julia/dev/PackageCompiler/src/PackageCompiler.jl:881 [12] top-level scope @ REPL[8]:1 Some type information was truncated. Use `show(err)` to see complete types. ```

to reproduce, put the below code in "ZarrDDTest/src/ZarrDDTest.jl":

module ZarrDDTest

greet() = print("Hello World!")

using Zarr, DimensionalData

function julia_zarr()::Cint
    tmp = tempname()*".zarr"

    z1 = zcreate(Int, 10000,10000,path = tmp,chunks=(1000, 1000))
    z1[:] .= 42
    z1[:,1] = 1:10000
    z1[1,:] = 1:10000

    z2 = zopen(tmp)
    z2[1:10,1:10]

    rm(tmp; recursive=true)

    return 0
end

function julia_dd()::Cint
    println('1')
    foo = DimArray(rand(1336,3,778), (X, Y, Z))
    println('2')
    filter(!isnan, foo)
    println('3')
    foo = DimArray(rand(2,3,4), (X, Y, Z))
    println('4')
    filter(!isnan, foo)
    println('5')
  return 0 # if things finished successfully
end

end # module ZarrDDTest

then execute using PackageCompiler; create_app(".", "../ZarrDDTestCompiled", executables = ["julia_zarr"=>"julia_zarr", "julia_dd"=>"julia_dd"]).

click here to see my versioninfo(): ``` julia> versioninfo() Julia Version 1.10.2 Commit bd47eca2c8a (2024-03-01 10:14 UTC) Build Info: Official https://julialang.org/ release Platform Info: OS: macOS (arm64-apple-darwin22.4.0) CPU: 12 × Apple M2 Max WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1) Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores) Environment: JULIA_PROJECT = @. JULIA_EDITOR = vi ```

@meggart @rafaqz

bjarthur commented 2 months ago
Project ZarrDDTest v0.1.0
Status `~/ZarrDDTest/Project.toml`
  [0703355e] DimensionalData v0.27.2
  [0a941bbe] Zarr v0.9.3
bjarthur commented 2 months ago

nevermind. as suggested i nuked my .julia directory and now it works.