Skip to contentSkip to conversation

build failure against libintl on alpine

Buildroot Christian Stewart 3 participants 5 messages Dec 27, 2017

lore
Share & tools
lore
#0 lore raw

Hi all,

Here with another build error today, this time against Alpine linux.

Building under an Alpine container with the following world set:

alpine-baselayout
alpine-keys
alpine-sdk
apk-tools
bash
bc
busybox
curl
file
gettext
libc-utils
libintl
libtool
make
musl-dev
ncurses
patch
perl
python
rsync
wget

I get the following error attempting to build:

libtool: link: /usr/bin/gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=26214 4 -I./../zlib -O2 -I/home/buildroot/output/host/include -static-libstdc++ -static-libgcc - Wl,-rpath -Wl,/home/buildroot/output/host/lib -o bfdtest2 bfdtest2.o /home/buildroot/skiff /buildroot/output/host/lib/libintl.so -Wl,-rpath -Wl,/home/buildroot/output/host/lib -L/h ome/buildroot/skiff/buildroot/output/host/lib ../bfd/.libs/libbfd.a -L/home/buildroot/outp ut/build/host-binutils-2.27/zlib -lz ../libiberty/libiberty.a ../bfd/.libs/libbfd.a(elflink.o): In function `undefined_reference':
elflink.c:(.text+0x450): undefined reference to libintl_dgettext' ../bfd/.libs/libbfd.a(elflink.o): In function init_reloc_cookie':
elflink.c:(.text+0x580): undefined reference to libintl_dgettext' ../bfd/.libs/libbfd.a(elflink.o): In function elf_link_read_relocs_from_section.part.17':
elflink.c:(.text+0x18ca): undefined reference to libintl_dgettext' elflink.c:(.text+0x197e): undefined reference to libintl_dgettext' ../bfd/.libs/libbfd.a(elflink.o): In function `check_dynsym.isra.18.part.19':
elflink.c:(.text+0x19d4): undefined reference to libintl_dgettext' ../bfd/.libs/libbfd.a(elflink.o):elflink.c:(.text+0x1ca5): more undefined references to libintl_dgettext' follow

A reproduction in Docker is possible with the following Dockerfile:

FROM alpine:edge
RUN apk --update upgrade
RUN apk add make git bash ncurses gcc wget curl \
musl-dev file g++ perl python rsync bc patch \
libintl libtool alpine-sdk gettext

RUN adduser -D -u 1000 -g 1001 buildroot && \
    mkdir -p /home/buildroot && chown buildroot:buildroot /home/buildroot

USER buildroot
WORKDIR /home/buildroot

Then:

cd buildroot/
docker build -t "buildroot:latest" .
docker run -v $(pwd):/home/buildroot/ --rm -it buildroot:latest sh

$ make clean
$ make defconfig BR2_DEFCONFIG=configs/raspberrypi3_defconfig
$ make

I would assume this is some incompatibility when trying to link against the latest versions of libintl or gettext or so.

In addition to my own config, I attempted the uclibc-based pi 3 defconfig:

$ make clean
$ make defconfig BR2_DEFCONFIG=configs/raspberrypi3_defconfig
$ make

Result:

make[1]: Entering directory '/home/buildroot/output/build/uclibc-1.0.26/utils'
HOSTCC utils/getconf.host
HOSTCC utils/ldconfig.host
HOSTCC utils/ldd.host
../utils/getconf.c:439:29: error: '_SC_CHARCLASS_NAME_MAX' undeclared here (not in a function)
{ "CHARCLASS_NAME_MAX", _SC_CHARCLASS_NAME_MAX, SYSCONF },
^~~~~~~~~~~~~~~~~~~~~~
../utils/getconf.c: In function 'print_all':
../utils/getconf.c:1092:24: error: '_SC_UINT_MAX' undeclared (first use in this function)

    if (c->call_name == _SC_UINT_MAX
                        ^~~~~~~~~~~~
../utils/getconf.c:1092:24: note: each undeclared identifier is reported only once for each function it appears in
../utils/getconf.c:1092:21: warning: comparison between pointer and integer
    if (c->call_name == _SC_UINT_MAX
                     ^~
../utils/getconf.c:1093:25: error: '_SC_ULONG_MAX' undeclared (first use in this function)
      || c->call_name == _SC_ULONG_MAX)
                         ^~~~~~~~~~~~~
../utils/getconf.c:1093:22: warning: comparison between pointer and integer
      || c->call_name == _SC_ULONG_MAX)
                      ^~
