sgerrand / alpine-pkg-glibc

A glibc compatibility layer package for Alpine Linux
2.07k stars 280 forks source link

libgcc_s.so.1 dependency? #6

Closed frol closed 8 years ago

frol commented 8 years ago

I do understand that this is a glibc package, but it seems to be a better place to discuss this than the "Java issue" in docker-alpine repo.

I have bumped into a case when libgcc_s.so.1 is required as an indirect dependency:

$ grep -r libgcc_s /usr/glibc-compat/
/usr/glibc-compat/lib/librt-2.22.so:libgcc_s.so.1 must be installed for pthread_cancel to work
/usr/glibc-compat/lib/libpthread-2.22.so:libgcc_s.so.1 must be installed for pthread_cancel to work
/usr/glibc-compat/lib/libc-2.22.so:libgcc_s.so.1 must be installed for pthread_cancel to work

Again, copying the libgcc_s.so.1 from my Arch Linux makes the executables using pthread_cancel call work.

frol commented 8 years ago

BTW, I don't hit this error message ("libgcc_s.so.1 must be installed for pthread_cancel to work") with glibc 2.21.

frol commented 8 years ago

It seems that there was libgcc_s.so.1 included in glibc 2.21 artifacts as I see /usr/lib/libgcc_s.so.1 in my frolvlad/alpine-glibc image.

andyshinn commented 8 years ago

Yea, 2.21 was the artifact from Arch Linux and 2.22 is from the custom built binary. It may just be an option at build time for glibc. But I'm not sure. Will do some more research.

andyshinn commented 8 years ago

Maybe one of these configure options? https://projects.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/glibc#n66

frol commented 8 years ago

I don't believe that libgcc_s.so.1 was/is a part of glibc package on Arch Linux because when I do pacman -Qo /usr/lib/libgcc_s.so.1, it reports that the library is owned by gcc-libs.

andyshinn commented 8 years ago

It looks like that version may have traced libgcc as a dependency and pulled it in while the latest one does not:

# apk --allow-untrusted add glibc-2.21-r2.apk 
(1/2) Installing libgcc (5.3.0-r0)
(2/2) Installing glibc (2.21-r2)

Do you think this needs to be a dependency or can you just apk add libgcc?

frol commented 8 years ago

Hmm, I have already tried to install libgcc from Alpine and also tried to copy the library to /usr/glibc-compat/lib/, but the error was still there. I'm trying this again, will provide the results shortly.

frol commented 8 years ago

Unfortunately, libgcc package doesn't help when I'm using glibc 2.22.

FROM frolvlad/alpine-glibc:alpine-3.3_glibc-2.22

RUN apk add --no-cache --virtual=build-dependencies wget ca-certificates tar xz && \
    wget "https://www.archlinux.org/packages/extra/x86_64/mono/download/" -O "/tmp/mono.pkg.tar.xz" && \
    tar -xJf "/tmp/mono.pkg.tar.xz" && \
    apk del build-dependencies && \
    rm /tmp/*

RUN apk add --no-cache libgcc && mozroots --import --ask-remove

The most unfortunate part is that mozroots fails at the very end, after the "main work" is done:

Mozilla Roots Importer - version 4.2.2.0
Download and import trusted root certificates from Mozilla's MXR.
Copyright 2002, 2003 Motus Technologies. Copyright 2004-2008 Novell. BSD licensed.

Downloading from 'http://mxr.mozilla.org/seamonkey/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1'...
Importing certificates into user store...
Import process completed.

libgcc_s.so.1 must be installed for pthread_cancel to work

Native stacktrace:

Debug info from gdb:

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

Aborted (core dumped)
andyshinn commented 8 years ago

This was working with glibc-2.21-r2?

frol commented 8 years ago

Yes. You can try it by changing FROM statement to:

FROM frolvlad/alpine-glibc:alpine-3.3
andyshinn commented 8 years ago

I think this has to do with the way the glibc /usr/glibc-compat/etc/ld.so.cache is generated. Can you try first doing /usr/glibc-compat/sbin/ldconfig /lib /usr/lib and then running mozroots?

If this works, I think we just need to add back the ldconfig trigger (which was at https://github.com/andyshinn/alpine-pkg-glibc/commit/5e743adfab29782406d5c46092a6b6b6b41f65c9).

frol commented 8 years ago

Wow, that works...

frol commented 8 years ago

Thus, it seems that we need to add libgcc dependency + ldconfig trigger.

andyshinn commented 8 years ago

Give the latest glibc-bin-2.22-r8.apk a try.

frol commented 8 years ago

It seems to work!

P.S. It seems that all my tests are now passing, so I'm going to ask people in "Java issue" to test experimental images of OracleJDK and Mono based on glibc 2.22.