Building a testdir of
  getlogin
  gettext
on Alpine Linux, with GNU gettext installed, I get this error:

gcc  -Wno-error -g -O2  -L/home/bruno/inst-x86_64-64/lib -o test-getlogin 
test-getlogin.o libtests.a ../gllib/libgnu.a libtests.a ../gllib/libgnu.a 
libtests.a   
/usr/lib/gcc/x86_64-alpine-linux-musl/13.2.1/../../../../x86_64-alpine-linux-musl/bin/ld:
 ../gllib/libgnu.a(xalloc-die.o): in function `xalloc_die':
/home/bruno/testdir1/build-64/gllib/../../gllib/xalloc-die.c:34:(.text.unlikely+0x16):
 undefined reference to `libintl_dgettext'
/usr/lib/gcc/x86_64-alpine-linux-musl/13.2.1/../../../../x86_64-alpine-linux-musl/bin/ld:
 ../gllib/libgnu.a(error.o): in function `print_errno_message':
/home/bruno/testdir1/build-64/gllib/../../gllib/error.c:208:(.text.unlikely+0x74):
 undefined reference to `libintl_dgettext'
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:3804: test-getlogin] Error 1

This patch should fix it.


2025-09-02  Bruno Haible  <[email protected]>

        getlogin tests: Fix link error on musl libc.
        * modules/getlogin-tests (Makefile.am): Link test-getlogin with
        $(LIBINTL).

diff --git a/modules/getlogin-tests b/modules/getlogin-tests
index 8637b2ea7e..dd214a9e54 100644
--- a/modules/getlogin-tests
+++ b/modules/getlogin-tests
@@ -12,4 +12,4 @@ configure.ac:
 Makefile.am:
 TESTS += test-getlogin
 check_PROGRAMS += test-getlogin
-test_getlogin_LDADD = $(LDADD) $(GETLOGIN_LIB)
+test_getlogin_LDADD = $(LDADD) $(GETLOGIN_LIB) $(LIBINTL)




Reply via email to