../utils/getconf.c: In function 'main':
../utils/getconf.c:1306:23: error: '_SC_UINT_MAX' undeclared (first use in this function)
   if (c->call_name == _SC_UINT_MAX
                       ^~~~~~~~~~~~
../utils/getconf.c:1306:20: warning: comparison between pointer and integer
   if (c->call_name == _SC_UINT_MAX
                    ^~
../utils/getconf.c:1307:26: error: '_SC_ULONG_MAX' undeclared (first use in this function)
       || c->call_name == _SC_ULONG_MAX)
                          ^~~~~~~~~~~~~
../utils/getconf.c:1307:23: warning: comparison between pointer and integer
       || c->call_name == _SC_ULONG_MAX)
                       ^~
../utils/ldd.c: In function 'elf_find_dynamic':
../utils/ldd.c:233:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     return (void *)byteswap_to_host(dynp->d_un.d_val);
            ^

make[1]: *** [Makefile.in:114: ../utils/getconf.host] Error 1 make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/buildroot/output/build/uclibc-1.0.26/utils'

Best,
Christian

#1 lore raw

Hi,
Christian Stewart wrote,

Quoted 4 lines

Hi all,

Here with another build error today, this time against Alpine linux.

Alpine uses musl C library, I think your errors are all related to that. Does anyone used musl based system for buildroot development before Christian?

Quoted 7 lines

make[1]: Entering directory '/home/buildroot/output/build/uclibc-1.0.26/utils'
HOSTCC utils/getconf.host
HOSTCC utils/ldconfig.host
HOSTCC utils/ldd.host
../utils/getconf.c:439:29: error: '_SC_CHARCLASS_NAME_MAX' undeclared here (not in a function)
{ "CHARCLASS_NAME_MAX", _SC_CHARCLASS_NAME_MAX, SYSCONF },
^~~~~~~~~~~~~~~~~~~~~~

I can take a look for this error.

best regards
Waldemar

#2 lore raw
In reply to Christian Stewart

Hi

Try adding the "--disable-nls" to HOST_BINUTILS_CONF_OPTS in the package/binutils/binutils.mk file
Might be also needed for ??? HOST_GCC_COMMON_CONF_OPTS in package/gcc/gcc.mk as also for
all other buildroot host packages because NLS support is really useless there ...

musl has it's own dgettext stuff in libc.so* (or libc.a) so it should not need the libintl version of gettext.

-S-

Christian Stewart kirjoitti 27.12.2017 klo 06:46:

Quoted 129 lines

Hi all,

Here with another build error today, this time against Alpine linux.

Building under an Alpine container with the following world set:

alpine-baselayout
alpine-keys
alpine-sdk
apk-tools
bash
bc
busybox
curl
file
gettext
libc-utils
libintl
libtool
make
musl-dev
ncurses
patch
perl
python
rsync
wget

I get the following error attempting to build:

libtool: link: /usr/bin/gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=26214 4 -I./../zlib -O2 -I/home/buildroot/output/host/include -static-libstdc++ -static-libgcc - Wl,-rpath -Wl,/home/buildroot/output/host/lib -o bfdtest2 bfdtest2.o /home/buildroot/skiff /buildroot/output/host/lib/libintl.so -Wl,-rpath -Wl,/home/buildroot/output/host/lib -L/h ome/buildroot/skiff/buildroot/output/host/lib ../bfd/.libs/libbfd.a -L/home/buildroot/outp ut/build/host-binutils-2.27/zlib -lz ../libiberty/libiberty.a ../bfd/.libs/libbfd.a(elflink.o): In function `undefined_reference':
elflink.c:(.text+0x450): undefined reference to libintl_dgettext' ../bfd/.libs/libbfd.a(elflink.o): In function init_reloc_cookie':
elflink.c:(.text+0x580): undefined reference to libintl_dgettext' ../bfd/.libs/libbfd.a(elflink.o): In function elf_link_read_relocs_from_section.part.17':
elflink.c:(.text+0x18ca): undefined reference to libintl_dgettext' elflink.c:(.text+0x197e): undefined reference to libintl_dgettext' ../bfd/.libs/libbfd.a(elflink.o): In function `check_dynsym.isra.18.part.19':
elflink.c:(.text+0x19d4): undefined reference to libintl_dgettext' ../bfd/.libs/libbfd.a(elflink.o):elflink.c:(.text+0x1ca5): more undefined references to libintl_dgettext' follow

