Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 895330

Summary: sys-devel/gettext-0.21.1: Undefined symbols for architecture arm64: "_gl_get_setlocale_null_lock"
Product: Gentoo/Alt Reporter: Tom Li <biergaizi2009>
Component: Prefix SupportAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal CC: jstein
Priority: Normal Keywords: PullRequest
Version: unspecified   
Hardware: ARM64   
OS: OS X   
See Also: https://github.com/gentoo/gentoo/pull/29655
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 886491    

Description Tom Li 2023-02-18 21:55:35 UTC
When bootstrapping Gentoo Prefix on macOS 13.2 (Ventura) on an Apple M1 system, it will fail at stage3 (note that there are other bugs that prevent the bootstrapping from reach stage3, which must also be resolved) due to a build failure in sys-devel/gettext-0.21.1.

libtool: link: arm64-apple-darwin22-gcc -dynamiclib  -o .libs/libgettextpo.0.dylib  .libs/gettext-po.o ../src/.libs/str-list.o ../src/.libs/dir-list.o ../src/.libs/message.o ../src/.libs/msgl-ascii.o ../src/.libs/po-error.o ../src/.libs/po-xerror.o ../src/.libs/write-catalog.o ../src/.libs/write-po.o ../src/.libs/open-catalog.o ../src/.libs/po-charset.o ../src/.libs/po-lex.o ../src/.libs/po-gram-gen.o ../src/.libs/read-po.o ../src/.libs/read-catalog-abstract.o ../src/.libs/read-catalog.o ../src/.libs/plural-table.o ../src/.libs/format-c.o ../src/.libs/format-python.o ../src/.libs/format-python-brace.o ../src/.libs/format-java.o ../src/.libs/format-java-printf.o ../src/.libs/format-csharp.o ../src/.libs/format-javascript.o ../src/.libs/format-scheme.o ../src/.libs/format-lisp.o ../src/.libs/format-elisp.o ../src/.libs/format-librep.o ../src/.libs/format-ruby.o ../src/.libs/format-sh.o ../src/.libs/format-awk.o ../src/.libs/format-lua.o ../src/.libs/format-pascal.o ../src/.libs/format-smalltalk.o ../src/.libs/format-qt.o ../src/.libs/format-qt-plural.o ../src/.libs/format-kde.o ../src/.libs/format-kde-kuit.o ../src/.libs/format-boost.o ../src/.libs/format-tcl.o ../src/.libs/format-perl.o ../src/.libs/format-perl-brace.o ../src/.libs/format-php.o ../src/.libs/format-gcc-internal.o ../src/.libs/format-gfc-internal.o ../src/.libs/format.o ../src/.libs/plural-exp.o ../src/.libs/plural-eval.o ../src/.libs/msgl-check.o ../src/.libs/sentence.o   -Wl,-force_load,./.libs/libgnu.a  -L/Users/ec2-user/gentoo/tmp/usr/lib -lc -liconv  -O2 -Wl,-dead_strip_dylibs   -install_name  /Users/ec2-user/gentoo/tmp/usr/lib/libgettextpo.0.dylib -compatibility_version 6 -current_version 6.8 -Wl,-single_module -Wl,-exported_symbols_list,.libs/libgettextpo-symbols.expsym
Undefined symbols for architecture arm64:
  "_gl_get_setlocale_null_lock", referenced from:
      _libgettextpo_setlocale_null_r in libgnu.a(setlocale_null.o)
      _libgettextpo_setlocale_null in libgnu.a(setlocale_null.o)
