JuliaIO / ImageMagick.jl

Thin Wrapper for the library ImageMagick
Other
53 stars 37 forks source link

Can't install ImageMagick.jl on an Alpine container #212

Open nlw0 opened 1 year ago

nlw0 commented 1 year ago

I'm not sure where to report this. I'd appreciate at least some help trying to debug it, since I was actually able to do this not long ago.

I'm trying to run a Julia application inside an Alpine container. This is using the official Docker image julia:1.8.3-alpine3.16. If you start the image, install and try to use ImageMagick, this is the result:

julia> using ImageMagick
[ Info: Precompiling ImageMagick [6218d12a-5da1-5696-b52f-db25d2ecc6d1]
ERROR: LoadError: InitError: could not load library "/root/.julia/artifacts/4d94fac9395da1d9e54143cd9329aa4ed2882f36/lib/libtiff.so"
Error loading shared library libzstd.so.1: No such file or directory (needed by /root/.julia/artifacts/4d94fac9395da1d9e54143cd9329aa4ed2882f36/lib/libtiff.so)
Stacktrace:
  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
    @ Base.Libc.Libdl ./libdl.jl:117
  [2] dlopen(s::String, flags::UInt32)
    @ Base.Libc.Libdl ./libdl.jl:116
  [3] macro expansion
    @ ~/.julia/packages/JLLWrappers/QpMQW/src/products/library_generators.jl:54 [inlined]
  [4] __init__()
    @ Libtiff_jll ~/.julia/packages/Libtiff_jll/5VD1s/src/wrappers/x86_64-linux-musl.jl:12
  [5] _include_from_serialized(pkg::Base.PkgId, path::String, depmods::Vector{Any})
    @ Base ./loading.jl:831
  [6] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt64)
    @ Base ./loading.jl:1039
  [7] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1315
  [8] _require_prelocked(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1200
  [9] macro expansion
    @ ./loading.jl:1180 [inlined]
 [10] macro expansion
    @ ./lock.jl:223 [inlined]
 [11] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1144
 [12] include(mod::Module, _path::String)
    @ Base ./Base.jl:419
 [13] include(x::String)
    @ ImageMagick_jll ~/.julia/packages/ImageMagick_jll/Wnxpp/src/ImageMagick_jll.jl:1
 [14] top-level scope
    @ ~/.julia/packages/ImageMagick_jll/Wnxpp/src/ImageMagick_jll.jl:50
 [15] include
    @ ./Base.jl:419 [inlined]
 [16] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)
    @ Base ./loading.jl:1554
 [17] top-level scope
    @ stdin:1
during initialization of module Libtiff_jll
in expression starting at /root/.julia/packages/ImageMagick_jll/Wnxpp/src/wrappers/x86_64-linux-musl-cxx11.jl:7
in expression starting at /root/.julia/packages/ImageMagick_jll/Wnxpp/src/ImageMagick_jll.jl:1
in expression starting at stdin:1
ERROR: LoadError: Failed to precompile ImageMagick_jll [c73af94c-d91f-53ed-93a7-00f77d67a9d7] to /root/.julia/compiled/v1.8/ImageMagick_jll/jl_MGaoPf.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
    @ Base ./loading.jl:1707
  [3] compilecache
    @ ./loading.jl:1651 [inlined]
  [4] _require(pkg::Base.PkgId)
    @ Base ./loading.jl:1337
  [5] _require_prelocked(uuidkey::Base.PkgId)
    @ Base ./loading.jl:1200
  [6] macro expansion
    @ ./loading.jl:1180 [inlined]
  [7] macro expansion
    @ ./lock.jl:223 [inlined]
  [8] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1144
  [9] include
    @ ./Base.jl:419 [inlined]
 [10] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::Nothing)
    @ Base ./loading.jl:1554
 [11] top-level scope
    @ stdin:1
in expression starting at /root/.julia/packages/ImageMagick/Fh2BX/src/ImageMagick.jl:1
in expression starting at stdin:1
ERROR: Failed to precompile ImageMagick [6218d12a-5da1-5696-b52f-db25d2ecc6d1] to /root/.julia/compiled/v1.8/ImageMagick/jl_ECnMig.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, keep_loaded_modules::Bool)
   @ Base ./loading.jl:1707
 [3] compilecache
   @ ./loading.jl:1651 [inlined]
 [4] _require(pkg::Base.PkgId)
   @ Base ./loading.jl:1337
 [5] _require_prelocked(uuidkey::Base.PkgId)
   @ Base ./loading.jl:1200
 [6] macro expansion
   @ ./loading.jl:1180 [inlined]
 [7] macro expansion
   @ ./lock.jl:223 [inlined]
 [8] require(into::Module, mod::Symbol)
   @ Base ./loading.jl:1144

julia>

If I install zstd outside, then I get an error with another dependency:

apk update
apk add zstd-libs
julia> using ImageMagick
[ Info: Precompiling ImageMagick [6218d12a-5da1-5696-b52f-db25d2ecc6d1]
ERROR: LoadError: InitError: could not load library "/root/.julia/artifacts/4d94fac9395da1d9e54143cd9329aa4ed2882f36/lib/libtiff.so"
Error loading shared library libLerc.so: No such file or directory (needed by /root/.julia/artifacts/4d94fac9395da1d9e54143cd9329aa4ed2882f36/lib/libtiff.so)

I could not find a workaround to this. I could isolate the earliest version where the problem appears, though, it's between ImageMagick@0.7.9 and 1.0.0.

giordano commented 4 months ago

You're likely observing https://github.com/JuliaLang/julia/issues/40556. If so, not much to do here.