A reproduction in Docker is possible with the following Dockerfile:

FROM alpine:edge
RUN apk --update upgrade
RUN apk add make git bash ncurses gcc wget curl \
musl-dev file g++ perl python rsync bc patch \
libintl libtool alpine-sdk gettext

RUN adduser -D -u 1000 -g 1001 buildroot && \
    mkdir -p /home/buildroot && chown buildroot:buildroot /home/buildroot

USER buildroot
WORKDIR /home/buildroot

Then:

cd buildroot/
docker build -t "buildroot:latest" .
docker run -v $(pwd):/home/buildroot/ --rm -it buildroot:latest sh

$ make clean
$ make defconfig BR2_DEFCONFIG=configs/raspberrypi3_defconfig
$ make

I would assume this is some incompatibility when trying to link against the latest versions of libintl or gettext or so.

In addition to my own config, I attempted the uclibc-based pi 3 defconfig:

$ make clean
$ make defconfig BR2_DEFCONFIG=configs/raspberrypi3_defconfig
$ make

Result:

make[1]: Entering directory '/home/buildroot/output/build/uclibc-1.0.26/utils'
HOSTCC utils/getconf.host
HOSTCC utils/ldconfig.host
HOSTCC utils/ldd.host
../utils/getconf.c:439:29: error: '_SC_CHARCLASS_NAME_MAX' undeclared here (not in a function)
{ "CHARCLASS_NAME_MAX", _SC_CHARCLASS_NAME_MAX, SYSCONF },
^~~~~~~~~~~~~~~~~~~~~~
../utils/getconf.c: In function 'print_all':
../utils/getconf.c:1092:24: error: '_SC_UINT_MAX' undeclared (first use in this function)

    if (c->call_name == _SC_UINT_MAX
                        ^~~~~~~~~~~~
../utils/getconf.c:1092:24: note: each undeclared identifier is reported only once for each function it appears in
../utils/getconf.c:1092:21: warning: comparison between pointer and integer
    if (c->call_name == _SC_UINT_MAX
                     ^~
../utils/getconf.c:1093:25: error: '_SC_ULONG_MAX' undeclared (first use in this function)
      || c->call_name == _SC_ULONG_MAX)
                         ^~~~~~~~~~~~~
../utils/getconf.c:1093:22: warning: comparison between pointer and integer
      || c->call_name == _SC_ULONG_MAX)
                      ^~
../utils/getconf.c: In function 'main':
../utils/getconf.c:1306:23: error: '_SC_UINT_MAX' undeclared (first use in this function)
   if (c->call_name == _SC_UINT_MAX
                       ^~~~~~~~~~~~
../utils/getconf.c:1306:20: warning: comparison between pointer and integer
   if (c->call_name == _SC_UINT_MAX
                    ^~
../utils/getconf.c:1307:26: error: '_SC_ULONG_MAX' undeclared (first use in this function)
       || c->call_name == _SC_ULONG_MAX)
                          ^~~~~~~~~~~~~
../utils/getconf.c:1307:23: warning: comparison between pointer and integer
       || c->call_name == _SC_ULONG_MAX)
                       ^~
../utils/ldd.c: In function 'elf_find_dynamic':
../utils/ldd.c:233:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     return (void *)byteswap_to_host(dynp->d_un.d_val);
            ^

make[1]: *** [Makefile.in:114: ../utils/getconf.host] Error 1 make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/buildroot/output/build/uclibc-1.0.26/utils'

Best,
Christian
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#3 lore raw

Oh, and forgot to add: My musl? version is 1.1.18

-S-

Stefan Fr?berg kirjoitti 27.12.2017 klo 15:55:

Quoted 149 lines

Hi

Try adding the "--disable-nls" to HOST_BINUTILS_CONF_OPTS in the package/binutils/binutils.mk file
Might be also needed for ??? HOST_GCC_COMMON_CONF_OPTS in package/gcc/gcc.mk as also for
all other buildroot host packages because NLS support is really useless there ...

