Open stncrn opened 2 years ago
I met the same problem, anyone help?
When using github action, I also has same issue.
but when I build locally, it works fine.
I can confirm that running /usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8
in a container based on alpine:latest
locally works, but the same in a ci/cd pipeline on gitlab.com fails. However, downgrading the three glibc packages from 2.34 to 2.33 fixes the problem. Is glibc-i18n-2.34-r0.apk
missing some files, which are "magically" not needed in the local Linux VM used by Docker for Mac, but are missing, when run on a GitLab runner?
Successful build job of alpine 3.14 and glibc 2.33. Failed build job of alpine 3.14 and glibc 2.34.
Step 4/6 : RUN ls -l /usr/glibc-compat/share/i18n/locales/en_US
-rw-r--r-- 1 root root 3688 Aug 19 15:53 /usr/glibc-compat/share/i18n/locales/en_US
Step 5/6 : RUN ls -l /usr/glibc-compat/share/i18n/charmaps/UTF-8.gz
-rw-r--r-- 1 root root 434115 Aug 19 15:53 /usr/glibc-compat/share/i18n/charmaps/UTF-8.gz
Step 6/6 : RUN /usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8
[error] character map file `UTF-8' not found: No such file or directory
[error] default character map file `ANSI_X3.4-1968' not found: No such file or directory
Does localedef
not look to glibc-compat
any more?
Setting I18NPATH=/usr/glibc-compat/share/i18n
and enabling verbose logging according to the documentation does not change the output and result of localedef
either. Strange.
I met the same problem!
Enabling strace revealed a failure when trying to use the gzipped file:
openat(AT_FDCWD, "/usr/glibc-compat/share/i18n/charmaps/UTF-8", O_RDONLY) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/glibc-compat/share/i18n/charmaps/UTF-8.gz", O_RDONLY) = 4
newfstatat(4, "", {st_mode=S_IFREG|0644, st_size=434115, ...}, AT_EMPTY_PATH) = 0
pipe([5, 6]) = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024*1024, rlim_max=1024*1024}) = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024*1024, rlim_max=1024*1024}) = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024*1024, rlim_max=1024*1024}) = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024*1024, rlim_max=1024*1024}) = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024*1024, rlim_max=1024*1024}) = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024*1024, rlim_max=1024*1024}) = 0
prlimit64(0, RLIMIT_NOFILE, NULL, {rlim_cur=1024*1024, rlim_max=1024*1024}) = 0
mmap(NULL, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7fbab988b000
rt_sigprocmask(SIG_BLOCK, ~[], [], 8) = 0
clone3({flags=CLONE_VM|CLONE_VFORK, exit_signal=SIGCHLD, stack=0x7fbab988b000, stack_size=0x9000}, 88) = -1 EPERM (Operation not permitted)
Alpine 3.14 has a new security call, which needs Docker 20.10.6 or newer and got recognised by GitLab. The error that I encountered might have been specific to GitLab caused by this incompatibility.
I gunzipped the UTF-8 charmap as a workaround, which got the build green:
gunzip --keep /usr/glibc-compat/share/i18n/charmaps/UTF-8.gz
Same problem here. Trying to use pdfium binary library from here: https://github.com/bblanchon/pdfium-binaries/releases/ that works on ubuntu (glibc) but doesn't on alpine (musl) because musl implementation of glic miss some symbols... so i installed this glibc compatible package hoping that will work... but I even cannot try its "ldd" to analyse the library because ldd cannot be run... I cannot understand what I'm missing... its ldd cannot be run, and the default ldd (from musl) cannot be configured to make use of this glibc implementation ... so...?
@budo76, the prolog of /usr/glibc-compat/bin/ldd
reveals the problem:
#! /usr/bin/bash
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
There is no /usr/bin/bash
on Alpine. Even if you run apk add bash
, you will get Bash in /bin/bash
. You can assume that the sh
on Alpine is Busybox, which includes Bash and fix the shebang after you install this package in your container:
sed -i 's#/usr/bin/bash#/bin/sh#' /usr/glibc-compat/bin/ldd
Or you could symlink the bash
file:
ln -s /bin/sh /usr/bin/bash
OK @prantlf ... I installed bash (indeed there's bash in Alpine!) and now the provided "ldd" starts but still not working (state that I have no read permission on the "libpdfium.so" but it's 777 so I can read it indeed). I tried to use the provided "ldd" because somewhere else (can't find now) someone suggested so, but it was just to analyse the lib to findout if it was all ok. I'm trying to link the library in a "golang" software, so I tried setting the appropriate env variabile for the "cgo" compiler manually... so CGO_LDFLAGS="-L/usr/glibc-compat/lib". Still no luck... it reads: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find /usr/glibc-compat/lib/libc_nonshared.a So perhaps in this "compatible glibc" distribution there's still something missing?
OK @prantlf ... I installed bash (indeed there's bash in Alpine!) and now the provided "ldd" starts but still not working (state that I have no read permission on the "libpdfium.so" but it's 777 so I can read it indeed). I tried to use the provided "ldd" because somewhere else (can't find now) someone suggested so, but it was just to analyse the lib to findout if it was all ok. I'm trying to link the library in a "golang" software, so I tried setting the appropriate env variabile for the "cgo" compiler manually... so CGO_LDFLAGS="-L/usr/glibc-compat/lib". Still no luck... it reads: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: cannot find /usr/glibc-compat/lib/libc_nonshared.a So perhaps in this "compatible glibc" distribution there's still something missing?
Ok I found that the "dev" package was missing and I installed it. Now I get this:
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: warning: libpthread.so.0, needed by /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: warning: libm.so.6, needed by /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /lib/libc.musl-x86_64.so.1: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /lib/libc.musl-x86_64.so.1: warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /lib/libc.musl-x86_64.so.1: warning: the `gets' function is dangerous and should not be used.
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /lib/libc.musl-x86_64.so.1: warning: the use of `tempnam' is dangerous, better use `mkstemp'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `floor@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `ceil@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `log10f@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `lrintf@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `acosf@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `sqrtf@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `sqrt@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `floorf@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `log10@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `atan2f@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `roundf@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `powf@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `ceilf@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `exp@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `log@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `sinf@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `logf@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `round@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `cosf@GLIBC_2.2.5'
/usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../x86_64-alpine-linux-musl/bin/ld: /usr/lib/gcc/x86_64-alpine-linux-musl/10.3.1/../../../../lib/libpdfium.so: undefined reference to `pow@GLIBC_2.2.5'
collect2: error: ld returned 1 exit status
.. for what I understand the "libm" library is missing (and it complains on symbols that seem to be "math" functions).. in alpine there's the lib6-compat that provides those libraries but it' not compatible with this glibc alternative so I cannot install them. Any idea?
Hello and thanks for raising these errors. There are 2 raised:
/usr/glibc-compat/bin/localedef
/usr/glibc-compat/bin/ldd
The first error is a valid one and I'll look into fixing this over the course of this week. The second error is caused by /usr/glibc-compat/bin/ldd
using /bin/bash
, so you just need to make sure that it's installed.
The second error is caused by
/usr/glibc-compat/bin/ldd
using/bin/bash
, so you just need to make sure that it's installed.
On (near instantaneous) reflection, it would make more sense to have bash
installed as a dependency of glibc-bin
so I'll make that change now.
The previous comment was done in https://github.com/sgerrand/alpine-pkg-glibc/pull/171/commits/ee7ffc8c1b683d1642e2e33bed80064399efe561.
I missed the third aspect of this bug report – apologies!
Last info, the symbols the .so is missing with the musl libc:
ldd /opt/tw_proteccio/lib/libnethsm.so
You should always use /usr/glibc-compat/bin/ldd
(note the prefix) when attempting to use ldd
on compiled files. The musl-c equivalent will return invalid responses as it has different expectations from the GNU equivalent.
Just to double check ...
Just to double check ...
- The "missing character map files when using /usr/glibc-compat/bin/localedef" issue was NOT addressed as part of the 2.35-r0 release?
That's correct, sorry. I haven't had any free time to look into it further.
- You still intend to address it?
If you're asking whether I still plan to fix this bug – yes, I do. Unfortunately that's dependant on when I get that free time to do so. If you happen to have the time to fix it then please submit a patch and I'll happily review it!
@prantlf's tip here ...
I gunzipped the UTF-8 charmap as a workaround, which got the build green:
gunzip --keep /usr/glibc-compat/share/i18n/charmaps/UTF-8.gz
... might be worth including in the README.md Locales example ...
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r0/glibc-bin-2.35-r0.apk
wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r0/glibc-i18n-2.35-r0.apk
apk add glibc-bin-2.35-r0.apk glibc-i18n-2.35-r0.apk
gunzip --keep /usr/glibc-compat/share/i18n/charmaps/UTF-8.gz
/usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8
It unblocked my issue, but it took me a while to notice that comment among the many on this issue, and to then connect the dots. If nothing else, maybe this comment will help someone else make that same connection.
Hello,
I'm having trouble in using your latest glibc 2.34 in an alpine container (latest).
What I'm running:
In docker-compose.yml:
Then on the host:
And finally in the container:
Then, when running:
/usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8
I get :
I also tried to check if my .so is now beeing linked with the new libc. Problem, the ldd from your package cannot be executed:
Seems like the added libs are not being used at all. I also tried
export LD_LIBRARY_PATH=/usr/glibc-compat/lib
before the other commands, it didn't changed anything.Last info, the symbols the .so is missing with the musl libc:
I also tried glibc 2.33 instead of 2.34, with the same results.
A restart of the container didn't helped either. (docker restart alp)
What I'm trying to do seems quite basic, do you ave any idea of what's going wrong so quickly? Thanks.