Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PCRE initialization error on alpine #31903

Closed
fredrikekre opened this issue May 2, 2019 · 6 comments
Closed

PCRE initialization error on alpine #31903

fredrikekre opened this issue May 2, 2019 · 6 comments
Labels
building Build system, or building Julia or its dependencies system:linux Affects only Linux

Comments

@fredrikekre
Copy link
Member

I get the following error on alpine:

WARNING: Error during initialization of module PCRE:
ErrorException("could not load library "libpcre2-8"
Error loading shared library libpcre2-8.so: No such file or directory")
fatal: error thrown and no exception handler available.
InitError(mod=:Sys, error=ErrorException("could not load library "libpcre2-8"
Error loading shared library libpcre2-8.so: No such file or directory"))
rec_backtrace at /julia-source/src/stackwalk.c:94
jl_throw at /julia-source/src/task.c:210
jl_module_run_initializer at /julia-source/src/toplevel.c:81
_julia_init at /julia-source/src/init.c:854
main at /julia-source/ui/repl.c:211
__libc_start_main at /lib/ld-musl-x86_64.so.1 (unknown line)

which happens after packing a tarball with make binary-dist and then unpacking. Julia runs perfectly fine in the build directory.

Dockerfile:

FROM alpine:3.9.3
RUN apk add --update git make tar gcc python gfortran g++ perl
WORKDIR /julia-source
RUN git clone --progress https://github.com/JuliaLang/julia.git .
RUN echo 'override USE_BINARYBUILDER_UNWIND=0' >> Make.user
RUN make -j4
RUN make release
RUN make binary-dist
RUN mkdir -p /julia && tar -C /julia --strip-components=1 -xzf julia*.tar.gz
CMD ["/julia/bin/julia"]
@fredrikekre fredrikekre changed the title Initialization error on alpine PCRE initialization error on alpine May 2, 2019
@fredrikekre fredrikekre added building Build system, or building Julia or its dependencies system:linux Affects only Linux labels May 2, 2019
@ararslan
Copy link
Member

ararslan commented May 5, 2019

I downloaded the BinaryBuilder PCRE2 v10.31 in an Alpine 3.8 Docker container, and using an old Julia build I had laying around (v1.2.0-DEV.448 from the beginning of March) I was able to dlopen("libpcre2-8.so"). That suggests to me that it isn't likely a problem with the library itself or how it was built. Maybe it's being installed in the wrong place so Julia doesn't know where to find it?

@ararslan
Copy link
Member

ararslan commented May 5, 2019

I did an identical (or as much so as I could) build in an Ubuntu Docker container to compare ldd, objdump -p, etc. since I had a hunch that it could be an RPATH issue. Everything seems to be in order there, as far as I can tell...

@staticfloat, do you have any sagely debugging tips for us?

@fredrikekre
Copy link
Member Author

@ararslan
Copy link
Member

ararslan commented May 5, 2019

open("/julia/bin/../lib/libpcre2-8", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

That isn't the right directory. You said WORKDIR /julia-source and cloned into ., so the root of the clone should be /julia-source, but it's looking in /julia. Furthermore, it should be looking for libpcre2-8 in lib/julia rather than lib.

@fredrikekre
Copy link
Member Author

fredrikekre commented May 5, 2019

I unpacked into /julia, but you are right, it should look in /julia/bin/../lib/julia/libpcre2-8.

@staticfloat
Copy link
Member

My best guess here is that the RPATH of julia itself is $ORIGIN/../lib, and the RPATH of libjulia is $ORIGIN:$ORIGIN/julia. This works fine on glibc (since the dlopen("libpcre2-8") is happening within libjulia, it uses the library's RPATH) but I wonder if musl instead pays attention only to the originating executable? An easy way to test this would be to set the julia binary's RPATH to be $ORIGIN/../lib:$ORIGIN/../lib/julia.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
building Build system, or building Julia or its dependencies system:linux Affects only Linux
Projects
None yet
Development

No branches or pull requests

3 participants