musl has it's own dgettext stuff in libc.so* (or libc.a) so it should not need the libintl version of gettext.

-S-

Christian Stewart kirjoitti 27.12.2017 klo 06:46:

Quoted 123 lines

Hi all,

Here with another build error today, this time against Alpine linux.

Building under an Alpine container with the following world set:

alpine-baselayout
alpine-keys
alpine-sdk
apk-tools
bash
bc
busybox
curl
file
gettext
libc-utils
libintl
libtool
make
musl-dev
ncurses
patch
perl
python
rsync
wget

I get the following error attempting to build:

libtool: link: /usr/bin/gcc -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=26214 4 -I./../zlib -O2 -I/home/buildroot/output/host/include -static-libstdc++ -static-libgcc - Wl,-rpath -Wl,/home/buildroot/output/host/lib -o bfdtest2 bfdtest2.o /home/buildroot/skiff /buildroot/output/host/lib/libintl.so -Wl,-rpath -Wl,/home/buildroot/output/host/lib -L/h ome/buildroot/skiff/buildroot/output/host/lib ../bfd/.libs/libbfd.a -L/home/buildroot/outp ut/build/host-binutils-2.27/zlib -lz ../libiberty/libiberty.a ../bfd/.libs/libbfd.a(elflink.o): In function `undefined_reference':
elflink.c:(.text+0x450): undefined reference to libintl_dgettext' ../bfd/.libs/libbfd.a(elflink.o): In function init_reloc_cookie':
elflink.c:(.text+0x580): undefined reference to libintl_dgettext' ../bfd/.libs/libbfd.a(elflink.o): In function elf_link_read_relocs_from_section.part.17':
elflink.c:(.text+0x18ca): undefined reference to libintl_dgettext' elflink.c:(.text+0x197e): undefined reference to libintl_dgettext' ../bfd/.libs/libbfd.a(elflink.o): In function `check_dynsym.isra.18.part.19':
elflink.c:(.text+0x19d4): undefined reference to libintl_dgettext' ../bfd/.libs/libbfd.a(elflink.o):elflink.c:(.text+0x1ca5): more undefined references to libintl_dgettext' follow

A reproduction in Docker is possible with the following Dockerfile:

FROM alpine:edge
RUN apk --update upgrade
RUN apk add make git bash ncurses gcc wget curl \
musl-dev file g++ perl python rsync bc patch \
libintl libtool alpine-sdk gettext

RUN adduser -D -u 1000 -g 1001 buildroot && \
    mkdir -p /home/buildroot && chown buildroot:buildroot /home/buildroot

USER buildroot
WORKDIR /home/buildroot

Then:

cd buildroot/
docker build -t "buildroot:latest" .
docker run -v $(pwd):/home/buildroot/ --rm -it buildroot:latest sh

$ make clean
$ make defconfig BR2_DEFCONFIG=configs/raspberrypi3_defconfig
$ make

I would assume this is some incompatibility when trying to link against the latest versions of libintl or gettext or so.

In addition to my own config, I attempted the uclibc-based pi 3 defconfig:

$ make clean
$ make defconfig BR2_DEFCONFIG=configs/raspberrypi3_defconfig
$ make

Result:

make[1]: Entering directory '/home/buildroot/output/build/uclibc-1.0.26/utils'
HOSTCC utils/getconf.host
HOSTCC utils/ldconfig.host
HOSTCC utils/ldd.host
../utils/getconf.c:439:29: error: '_SC_CHARCLASS_NAME_MAX' undeclared here (not in a function)
{ "CHARCLASS_NAME_MAX", _SC_CHARCLASS_NAME_MAX, SYSCONF },
^~~~~~~~~~~~~~~~~~~~~~
../utils/getconf.c: In function 'print_all':
../utils/getconf.c:1092:24: error: '_SC_UINT_MAX' undeclared (first use in this function)

    if (c->call_name == _SC_UINT_MAX
                        ^~~~~~~~~~~~
../utils/getconf.c:1092:24: note: each undeclared identifier is reported only once for each function it appears in
../utils/getconf.c:1092:21: warning: comparison between pointer and integer
    if (c->call_name == _SC_UINT_MAX
                     ^~
../utils/getconf.c:1093:25: error: '_SC_ULONG_MAX' undeclared (first use in this function)
      || c->call_name == _SC_ULONG_MAX)
                         ^~~~~~~~~~~~~
../utils/getconf.c:1093:22: warning: comparison between pointer and integer
      || c->call_name == _SC_ULONG_MAX)
                      ^~