ld: symbol(s) not found for architecture arm64
collect2: error: ld returned 1 exit status
make[5]: *** [Makefile:3464: libgettextpo.la] Error 1
make[5]: Leaving directory '/Users/ec2-user/gentoo/tmp/var/tmp/portage/sys-devel/gettext-0.21.1/work/gettext-0.21.1-.arm64/gettext-tools/libgettextpo'
make[4]: *** [Makefile:3324: all] Error 2
make[4]: Leaving directory '/Users/ec2-user/gentoo/tmp/var/tmp/portage/sys-devel/gettext-0.21.1/work/gettext-0.21.1-.arm64/gettext-tools/libgettextpo'
make[3]: *** [Makefile:3029: all-recursive] Error 1
make[3]: Leaving directory '/Users/ec2-user/gentoo/tmp/var/tmp/portage/sys-devel/gettext-0.21.1/work/gettext-0.21.1-.arm64/gettext-tools'
make[2]: *** [Makefile:2897: all] Error 2
make[2]: Leaving directory '/Users/ec2-user/gentoo/tmp/var/tmp/portage/sys-devel/gettext-0.21.1/work/gettext-0.21.1-.arm64/gettext-tools'
make[1]: *** [Makefile:406: all-recursive] Error 1
make[1]: Leaving directory '/Users/ec2-user/gentoo/tmp/var/tmp/portage/sys-devel/gettext-0.21.1/work/gettext-0.21.1-.arm64'
make: *** [Makefile:362: all] Error 2
 * ERROR: sys-devel/gettext-0.21.1::gentoo_prefix failed (compile phase):
 *   emake failed
 *
 * If you need support, post the output of `emerge --info '=sys-devel/gettext-0.21.1::gentoo_prefix'`,
 * the complete build log and the output of `emerge -pqv '=sys-devel/gettext-0.21.1::gentoo_prefix'`.
 * The complete build log is located at '/Users/ec2-user/gentoo/tmp/var/tmp/portage/sys-devel/gettext-0.21.1/temp/build.log'.
 * The ebuild environment file is located at '/Users/ec2-user/gentoo/tmp/var/tmp/portage/sys-devel/gettext-0.21.1/temp/environment'.
 * Working directory: '/Users/ec2-user/gentoo/tmp/var/tmp/portage/sys-devel/gettext-0.21.1/work/gettext-0.21.1-.arm64'
 * S: '/Users/ec2-user/gentoo/tmp/var/tmp/portage/sys-devel/gettext-0.21.1/work/gettext-0.21.1'
!!! When you file a bug report, please include the following information:
GENTOO_VM=  CLASSPATH="" JAVA_HOME=""
JAVACFLAGS="" COMPILER=""
and of course, the output of emerge --info =gettext-0.21.1

A quick search of the symbol "_gl_get_setlocale_null_lock" revealed that the bug is actually already known - GNU gettext bug 62659 [1]. It failed to find the symbol because GNU's libintl was not present during the bootstrap stage (though it would be installed later), and due to the hardcoded OMIT_SETLOCALE_LOCK value, GNU gettext still attempts to use SETLOCALE_LOCK.

Crrently the Portage tree already contains a patch for musl [2].

use elibc_musl && eapply "${FILESDIR}"/${PN}-0.21-musl-omit_setlocale_lock.patch

The simplest fix is just applying the same patch to Darwin as well, as in:

use elibc_Darwin && eapply "${FILESDIR}"/${PN}-0.21-musl-omit_setlocale_lock.patch

[1] https://savannah.gnu.org/bugs/?62659

[2] https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-devel/gettext/gettext-0.21.1.ebuild
Comment 1 Larry the Git Cow gentoo-dev 2023-02-19 19:21:32 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b4388cc6898865367e9ae91385449313c5dfb96

commit 7b4388cc6898865367e9ae91385449313c5dfb96
Author:     Yifeng Li <tomli@tomli.me>
AuthorDate: 2023-02-19 19:21:17 +0000
Commit:     David Seifert <soap@gentoo.org>
CommitDate: 2023-02-19 19:21:17 +0000

    sys-devel/gettext: fix macOS bootstrap build.
    
    When bootstrapping Gentoo Prefix on macOS 13.2 (Ventura) on
    an Apple M1 system, it will fail at stage3 (note that there
    are other bugs that prevent the bootstrapping from reach stage3,
    which must also be resolved) due to the following build failure
    in sys-devel/gettext-0.21.1:
    
    Undefined symbols for architecture arm64:
      "_gl_get_setlocale_null_lock", referenced from:
          _libgettextpo_setlocale_null_r in libgnu.a(setlocale_null.o)
          _libgettextpo_setlocale_null in libgnu.a(setlocale_null.o)
    ld: symbol(s) not found for architecture arm64
    
    A quick search of the symbol "_gl_get_setlocale_null_lock"
    revealed that the bug is actually already known - GNU gettext
    bug 62659 [1]. It failed to find the symbol because GNU's libintl
    was not present during the bootstrap stage (though it would be
    installed later), and due to the hardcoded OMIT_SETLOCALE_LOCK value,
    GNU gettext still attempts to use SETLOCALE_LOCK.
    
    Currently the Portage tree already contains a patch for musl. The
    simplest fix is just applying the same patch to Darwin as well.
    
    [1] https://savannah.gnu.org/bugs/?62659
    
    Closes: https://github.com/gentoo/gentoo/pull/29655
    Closes: https://bugs.gentoo.org/895330
    Signed-off-by: Yifeng Li <tomli@tomli.me>
    Signed-off-by: David Seifert <soap@gentoo.org>

 sys-devel/gettext/gettext-0.21.1.ebuild | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)