bugGNU gettext - Bugs: bug #62659, libgettextpo.so has undefined...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #62659: libgettextpo.so has undefined reference to gl_get_setlocale_null_lock on musl

Submitter:  Sam James <thesamesam>
Submitted:  Wed 22 Jun 2022 01:46:45 AM UTC
   
 
Category:  Build Severity:  3 - Normal
Item Group:  None Status:  Works For Me
Privacy:  Public Assigned to:  haible
Open/Closed:  Closed

Jump to the original submission

Mon 29 Aug 2022 08:29:15 PM UTC, comment #9: 

Hello! In gettext-tools/libgettextpo/setlocale-lock.c there's this comment over '#if OMIT_SETLOCALE_LOCK':
"When it is known that the gl_get_setlocale_null_lock function is defined by a dependency library, it should not be defined here."
So, for Alpine Linux it is fine because they use GNU's libintl. But on Gentoo we use musl libc's libintl, so we need to set OMIT_SETLOCALE_LOCK to 0.

Gettext currently just forces OMIT_SETLOCALE_LOCK to 1 in gettext-tools/libgettextpo/Makefile.am, but this should probably be done using a check with AC_SEARCH_LIBS([gl_get_setlocale_null_lock], [intl], ...).

Just forcing it to 1 gives
```
nm -D /usr/lib/libgettextpo.so | grep gl_get_se

> 0000000000042df0 T gl_get_setlocale_null_lock

```

Alfred Persson Forsberg <cat>
Mon 04 Jul 2022 10:11:17 PM UTC, comment #8: 


> If I build with the packaging/ebuild, which uses --without-included-libunistring, it always fails.


If I build with "ac_cv_libunistring=no ./configure --without-libunistring-prefix", I can see the following:


$ readelf -d libgettextpo.so | grep NEEDED
...
libintl.so.8



$ nm --dynamic libintl.so.8
...
0000000000000000 T gl_get_setlocale_null_lock
...


So, in this case too, the symbol gl_get_setlocale_null_lock is defined by the dependency libraries of libgettextpo.so.

You can have packages like coreutils, gcal, etc. use libc instead of libintl. That's one thing. But you can't use libgettextpo without libintl, because libintl is a dependency of libgettextpo.

Bruno Haible <haible>
Group administrator
Sun 03 Jul 2022 10:11:25 PM UTC, comment #7: 

Ah, I think I see what's happening now.

If I build with the packaging/ebuild, which uses --without-included-libunistring, it always fails.

If I build from source, and upgrade libunistring to 1.0 first, it's fine.

So, I guess the older copy of libunistring in the last gettext release exposes the issue.

Sam James <thesamesam>
Sun 03 Jul 2022 09:34:42 PM UTC, comment #6: 


> in Gentoo, at least for now, we use musl's libintl (which is part of libc.so).


Still, the symbol gl_get_setlocale_null_lock should be exported from libunistring.so.2. Does "nm --dynamic /usr/lib/libunistring.so.2" show this symbol? If not, make sure you use the newest libunistring release (1.0).

Bruno Haible <haible>
Group administrator
Sun 03 Jul 2022 04:44:27 PM UTC, comment #5: 

Note that it's interesting you even have a libintl.so on Alpine.  So our setups aren't equal anyway.

It's because they actually use the GNU libintl package, whereas in Gentoo, at least for now, we use musl's libintl (which is part of libc.so).

Sam James <thesamesam>
Sun 03 Jul 2022 04:37:56 PM UTC, comment #4: 

Outside the chroot:
1. mkdir /tmp/musl-gentoo && cd /tmp/musl-gentoo
2. wget https://bouncer.gentoo.org/fetch/root/all/releases/amd64/autobuilds/20220626T170536Z/stage3-amd64-musl-20220626T170536Z.tar.xz && tar xvf stage3-amd64-musl-20220626T170536Z.tar.xz
3. chroot in to /tmp/musl-gentoo as desired (I used systemd-nspawn -D . for convenience, you can use whichever you prefer)