../utils/getconf.c: In function 'main':
../utils/getconf.c:1306:23: error: '_SC_UINT_MAX' undeclared (first use in this function)
   if (c->call_name == _SC_UINT_MAX
                       ^~~~~~~~~~~~
../utils/getconf.c:1306:20: warning: comparison between pointer and integer
   if (c->call_name == _SC_UINT_MAX
                    ^~
../utils/getconf.c:1307:26: error: '_SC_ULONG_MAX' undeclared (first use in this function)
       || c->call_name == _SC_ULONG_MAX)
                          ^~~~~~~~~~~~~
../utils/getconf.c:1307:23: warning: comparison between pointer and integer
       || c->call_name == _SC_ULONG_MAX)
                       ^~
../utils/ldd.c: In function 'elf_find_dynamic':
../utils/ldd.c:233:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     return (void *)byteswap_to_host(dynp->d_un.d_val);
            ^

make[1]: *** [Makefile.in:114: ../utils/getconf.host] Error 1 make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/buildroot/output/build/uclibc-1.0.26/utils'

Quoted 6 lines

Best,
Christian
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#4 lore raw
In reply to Stefan Fröberg

Hi Waldemar, Stefan,

Thanks for the help on this.

Quoted 6 lines · Stefan Fr?berg

Try adding the "--disable-nls" to HOST_BINUTILS_CONF_OPTS in the package/binutils/binutils.mk file
Might be also needed for ??? HOST_GCC_COMMON_CONF_OPTS in package/gcc/gcc.mk as also for
all other buildroot host packages because NLS support is really useless there ...

OK. Initially adding to HOST_BINUTILS_CONF_OPTS makes the build go farther, but it still breaks on glibc:

rpc_main.c:41:21: fatal error: libintl.h: No such file or directory
#include <libintl.h>

Adding to HOST_GCC_COMMON_CONF_OPTS, and forcing a rebuild of glibc I get the same error and these too:

In file included from rpc/types.h:69:0,

                 from rpc_parse.c:39:
/usr/include/sys/types.h:69:28: note: previous declaration of 'u_quad_t' was here
 typedef unsigned long long u_quad_t;
                            ^~~~~~~~
In file included from rpc_parse.c:39:0:
rpc/types.h:84:9: error: unknown type name '__fsid_t'
 typedef __fsid_t fsid_t;
         ^~~~~~~~
rpc/types.h:88:9: error: unknown type name '__daddr_t'
 typedef __daddr_t daddr_t;
         ^~~~~~~~~
rpc/types.h:89:9: error: unknown type name '__caddr_t'
 typedef __caddr_t caddr_t;
         ^~~~~~~~~
rpc/types.h:89:19: error: conflicting types for 'caddr_t'
 typedef __caddr_t caddr_t;
                   ^~~~~~~
In file included from rpc/types.h:69:0,
                 from rpc_parse.c:39:
/usr/include/sys/types.h:63:15: note: previous declaration of 'caddr_t' was here
 typedef char *caddr_t;
               ^~~~~~~

make[6]: *** [Makefile:178: /home/buildroot/skiff/workspaces/docker/build/glibc-glibc-2.26-73-g4b692dffb95ac4812b161eb6a16113d7e824982e/build/sunrpc/cross-rpc_parse.o] Error 1

Quoted 2 lines

musl has it's own dgettext stuff in libc.so* (or libc.a) so it should not need the libintl version of gettext.

To anyone interested: I can confirm that compilation in a Ubuntu container works fine with this Dockerfile:

FROM ubuntu:latest

RUN apt update && \
    apt install -y build-essential \
    git gcc wget curl musl-dev file \
    perl python rsync bc patch unzip cpio
RUN adduser --gecos "Buildroot" --disabled-login --uid 1000 buildroot && \
    mkdir -p /home/buildroot && chown buildroot:buildroot /home/buildroot

USER buildroot
WORKDIR /home/buildroot

Alpine is better because it's light weight. Building in this env would be very nice. The full Ubuntu container is highly unnecessary.

Best,
Christian