e7bb5090cb094ab9d9d13c1852a7cd7e65128b66 = 2023-09-19 $ cat /etc/alpine-release 3.17.5 $ ./configure;make ... make[2]: Entering directory '/home/azul/azul/gdb-clean/gdbserver' CXXLD libinproctrace.so /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: ax-ipa.o: in function `ax_printf(unsigned long, unsigned long, char const*, int, unsigned long*)': ax.cc:(.text+0x291): undefined reference to `libintl_gettext' /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: ax.cc:(.text+0x5a6): undefined reference to `libintl_gettext' /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: ax-ipa.o: in function `gdb_eval_agent_expr(eval_agent_expr_context*, agent_expr*, unsigned long*)': ax.cc:(.text+0x1a8b): undefined reference to `libintl_gettext' /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: gdbsupport/common-utils-ipa.o: in function `xstrvprintf(char const*, __va_list_tag*)': common-utils.cc:(.text+0x157): undefined reference to `libintl_gettext' /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: gdbsupport/common-utils-ipa.o: in function `xsnprintf(char*, unsigned long, char const*, ...)': common-utils.cc:(.text+0x282): undefined reference to `libintl_gettext' /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: gdbsupport/common-utils-ipa.o:common-utils.cc:(.text+0xe81): more undefined references to `libintl_gettext' follow collect2: error: ld returned 1 exit status --disable-inprocess-agent will workaround it
(In reply to Jan Kratochvil from comment #0) > e7bb5090cb094ab9d9d13c1852a7cd7e65128b66 = 2023-09-19 > > $ cat /etc/alpine-release > 3.17.5 > $ ./configure;make > ... > make[2]: Entering directory '/home/azul/azul/gdb-clean/gdbserver' > CXXLD libinproctrace.so > /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux- > musl/bin/ld: ax-ipa.o: in function `ax_printf(unsigned long, unsigned long, > char const*, int, unsigned long*)': > ax.cc:(.text+0x291): undefined reference to `libintl_gettext' > /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux- > musl/bin/ld: ax.cc:(.text+0x5a6): undefined reference to `libintl_gettext' > /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux- > musl/bin/ld: ax-ipa.o: in function > `gdb_eval_agent_expr(eval_agent_expr_context*, agent_expr*, unsigned long*)': > ax.cc:(.text+0x1a8b): undefined reference to `libintl_gettext' > /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux- > musl/bin/ld: gdbsupport/common-utils-ipa.o: in function `xstrvprintf(char > const*, __va_list_tag*)': > common-utils.cc:(.text+0x157): undefined reference to `libintl_gettext' > /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux- > musl/bin/ld: gdbsupport/common-utils-ipa.o: in function `xsnprintf(char*, > unsigned long, char const*, ...)': > common-utils.cc:(.text+0x282): undefined reference to `libintl_gettext' > /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux- > musl/bin/ld: gdbsupport/common-utils-ipa.o:common-utils.cc:(.text+0xe81): > more undefined references to `libintl_gettext' follow > collect2: error: ld returned 1 exit status > > --disable-inprocess-agent will workaround it It seems to me that the Native Language Support is not present by default on Alpine Linux. Without NLS support, you may get error messages like that when building. BTW, I use --disable-nls to workaround it.
If there is anything missing in the OS and there is an option to disable it the configure script should detect such missing OS feature and disable it on its own. I did not enforce --enable-nls, in such case it should correctly fail. I see now binutils/README does describe it: Native Language Support ======================= By default Native Language Support will be enabled for binutils. On some systems however this support is not present and can lead to error messages such as "undefined reference to `libintl_gettext'" when building there tools. If that happens the NLS support can be disabled by adding the --disable-nls switch to the configure line like this: ../binutils-XXX/configure --disable-nls
I also had this problem and tried to add intl lib LDFLAGS LDFLAGS="-lintl" ./configure But that did not work because in gdbserver/Makefile.in target $(IPA_LIB) the $(INTERNAL_LDFLAGS) is before the "-o" g++ docs tells that libraries "must be listed after the object or source files that contain calls to their functions" https://www.cs.bu.edu/fac/gkollios/cs113/Usingg++.html INTERNAL_LDFLAGS is defined as $(LDFLAGS) IPA_LIB is set to libinproctrace.so Suggested solution: Move $(INTERNAL_LDFLAGS) so it comes after "-o $(IPA_LIB)" in gdbserver/Makefile.in in target $(IPA_LIB) Source https://sourceware.org/git/?p=binutils-gdb.git;a=blob_plain;f=gdbserver/Makefile.in;hb=HEAD IPA_LIB = libinproctrace.so $(IPA_LIB): $(sort $(IPA_OBJS)) ${CDEPS} $(SILENCE) rm -f $(IPA_LIB) $(ECHO_CXXLD) $(CC_LD) -shared -fPIC -Wl,--soname=$(IPA_LIB) \ -Wl,--no-undefined $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \ $(CXXFLAGS) \ -o $(IPA_LIB) ${IPA_OBJS} $(LIBIBERTY_FOR_SHLIB) -ldl -pthread