Within the chroot:
1. mkdir /tmp/gettext && cd /tmp/gettext
2. wget https://ftp.gnu.org/gnu/gettext/gettext-0.21.tar.xz && tar xvf gettext-0.21.tar.xz && cd gettext-0.21
3. ./configure --prefix=/tmp/gettext/build && make -j$(nproc) && make -j$(nproc) install
4. ```
# ldd /tmp/gettext/build/lib/libgettextpo.so
        ldd (0x7fd27925c000)
        libc.so => ldd (0x7fd27925c000)
        libunistring.so.2 => /usr/lib/libunistring.so.2 (0x7fd279079000)
Error relocating /tmp/gettext/build/lib/libgettextpo.so: gl_get_setlocale_null_lock: symbol not found
```

I can assist, if you need it, with getting development tools within the chroot/Gentoo environment. Or answer any questions about it.

Sam James <thesamesam>
Sun 03 Jul 2022 04:29:56 PM UTC, comment #3: 

I've reproduced it when building straight from git with std configure && make && ..., so I don't think the packaging is going to be related.

What do you need me to grab for you?

Sam James <thesamesam>
Sun 03 Jul 2022 03:49:06 PM UTC, comment #2: 

The difference between your build and my build is probably that you used Gentoo build recipes, whereas I built the package from source, using the standard configure && make && make install combo.

Bruno Haible <haible>
Group administrator
Sun 03 Jul 2022 03:46:25 PM UTC, comment #1: 

On Alpine Linux, a system with musl libc, I can see the following:


$ readelf -d libgettextpo.so | grep NEEDED
...
libintl.so.8
libunistring.so.2



$ nm --dynamic libintl.so.8
...
0000000000000000 T gl_get_setlocale_null_lock
...



$ nm --dynamic libunistring.so.2
...
0000000000047420 T gl_get_setlocale_null_lock
...


That is, the symbol gl_get_setlocale_null_lock by the dependency libraries of libgettextpo.so (even by two of them).

Bruno Haible <haible>
Group administrator
Wed 22 Jun 2022 01:46:45 AM UTC, original submission:  

Originally noticed when hitting a bug similar to https://bugs.gentoo.org/830590 in Gentoo (in this case, it was kde-apps/poxml).

