JuliaIO / EzXML.jl

XML/HTML handling tools for primates

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EzXML pre-compilation failure during building alpine docker images using julia 1.6.5 LTS

mdsa3d opened this issue · comments

Hi, I would like to report a precompilation failure of EzXML which in turns cause Genie.jl to fail. I have consulted with the Genie Team @AbhimanyuAryan and it was pointed out that it could OS build issue.

For your reference, below is my Dockerfile and Stackrace which is from the process of packaging Julia application in a docker image using Alpine Linux image.

Dockerfile:

FROM julia:1.6.5-alpine

RUN apk --no-cache update \
    apk add upgrade \
    apk --no-cache add apk-tools \
    apk --no-cache add build-base 
RUN apk add g++

# Install python/pip
ENV PYTHONUNBUFFERED=1
RUN apk add --update --no-cache python3 && ln -sf python /usr/bin/python 
RUN python3 -m ensurepip
RUN pip3 install --no-cache --upgrade pip setuptools
RUN apk add --no-cache py-pip py3-numpy py3-scipy

RUN rm -rf /var/cache/apk/*
# to set home directory
ENV JULIA_PROJECT @.

WORKDIR /home

ENV VERSION 1
ADD . /home

# RUN cd /deploy 
RUN julia deploy/packagecompile.jl

ENTRYPOINT ["julia", "-JApp.so", "-t", "auto", "-L", "src/main.jl", "-e", "App.start()"]

Error:

#15 125.8   2 dependencies errored. To see a full report either run `import Pkg; Pkg.precompile()` or load the packages
#15 133.9 Precompiling project...
#15 135.2   ✗ EzXML
#15 144.0   ✗ Genie
#15 144.9   0 dependencies successfully precompiled in 12 seconds (159 already precompiled)  
#15 144.9
#15 145.1 ERROR: The following 1 direct dependency failed to precompile:
#15 146.3
#15 146.3 Genie [c43c736e-a2d1-11e8-161f-af95117fbd1e]
#15 146.3
#15 146.3 Failed to precompile Genie [c43c736e-a2d1-11e8-161f-af95117fbd1e] to /root/.julia/compiled/v1.6/Genie/jl_EifkBf.
#15 146.3 ERROR: LoadError: InitError: could not load library "/root/.julia/artifacts/2e766b27acc9456c126af7479b9449b58b38337a/lib/libxml2.so"
#15 146.3 Error loading shared library libiconv.so.2: No such file or directory (needed by /root/.julia/artifacts/2e766b27acc9456c126af7479b9449b58b38337a/lib/libxml2.so)
#15 146.3 Stacktrace:
#15 146.3   [1] dlopen(s::String, flags::UInt32; throw_error::Bool)
#15 146.3     @ Base.Libc.Libdl ./libdl.jl:114
#15 146.3   [2] dlopen(s::String, flags::UInt32)
#15 146.3     @ Base.Libc.Libdl ./libdl.jl:114
#15 146.3   [3] macro expansion
#15 146.3     @ ~/.julia/packages/JLLWrappers/QpMQW/src/products/library_generators.jl:54 [inlined]
#15 146.3   [4] __init__()
#15 146.3     @ XML2_jll ~/.julia/packages/XML2_jll/8hNQM/src/wrappers/x86_64-linux-musl.jl:12
#15 146.3   [5] _include_from_serialized(path::String, depmods::Vector{Any})
#15 146.3     @ Base ./loading.jl:696
#15 146.3   [6] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String)
#15 146.3     @ Base ./loading.jl:782
#15 146.3   [7] _require(pkg::Base.PkgId)
#15 146.3     @ Base ./loading.jl:1020
#15 146.3   [8] require(uuidkey::Base.PkgId)
#15 146.3     @ Base ./loading.jl:936
#15 146.3   [9] require(into::Module, mod::Symbol)
#15 146.3     @ Base ./loading.jl:923
#15 146.3  [10] include
#15 146.3     @ ./Base.jl:384 [inlined]
#15 146.3  [11] 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)
#15 146.3     @ Base ./loading.jl:1235
#15 146.3  [12] top-level scope
#15 146.3     @ none:1
#15 146.3  [13] eval
#15 146.3     @ ./boot.jl:360 [inlined]
#15 146.3  [14] eval(x::Expr)
#15 146.3     @ Base.MainInclude ./client.jl:446
#15 146.3  [15] top-level scope
#15 146.3     @ none:1
#15 146.3 during initialization of module XML2_jll
#15 146.3 in expression starting at /root/.julia/packages/EzXML/ZNwhK/src/EzXML.jl:1
#15 146.3 ERROR: LoadError: LoadError: Failed to precompile EzXML [8f5d6c58-4d21-5cfd-889c-e3ad7ee6a615] to /root/.julia/compiled/v1.6/EzXML/jl_eoIfJE.
#15 146.3 Stacktrace:
#15 146.3   [1] error(s::String)
#15 146.3     @ Base ./error.jl:33
#15 146.3   [2] compilecache(pkg::Base.PkgId, path::String, internal_stderr::Base.PipeEndpoint, internal_stdout::IOStream, ignore_loaded_modules::Bool)
#15 146.3     @ Base ./loading.jl:1385
#15 146.3   [3] compilecache(pkg::Base.PkgId, path::String)
#15 146.3     @ Base ./loading.jl:1329
#15 146.3   [4] _require(pkg::Base.PkgId)
#15 146.3     @ Base ./loading.jl:1043
#15 146.3   [5] require(uuidkey::Base.PkgId)
#15 146.3     @ Base ./loading.jl:936
#15 146.3   [6] require(into::Module, mod::Symbol)
#15 146.3     @ Base ./loading.jl:923
#15 146.3   [7] include(mod::Module, _path::String)
#15 146.3     @ Base ./Base.jl:384
#15 146.3   [8] include(x::String)
#15 146.3     @ Genie ~/.julia/packages/Genie/D7K3Y/src/Genie.jl:4
#15 146.3   [9] top-level scope
#15 146.3     @ ~/.julia/packages/Genie/D7K3Y/src/Genie.jl:38
#15 146.3  [10] include
#15 146.3     @ ./Base.jl:384 [inlined]
#15 146.3  [11] 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)
#15 146.3     @ Base ./loading.jl:1235
#15 146.3  [12] top-level scope
#15 146.3     @ none:1
#15 146.3  [13] eval
#15 146.3     @ ./boot.jl:360 [inlined]
#15 146.3  [14] eval(x::Expr)
#15 146.3     @ Base.MainInclude ./client.jl:446
#15 146.3  [15] top-level scope
#15 146.3     @ none:1
#15 146.3 in expression starting at /root/.julia/packages/Genie/D7K3Y/src/Renderer.jl:1      
#15 146.3 in expression starting at /root/.julia/packages/Genie/D7K3Y/src/Genie.jl:1
#15 146.3 Stacktrace:
#15 146.3  [1] pkgerror(msg::String)
#15 147.0    @ Pkg.Types /buildworker/worker/package_musl64/build/usr/share/julia/stdlib/v1.6/Pkg/src/Types.jl:55
#15 147.1  [2] precompile(ctx::Pkg.Types.Context; internal_call::Bool, strict::Bool, warn_loaded::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) 
#15 147.2    @ Pkg.API /buildworker/worker/package_musl64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:1265
#15 147.2  [3] precompile
#15 147.2    @ /buildworker/worker/package_musl64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:921 [inlined]
#15 147.2  [4] #precompile#196
#15 147.2    @ /buildworker/worker/package_musl64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:919 [inlined]
#15 147.2  [5] precompile()
#15 147.2    @ Pkg.API /buildworker/worker/package_musl64/build/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:919
#15 147.2  [6] top-level scope
#15 147.2    @ none:1
#15 147.4 ERROR: LoadError: failed process: Process(setenv(`/usr/local/julia/bin/julia --color=auto --startup-file=no --sysimage=/usr/local/julia/lib/julia/sys.so -e 'using Pkg; Pkg.precompile()'`,["PATH=/usr/local/julia/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "JULIA_PROJECT=@.", "PWD=/home", "JULIA_PATH=/usr/local/julia", "JULIA_GPG=3673DF529D9049477F76B37566E3C7DC03D6E495", "JULIA_VERSION=1.6.5", "OPENBLAS_NUM_THREADS=8", "VERSION=1", "SHLVL=1", "JULIA_LOAD_PATH=/home:@stdlib", "HOME=/root", "OPENBLAS_MAIN_FREE=1", "PYTHONUNBUFFERED=1"]), ProcessExited(1)) [1]
#15 149.0
#15 149.0 Stacktrace:
#15 149.0  [1] pipeline_error
#15 149.5  [4] ensurecompiled(project::String, packages::Vector{String}, sysimage::String)
#15 149.5    @ PackageCompiler ~/.julia/packages/PackageCompiler/wpsGv/src/PackageCompiler.jl:225
#15 149.5  [5] create_sysimage(packages::Nothing; sysimage_path::String, project::String, precompile_execution_file::String, precompile_statements_file::Vector{String}, 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, version::Nothing, soname::Nothing, compat_level::String, extra_precompiles::String)
#15 149.6    @ PackageCompiler ~/.julia/packages/PackageCompiler/wpsGv/src/PackageCompiler.jl:462
#15 149.6  [6] top-level scope
#15 149.6    @ /home/deploy/packagecompile.jl:6#15 149.6 in expression starting at /home/deploy/packagecompile.jl:6------
failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c julia deploy/packagecompile.jl]: exit code: 1

This error is observed only with alpine version of julia 1.6.5 image, but it builds and works on buster version.
May I ask what could be cause of this error and would appreciate your help and advice to resolve this issue.

Thanks, look forward to hearing from you !

Thanks for tag @mdsa3d

I just ran into the same issue, Alpine version 3.17, Julia version 1.8.3.

...and found that adding

RUN apk add gnu-libiconv-libs

to the Dockerfile is a solid workaround.