In the gtranslator case (as reported in the above Gentoo bug):
```
FAILED: src/gtranslator
x86_64-gentoo-linux-musl-gcc  -o src/gtranslator src/gtranslator.p/main.c.o src/libgtranslator.so.p/gtr-actions-app.c.o src/libgtranslator.so.p/gtr-actions-documents.c.o src/libgtranslator.so.p/gtr-actions-edit.c.o src/libgtranslator.so.p/gtr-actions-file.c.o src/libgtranslator.so.p/gtr-actions-go.c.o src/libgtranslator.so.p/gtr-actions-search.c.o src/libgtranslator.so.p/gtr-actions-view.c.o src/libgtranslator.so.p/gtr-application.c.o src/libgtranslator.so.p/gtr-assistant.c.o src/libgtranslator.so.p/gtr-close-button.c.o src/libgtranslator.so.p/gtr-close-confirmation-dialog.c.o src/libgtranslator.so.p/gtr-context.c.o src/libgtranslator.so.p/gtr-dirs.c.o src/libgtranslator.so.p/gtr-file-dialogs.c.o src/libgtranslator.so.p/gtr-header.c.o src/libgtranslator.so.p/gtr-header-dialog.c.o src/libgtranslator.so.p/gtr-history-entry.c.o src/libgtranslator.so.p/gtr-io-error-info-bar.c.o src/libgtranslator.so.p/gtr-jump-dialog.c.o src/libgtranslator.so.p/gtr-language.c.o src/libgtranslator.so.p/gtr-languages-fetcher.c.o src/libgtranslator.so.p/gtr-message-container.c.o src/libgtranslator.so.p/gtr-message-table.c.o src/libgtranslator.so.p/gtr-message-table-model.c.o src/libgtranslator.so.p/gtr-msg.c.o src/libgtranslator.so.p/gtr-notebook.c.o src/libgtranslator.so.p/gtr-po.c.o src/libgtranslator.so.p/gtr-preferences-dialog.c.o src/libgtranslator.so.p/gtr-profile.c.o src/libgtranslator.so.p/gtr-profile-dialog.c.o src/libgtranslator.so.p/gtr-profile-manager.c.o src/libgtranslator.so.p/gtr-settings.c.o src/libgtranslator.so.p/gtr-tab.c.o src/libgtranslator.so.p/gtr-tab-label.c.o src/libgtranslator.so.p/gtr-utils.c.o src/libgtranslator.so.p/gtr-view.c.o src/libgtranslator.so.p/gtr-projects.c.o src/libgtranslator.so.p/gtr-dl-teams.c.o src/libgtranslator.so.p/gtr-filter-selection.c.o src/libgtranslator.so.p/gtr-lang-button.c.o src/libgtranslator.so.p/gtr-progress.c.o src/libgtranslator.so.p/gtr-window.c.o src/libgtranslator.so.p/gtr-search-bar.c.o src/libgtranslator.so.p/translation-memory_gda_gda-utils.c.o src/libgtranslator.so.p/translation-memory_gda_gtr-gda.c.o src/libgtranslator.so.p/translation-memory_gtr-translation-memory.c.o src/libgtranslator.so.p/translation-memory_gtr-translation-memory-dialog.c.o src/libgtranslator.so.p/translation-memory_gtr-translation-memory-ui.c.o src/libgtranslator.so.p/translation-memory_gtr-translation-memory-utils.c.o src/libgtranslator.so.p/codeview_gtr-codeview.c.o src/libgtranslator.so.p/codeview_gtr-viewer.c.o src/libgtranslator.so.p/meson-generated_.._gtr-marshal.c.o src/libgtranslator.so.p/meson-generated_.._gtr-enum-types.c.o src/libgtranslator.so.p/meson-generated_.._gtr-resources.c.o src/libgtranslator.so.p/meson-generated_.._translation-memory_gtr-translation-memory-resources.c.o src/libgtranslator.so.p/meson-generated_.._codeview_gtr-codeview-resources.c.o -Wl,--as-needed -Wl,--no-undefined -O2 -pipe -march=x86-64 -frecord-gcc-switches -fno-diagnostics-color -fmessage-length=0 -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,--start-group /usr/lib/libglib-2.0.so /usr/lib/libgtk-3.so /usr/lib/libgdk-3.so /usr/lib/libpangocairo-1.0.so /usr/lib/libpango-1.0.so /usr/lib/libharfbuzz.so /usr/lib/libatk-1.0.so /usr/lib/libcairo-gobject.so /usr/lib/libcairo.so /usr/lib/libgdk_pixbuf-2.0.so /usr/lib/libgio-2.0.so /usr/lib/libgobject-2.0.so /usr/lib/libhandy-1.so /usr/lib/libdazzle-1.0.so /usr/lib/libgda-5.0.so /usr/lib/libgthread-2.0.so -pthread /usr/lib/libxml2.so /usr/lib/libgspell-1.so /usr/lib/libenchant-2.so /usr/lib/libgtksourceview-4.so /usr/lib/libsoup-2.4.so -Wl,--export-dynamic /usr/lib/libgmodule-2.0.so /usr/lib/libjson-glib-1.0.so -lgettextpo -Wl,--end-group
/usr/lib/gcc/x86_64-gentoo-linux-musl/11.2.1/../../../../x86_64-gentoo-linux-musl/bin/ld: /usr/lib/gcc/x86_64-gentoo-linux-musl/11.2.1/../../../../lib/libgettextpo.so: undefined reference to `gl_get_setlocale_null_lock'
```

libgettextpo.so definitely seems broken:
```
$ nm -D /usr/lib/libgettextpo.so | grep gl_get_setlocale_null_lock
U gl_get_setlocale_null_lock
```

On a glibc system, however, the output is (as expected) blank.

System information:
```
Portage 3.0.30 (python 3.10.5-final-0, default/linux/amd64/17.0/musl/hardened, gcc-12.1.0, musl-1.2.3, 5.15.48-gentoo-dist-hardened x86_64)
=================================================================
System uname: Linux-5.15.48-gentoo-dist-hardened-x86_64-AMD_Ryzen_9_3950X_16-Core_Processor-with-libc
KiB Mem:    65764888 total,  10305884 free
KiB Swap:   25067512 total,  24799480 free
Timestamp of repository gentoo: Tue, 21 Jun 2022 23:17:43 +0000
sh bash 9999
ld GNU ld (Gentoo 2.38 p4) 2.38
app-misc/pax-utils:        1.3.4::gentoo
app-shells/bash:           9999::gentoo
dev-lang/perl:             5.36.0::gentoo
dev-lang/python:           3.8.13_p2::gentoo, 3.9.13::gentoo, 3.10.5::gentoo, 3.11.0_beta3::gentoo
dev-util/cmake:            3.23.2::gentoo
dev-util/meson:            0.62.2::gentoo
sys-apps/baselayout:       2.8::gentoo
sys-apps/openrc:           0.45.1::gentoo
sys-apps/sandbox:          2.29::gentoo
sys-devel/autoconf:        2.71-r1::gentoo
sys-devel/automake:        1.16.5::gentoo
sys-devel/binutils:        2.38-r2::gentoo
sys-devel/binutils-config: 5.4.1::gentoo
sys-devel/gcc:             10.3.1_p20211126::gentoo, 11.3.0::gentoo, 12.1.0::gentoo
sys-devel/gcc-config:      2.5-r1::gentoo
sys-devel/libtool:         2.4.7::gentoo
sys-devel/make:            4.3::gentoo
sys-kernel/linux-headers:  5.18-r1::gentoo (virtual/os-headers)
sys-libs/musl:             1.2.3::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts:
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-jobs: 1

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-gentoo-linux-musl"
CFLAGS="-O2 -pipe -march=native"
CHOST="x86_64-gentoo-linux-musl"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=native -D_GLIBCXX_ASSERTIONS"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going=y"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -pipe -march=native"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=native"
GENTOO_MIRRORS="http://mirror.bytemark.co.uk/gentoo/ http://www.mirrorservice.org/sites/distfiles.gentoo.org/ http://mirrors.soeasyto.com/distfiles.gentoo.org/"
INSTALL_MASK="charset.alias /usr/share/locale/locale.alias"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="acl amd64 bzip2 crypt hardened iconv ipv6 libglvnd libtirpc ncurses nls nptl openmp openssl pam pcre pie readline seccomp split-usr ssl ssp unicode verify-sig xattr xtpax zlib" ABI_X86="64" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="musl" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_9 python3_10 python3_8" RUBY_TARGETS="ruby27" USERLAND="GNU" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, MAKEOPTS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SHELL, SIZE, STRINGS, STRIP, YACC, YFLAGS
```

gettext 0.21 but I've reproduced this on git master at fdc2bd236a6a62b477c1fca4205df10b0e64266b.

I'll attach the full compressed log from building gettext.

Sam James <thesamesam>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #53330:  config.log.tar.gz added by thesamesam (137KiB - application/x-gzip - config.log.tar.gz (all config.logs in a tarball))
file #53329:  build.log.gz added by thesamesam (97KiB - application/x-gzip - build.log.gz)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by cat (Posted a comment)
  • -email is unavailable- added by haible (Posted a comment)
  • -email is unavailable- added by thesamesam (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-07-03 haible StatusNone Works For Me
        Assigned toNone haible
        Open/ClosedOpen Closed
    2022-06-22 thesamesam Attached File- Added config.log.tar.gz, #53330
    2022-06-22 thesamesam Attached File- Added build.log.gz, #53329

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code