1

I am trying to upgrade our build server from opensuse 9 to ubuntu 14.04. Our target operative system is uClinux with kernel 2.6.24 and glibc 2.5 and gcc 4.2.1. We are using crosstool-ng for building our cross toolchain. Building toolchain is working fine and it is possible to build the kernel as well. But when building the glibc in nptl, the build is exiting with make Error 1.

I am seeing just one error which repeats:

make[4]: execvp: /bin/sh: Argument list too long

In some posts like this one or this one it seems that the problem is the maximum size of strings passed to execve system call. However what is starnage is that when on our old opensuse I am running: getconf ARG_MAX then the answer is 131072, while on the ubuntu 14 the answer is getconf ARG_MAX which is much bigger. and in the same way running cat /proc/$$/environ | wc -c on opensuse whill give 482 as answer while the answer on ubuntu is 1257. When I am moving the glibc folder to a folder with shorter path, then build works without problem. I wonder if this is the real problem and if there is a solution for this. The make file I am using for building glibc is:


glibc-2.3.6-url := \
    http://ftp.gnu.org/gnu/glibc/glibc-2.3.6.tar.bz2
glibc-linuxthreads-2.3.6-url := \
    http://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-2.3.6.tar.bz2
glibc-libidn-2.3.6-url := \
    http://ftp.gnu.org/gnu/glibc/glibc-libidn-2.3.6.tar.bz2

glibc-2.5-url := \
    http://ftp.gnu.org/gnu/glibc/glibc-2.5.tar.bz2
glibc-linuxthreads-2.5-url := \
    http://ftp.gnu.org/gnu/glibc/glibc-linuxthreads-2.5.tar.bz2
glibc-libidn-2.5-url := \
    http://ftp.gnu.org/gnu/glibc/glibc-libidn-2.5.tar.bz2


CONFOPTS = --prefix= \
    $(GLIBC_TARGET_OPTS) --host=$(CROSS_COMPILE:-=) \
    --with-tls --enable-max-arg-list-hack --without-cvs --without-gd \
    --with-headers=$(ROOTDIR)/$(LINUXDIR)/include \
    --disable-profile --disable-force-install \

CONFOPTS += --enable-kernel=2.6.24

# do we want a non-debuggable lib or not,  if so remove the C flag and
# enable it in glibc,  it knows best where to add it.
ifneq ($(findstring -fomit-frame-pointer,$(CFLAGS)),)
    CONFOPTS += --enable-omitfp
    CFLAGS := $(subst -fomit-frame-pointer,,$(CFLAGS))
endif

CFLAGS := $(subst -fno-common,,$(CFLAGS))
CFLAGS := $(subst -fno-builtin,,$(CFLAGS)) -fgnu89-inline
repl = -Wl,--fatal-warnings
LDFLAGS := $(subst $(repl),,$(LDFLAGS))
LDFLAGS := $(subst -nostdlib,,$(LDFLAGS))
LDFLAGS := $(subst -nostartfiles,,$(LDFLAGS))
export CFLAGS LDFLAGS

BUILD_CC = $(HOSTCC)
export BUILD_CC

GLIBC_ALL = glibc-2.5-all

WGET ?= wget

all: $(GLIBC_ALL)

%.tar.bz2 %.tar.gz:
    @echo "Downloading $* ..."
    @[ -d "$$HOME/.downloads" ] || mkdir ~/.downloads
    @if [ ! -f "$$HOME/.downloads/$@" ]; then \
        (cd ~/.downloads; $(WGET) "$($*-url)"); \
    fi
    @if [ -f "$$HOME/.downloads/$@" ]; then \
            ln -fs "$$HOME/.downloads/$@" $@; \
    fi
    if [ ! -f "$@" ]; then \
        echo "Cannot find download for $@" >&2 ; \
        exit 1; \
    fi

glibc-2.5-all: glibc-2.5-configured
    rm -rf install
    mkdir install
    env LANGUAGE=C LC_ALL=C $(MAKE) -C glibc-2.5 -f Makefile -r srcdir=`pwd` objdir=`pwd`/build install_root=`pwd`/install install
    : fix groups in linker scripts
    @find install/. -type f -name *.so* | while read t; do \
        if file "$$t" | grep -i ascii > /dev/null; then \
            echo "Fixing $$t ..."; \
            sed 's?\([  (]\)\(/lib/[^   )]*\)?\1'"`pwd`/install"'\2?g' < "$$t" > "$$t.fixup"; \
            cp "$$t.fixup" "$$t"; \
            rm -f "$$t.fixup"; \
        fi \
    done

glibc-2.5-extracted: Makefile glibc-2.5.tar.bz2 glibc-linuxthreads-2.5.tar.bz2 glibc-libidn-2.5.tar.bz2
    rm -rf glibc-2.5 glibc-libidn-2.5 install build
    bunzip2 < glibc-2.5.tar.bz2 | tar xf -
#   bunzip2 < glibc-linuxthreads-2.5.tar.bz2 | (cd glibc-2.5; tar xf -)
#   bunzip2 < glibc-libidn-2.5.tar.bz2 | tar xf -
#   mv glibc-libidn-2.5 glibc-2.5/libidn
#   rm -rf glibc-2.5/nptl glibc-2.5/nptl_db
#   @for i in glibc-2.5*.patch; do \
#       [ -f $$i ] || continue; \
#       echo "Applying $$i ..."; \
#       (cd glibc-2.5; patch -p1) < $$i; \
#   done
    touch $@

glibc-2.5-configured: Makefile glibc-2.5-extracted
    rm -rf build
    mkdir build
    (cd build; \
        CC="$(subst ucfront-gcc,,$(CC))" \
        CXX="$(subst ucfront-g++,,$(CXX))" \
        libc_cv_ssp=no \
        /bin/bash ../glibc-2.5/configure $(CONFIGURE_OPTS) $(CONFOPTS) \
            --datadir=/usr/share --enable-add-ons; \
    )
    mkdir build/dlfcn
    ln -s libdl.so build/dlfcn/libdl.so.2
    touch $@

glibc-2.3.6-all: glibc-2.3.6-configured
    rm -rf install
    mkdir install
    env no_deps=t LANGUAGE=C LC_ALL=C make -C build -f Makefile install_root=`pwd`/install
    env no_deps=t LANGUAGE=C LC_ALL=C make -C build -f Makefile install_root=`pwd`/install install
    : fix groups in linker scripts
    @find install/. -type f -name *.so* | while read t; do \
        if file "$$t" | grep -i ascii > /dev/null; then \
            echo "Fixing $$t ..."; \
            sed 's?\([  (]\)\(/lib/[^   )]*\)?\1'"`pwd`/install"'\2?g' < "$$t" > "$$t.fixup"; \
            cp "$$t.fixup" "$$t"; \
            rm -f "$$t.fixup"; \
        fi \
    done

glibc-2.3.6-extracted: Makefile glibc-2.3.6.tar.bz2 glibc-linuxthreads-2.3.6.tar.bz2 glibc-libidn-2.3.6.tar.bz2
    rm -rf glibc-2.3.6 install build
    bunzip2 < glibc-2.3.6.tar.bz2 | tar xf -
    bunzip2 < glibc-linuxthreads-2.3.6.tar.bz2 | (cd glibc-2.3.6; tar xf -)
    bunzip2 < glibc-libidn-2.3.6.tar.bz2 | (cd glibc-2.3.6; tar xf -)
    rm -rf glibc-2.3.6/nptl
    rm -rf glibc-2.3.6/nptl_db
    @for i in glibc-2.3.6*.patch; do \
        [ -f $$i ] || continue; \
        echo "Applying $$i ..."; \
        (cd glibc-2.3.6; patch -p1) < $$i; \
    done
    touch $@

glibc-2.3.6-configured: Makefile glibc-2.3.6-extracted
    rm -rf build
    mkdir build
    (cd build; \
        CC="$(subst ucfront-gcc,,$(CC))" \
        CXX="$(subst ucfront-g++,,$(CXX))" \
        /bin/bash ../glibc-2.3.6/configure $(CONFIGURE_OPTS) $(CONFOPTS) \
            --with-tls --without-__thread --datadir=/usr/share --enable-add-ons; \
    )
    #mkdir build/dlfcn
    #ln -s libdl.so build/dlfcn/libdl.so.2
    touch $@

clean:
    rm -rf build install
    rm -rf glibc-2.5 glibc-2.5-extracted
    rm -rf glibc-2.3.6 glibc-2.3.6-extracted
    rm -f glibc-*.tar.bz2 glibc-*.tar.gz

romfs:
    cp -r $(ROOTDIR)/$(LIBCDIR)/install/include $(ROMFSDIR)/usr/
    cp -r $(ROOTDIR)/$(LIBCDIR)/install/lib $(ROMFSDIR)/
#   @for i in install; do \
#       echo "Installing `basename $$i -install` ..."; \
#       $(ROMFSINST) -f $$i/bin /bin; \
#       $(ROMFSINST) -f $$i/lib /lib; \
#       $(ROMFSINST) -f $$i/etc /etc; \
#       $(ROMFSINST) -f $$i/include $(ROMFSDIR)/usr; \
#       mv $(ROMFSDIR)/etc/config/* $(ROMFSDIR)/etc/default > /dev/null 2>&1; \
#       $(ROMFSINST) -f $$i/usr/share /share; \
#   done
#   rm -f $(ROMFSDIR)/lib/*.a
#   rm -f $(ROMFSDIR)/lib/*.la

This is th last part of make log :

make[4]: Entering directory `/.../uClinux/glibc/glibc-2.5/nptl'
gawk -f ../scripts/gen-as-const.awk ../nptl/sysdeps/unix/sysv/linux/pthread-pi-defines.sym \
    | i586-unknown-linux-gnu-gcc  -S -o /.../uClinux/glibc/build/pthread-pi-defines.hT3 -std=gnu99 -DCONFIG_GEODE -DCONFIG_NETtel -DCONFIG_SECUREEDGE -DCONFIG_X86 -DEMBED -O1 -Wall -Winline -Wwrite-strings -fgnu89-inline -fmerge-all-constants -g -Wstrict-prototypes -mpreferred-stack-boundary=2     -I../include -I/.../uClinux/glibc/build/nptl -I/.../uClinux/glibc/build -I../sysdeps/i386/elf -I../nptl/sysdeps/unix/sysv/linux/i386/i586 -I../nptl/sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux/i386 -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv/i386 -I../nptl/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -I../nptl/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../nptl/sysdeps/i386/i586 -I../sysdeps/i386/i586 -I../sysdeps/i386/i486 -I../nptl/sysdeps/i386/i486 -I../sysdeps/i386/fpu -I../nptl/sysdeps/i386 -I../sysdeps/i386 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl  -I.. -I../libio -I. -nostdinc -isystem /.../crosstool-ng/output/gcc-4.2.1-glibc-2.5/i586-unknown-linux-gnu/lib/gcc/i586-unknown-linux-gnu/4.2.1/include -isystem /.../uClinux/linux-2.6.x/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h       -x c - \
        -MD -MP -MF /.../uClinux/glibc/build/pthread-pi-defines.h.dT -MT '/.../uClinux/glibc/build/pthread-pi-defines.h.d /.../uClinux/glibc/build/pthread-pi-defines.h'
make[4]: execvp: /bin/sh: Argument list too long
gawk -f ../scripts/gen-as-const.awk ../nptl/sysdeps/unix/sysv/linux/lowlevelrobustlock.sym \
    | i586-unknown-linux-gnu-gcc  -S -o /.../uClinux/glibc/build/lowlevelrobustlock.hT3 -std=gnu99 -DCONFIG_GEODE -DCONFIG_NETtel -DCONFIG_SECUREEDGE -DCONFIG_X86 -DEMBED -O1 -Wall -Winline -Wwrite-strings -fgnu89-inline -fmerge-all-constants -g -Wstrict-prototypes -mpreferred-stack-boundary=2     -I../include -I/.../uClinux/glibc/build/nptl -I/.../uClinux/glibc/build -I../sysdeps/i386/elf -I../nptl/sysdeps/unix/sysv/linux/i386/i586 -I../nptl/sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux/i386 -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv/i386 -I../nptl/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -I../nptl/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../nptl/sysdeps/i386/i586 -I../sysdeps/i386/i586 -I../sysdeps/i386/i486 -I../nptl/sysdeps/i386/i486 -I../sysdeps/i386/fpu -I../nptl/sysdeps/i386 -I../sysdeps/i386 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl  -I.. -I../libio -I. -nostdinc -isystem /.../crosstool-ng/output/gcc-4.2.1-glibc-2.5/i586-unknown-linux-gnu/lib/gcc/i586-unknown-linux-gnu/4.2.1/include -isystem /.../uClinux/linux-2.6.x/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h       -x c - \
        -MD -MP -MF /.../uClinux/glibc/build/lowlevelrobustlock.h.dT -MT '/.../uClinux/glibc/build/lowlevelrobustlock.h.d /.../uClinux/glibc/build/lowlevelrobustlock.h'
make[4]: execvp: /bin/sh: Argument list too long
gawk -f ../scripts/gen-as-const.awk ../nptl/sysdeps/unix/sysv/linux/unwindbuf.sym \
    | i586-unknown-linux-gnu-gcc  -S -o ...uClinux/glibc/build/unwindbuf.hT3 -std=gnu99 -DCONFIG_GEODE -DCONFIG_NETtel -DCONFIG_SECUREEDGE -DCONFIG_X86 -DEMBED -O1 -Wall -Winline -Wwrite-strings -fgnu89-inline -fmerge-all-constants -g -Wstrict-prototypes -mpreferred-stack-boundary=2     -I../include -I...uClinux/glibc/build/nptl -I...uClinux/glibc/build -I../sysdeps/i386/elf -I../nptl/sysdeps/unix/sysv/linux/i386/i586 -I../nptl/sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux/i386 -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv/i386 -I../nptl/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -I../nptl/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../nptl/sysdeps/i386/i586 -I../sysdeps/i386/i586 -I../sysdeps/i386/i486 -I../nptl/sysdeps/i386/i486 -I../sysdeps/i386/fpu -I../nptl/sysdeps/i386 -I../sysdeps/i386 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl  -I.. -I../libio -I. -nostdinc -isystem ...crosstool-ng/output/gcc-4.2.1-glibc-2.5/i586-unknown-linux-gnu/lib/gcc/i586-unknown-linux-gnu/4.2.1/include -isystem ...uClinux/linux-2.6.x/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h       -x c - \
        -MD -MP -MF ...uClinux/glibc/build/unwindbuf.h.dT -MT '...uClinux/glibc/build/unwindbuf.h.d ...uClinux/glibc/build/unwindbuf.h'
make[4]: execvp: /bin/sh: Argument list too long
gawk -f ../scripts/gen-as-const.awk ../nptl/sysdeps/unix/sysv/linux/lowlevelbarrier.sym \
    | i586-unknown-linux-gnu-gcc  -S -o ...uClinux/glibc/build/lowlevelbarrier.hT3 -std=gnu99 -DCONFIG_GEODE -DCONFIG_NETtel -DCONFIG_SECUREEDGE -DCONFIG_X86 -DEMBED -O1 -Wall -Winline -Wwrite-strings -fgnu89-inline -fmerge-all-constants -g -Wstrict-prototypes -mpreferred-stack-boundary=2     -I../include -I...uClinux/glibc/build/nptl -I...uClinux/glibc/build -I../sysdeps/i386/elf -I../nptl/sysdeps/unix/sysv/linux/i386/i586 -I../nptl/sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux/i386 -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv/i386 -I../nptl/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -I../nptl/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../nptl/sysdeps/i386/i586 -I../sysdeps/i386/i586 -I../sysdeps/i386/i486 -I../nptl/sysdeps/i386/i486 -I../sysdeps/i386/fpu -I../nptl/sysdeps/i386 -I../sysdeps/i386 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl  -I.. -I../libio -I. -nostdinc -isystem ...crosstool-ng/output/gcc-4.2.1-glibc-2.5/i586-unknown-linux-gnu/lib/gcc/i586-unknown-linux-gnu/4.2.1/include -isystem ...uClinux/linux-2.6.x/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h       -x c - \
        -MD -MP -MF ...uClinux/glibc/build/lowlevelbarrier.h.dT -MT '...uClinux/glibc/build/lowlevelbarrier.h.d ...uClinux/glibc/build/lowlevelbarrier.h'
make[4]: execvp: /bin/sh: Argument list too long
gawk -f ../scripts/gen-as-const.awk ../nptl/sysdeps/unix/sysv/linux/lowlevelrwlock.sym \
    | i586-unknown-linux-gnu-gcc  -S -o ...uClinux/glibc/build/lowlevelrwlock.hT3 -std=gnu99 -DCONFIG_GEODE -DCONFIG_NETtel -DCONFIG_SECUREEDGE -DCONFIG_X86 -DEMBED -O1 -Wall -Winline -Wwrite-strings -fgnu89-inline -fmerge-all-constants -g -Wstrict-prototypes -mpreferred-stack-boundary=2     -I../include -I...uClinux/glibc/build/nptl -I...uClinux/glibc/build -I../sysdeps/i386/elf -I../nptl/sysdeps/unix/sysv/linux/i386/i586 -I../nptl/sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux/i386 -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv/i386 -I../nptl/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -I../nptl/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../nptl/sysdeps/i386/i586 -I../sysdeps/i386/i586 -I../sysdeps/i386/i486 -I../nptl/sysdeps/i386/i486 -I../sysdeps/i386/fpu -I../nptl/sysdeps/i386 -I../sysdeps/i386 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl  -I.. -I../libio -I. -nostdinc -isystem ...crosstool-ng/output/gcc-4.2.1-glibc-2.5/i586-unknown-linux-gnu/lib/gcc/i586-unknown-linux-gnu/4.2.1/include -isystem ...uClinux/linux-2.6.x/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h       -x c - \
        -MD -MP -MF ...uClinux/glibc/build/lowlevelrwlock.h.dT -MT '...uClinux/glibc/build/lowlevelrwlock.h.d ...uClinux/glibc/build/lowlevelrwlock.h'
make[4]: execvp: /bin/sh: Argument list too long
gawk -f ../scripts/gen-as-const.awk ../nptl/sysdeps/unix/sysv/linux/lowlevelcond.sym \
    | i586-unknown-linux-gnu-gcc  -S -o ...uClinux/glibc/build/lowlevelcond.hT3 -std=gnu99 -DCONFIG_GEODE -DCONFIG_NETtel -DCONFIG_SECUREEDGE -DCONFIG_X86 -DEMBED -O1 -Wall -Winline -Wwrite-strings -fgnu89-inline -fmerge-all-constants -g -Wstrict-prototypes -mpreferred-stack-boundary=2     -I../include -I...uClinux/glibc/build/nptl -I...uClinux/glibc/build -I../sysdeps/i386/elf -I../nptl/sysdeps/unix/sysv/linux/i386/i586 -I../nptl/sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux/i386 -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv/i386 -I../nptl/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -I../nptl/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../nptl/sysdeps/i386/i586 -I../sysdeps/i386/i586 -I../sysdeps/i386/i486 -I../nptl/sysdeps/i386/i486 -I../sysdeps/i386/fpu -I../nptl/sysdeps/i386 -I../sysdeps/i386 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl  -I.. -I../libio -I. -nostdinc -isystem ...crosstool-ng/output/gcc-4.2.1-glibc-2.5/i586-unknown-linux-gnu/lib/gcc/i586-unknown-linux-gnu/4.2.1/include -isystem ...uClinux/linux-2.6.x/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h       -x c - \
        -MD -MP -MF ...uClinux/glibc/build/lowlevelcond.h.dT -MT '...uClinux/glibc/build/lowlevelcond.h.d ...uClinux/glibc/build/lowlevelcond.h'
make[4]: execvp: /bin/sh: Argument list too long
gawk -f ../scripts/gen-as-const.awk pthread-errnos.sym \
    | i586-unknown-linux-gnu-gcc  -S -o ...uClinux/glibc/build/pthread-errnos.hT3 -std=gnu99 -DCONFIG_GEODE -DCONFIG_NETtel -DCONFIG_SECUREEDGE -DCONFIG_X86 -DEMBED -O1 -Wall -Winline -Wwrite-strings -fgnu89-inline -fmerge-all-constants -g -Wstrict-prototypes -mpreferred-stack-boundary=2     -I../include -I...uClinux/glibc/build/nptl -I...uClinux/glibc/build -I../sysdeps/i386/elf -I../nptl/sysdeps/unix/sysv/linux/i386/i586 -I../nptl/sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux/i386 -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv/i386 -I../nptl/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -I../nptl/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../nptl/sysdeps/i386/i586 -I../sysdeps/i386/i586 -I../sysdeps/i386/i486 -I../nptl/sysdeps/i386/i486 -I../sysdeps/i386/fpu -I../nptl/sysdeps/i386 -I../sysdeps/i386 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl  -I.. -I../libio -I. -nostdinc -isystem ...crosstool-ng/output/gcc-4.2.1-glibc-2.5/i586-unknown-linux-gnu/lib/gcc/i586-unknown-linux-gnu/4.2.1/include -isystem ...uClinux/linux-2.6.x/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h       -x c - \
        -MD -MP -MF ...uClinux/glibc/build/pthread-errnos.h.dT -MT '...uClinux/glibc/build/pthread-errnos.h.d ...uClinux/glibc/build/pthread-errnos.h'
make[4]: execvp: /bin/sh: Argument list too long
make[4]: Leaving directory `...uClinux/glibc/glibc-2.5/nptl'
make[3]: *** [nptl/subdir_lib] Error 2
make[3]: Leaving directory `...uClinux/glibc/glibc-2.5'
make[2]: *** [glibc-2.5-all] Error 2
make[2]: Leaving directory `...uClinux/glibc'
make[1]: *** [all] Error 2
make[1]: Leaving directory `...uClinux/lib'
make: *** [subdirs] Error 1

I can not find any more detailed information about the error by running make in debug mode and using strace:

   Found an implicit rule for `/home/build/path/uClinux/glibc/build/nptl/rtld-libc-cancellation.os'.
    Considering target file `libc-cancellation.c'.
     Looking for an implicit rule for `libc-cancellation.c'.
     No implicit rule found for `libc-cancellation.c'.
     Finished prerequisites of target file `libc-cancellation.c'.
    No need to remake target `libc-cancellation.c'.
    Considering target file `/home/build/path/uClinux/glibc/build/pthread-errnos.h'.
     Looking for an implicit rule for `/home/build/path/uClinux/glibc/build/pthread-errnos.h'.
     Trying pattern rule with stem `pthread-errnos'.
     Trying rule prerequisite `../scripts/gen-as-const.awk'.
     Trying implicit prerequisite `pthread-errnos.sym'.
     Found an implicit rule for `/home/build/path/uClinux/glibc/build/pthread-errnos.h'.
      Pruning file `../scripts/gen-as-const.awk'.
      Pruning file `pthread-errnos.sym'.
....
      Pruning file `../sysdeps/unix/sysdep.h'.
      Pruning file `../sysdeps/generic/sysdep.h'.
      Pruning file `../sysdeps/unix/sysv/linux/sys/syscall.h'.
      Pruning file `/home/build/path/uClinux/linux-2.6.x/include/asm/unistd.h'.
      Pruning file `/home/build/path/uClinux/linux-2.6.x/include/asm/unistd_32.h'.
      Pruning file `../sysdeps/i386/sysdep.h'.
      Pruning file `../sysdeps/generic/bp-sym.h'.
      Pruning file `../sysdeps/i386/bp-asm.h'.
...
      Pruning file `../socket/sys/socket.h'.
      Pruning file `../include/sys/uio.h'.
      Pruning file `../misc/sys/uio.h'.
      Pruning file `../sysdeps/unix/sysv/linux/bits/uio.h'.
      Pruning file `../sysdeps/unix/sysv/linux/bits/socket.h'.
      Pruning file `../bits/sockaddr.h'.
      Pruning file `/home/build/path/uClinux/linux-2.6.x/include/asm/socket.h'.
      Pruning file `/home/build/path/uClinux/linux-2.6.x/include/asm/sockios.h'.
      Pruning file `../sysdeps/unix/sysv/linux/bits/in.h'.
      Pruning file `../sysdeps/i386/bits/byteswap.h'.
     Finished prerequisites of target file `/home/build/path/uClinux/glibc/build/pthread-errnos.h'.
     Prerequisite `../scripts/gen-as-const.awk' is older than target `/home/build/path/uClinux/glibc/build/pthread-errnos.h'.
     Prerequisite `pthread-errnos.sym' is older than target `/home/build/path/uClinux/glibc/build/pthread-errnos.h'.
     Prerequisite `../include/libc-symbols.h' is older than target `/home/build/path/uClinux/glibc/build/pthread-errnos.h'.
     Prerequisite `/home/build/path/uClinux/glibc/build/config.h' is older than target `/home/build/path/uClinux/glibc/build/pthread-errnos.h'.
     Prerequisite `../sysdeps/wordsize-32/symbol-hacks.h' is older than target `/home/build/path/uClinux/glibc/build/pthread-errnos.h'.
     Prerequisite `../include/errno.h' is older than target `/home/build/path/uClinux/glibc/build/pthread-errnos.h'.
     Prerequisite `../stdlib/errno.h' is older than target `/home/build/path/uClinux/glibc/build/pthread-err
....
.......
     Prerequisite `../time/sys/time.h' is older than target `/home/build/path/uClinux/glibc/build/pthread-pi-defines.h'.
     Prerequisite `../sysdeps/unix/sysv/linux/i386/sys/user.h' is older than target `/home/build/path/uClinux/glibc/build/pthread-pi-defines.h'.
     Prerequisite `../sysdeps/generic/unwind.h' is older than target `/home/build/path/uClinux/glibc/build/pthread-pi-defines.h'.
     Prerequisite `../include/resolv.h' is older than target `/home/build/path/uClinux/glibc/build/pthread-pi-defines.h'.
     Prerequisite `../resolv/resolv.h' is older than target `/home/build/path/uClinux/glibc/build/pthread-pi-defines.h'.
     Prerequisite `../include/netinet/in.h' is older than target `/home/build/path/uClinux/glibc/build/pthread-pi-defines.h'.
     Prerequisite `../inet/netinet/in.h' is older than target `/home/

     Prerequisite `../sysdeps/unix/sysv/linux/bits/in.h' is older than target `/home/build/path/uClinux/glibc/build/pthread-pi-defines.h'.
     Prerequisite `../sysdeps/i386/bits/byteswap.h' is older than target `/home/build/path/uClinux/glibc/build/pthread-pi-defines.h'.
     Prerequisite `../nptl/sysdeps/unix/sysv/linux/internaltypes.h' is older than target `/home/build/path/uClinux/glibc/build/pthread-pi-defines.h'.
...
     Prerequisite `../sysdeps/unix/sysv/linux/kernel-features.h' is older than target `/home/build/path/uClinux/glibc/build/pthread-pi-defines.h'.
    No need to remake target `/home/build/path/uClinux/glibc/build/pthread-pi-defines.h'.
   Finished prerequisites of target file `/home/build/path/uClinux/glibc/build/nptl/rtld-libc-cancellation.os'.
  Must remake target `/home/build/path/uClinux/glibc/build/nptl/rtld-libc-cancellation.os'.
i586-unknown-linux-gnu-gcc  libc-cancellation.c -c -std=gnu99 -DCONFIG_GEODE -DCONFIG_NETtel -DCONFIG_SECUREEDGE -DCONFIG_X86 -DEMBED -O1 -Wall -Winline -Wwrite-strings -fgnu89-inline -fmerge-all-constants -g -Wstrict-prototypes -mpreferred-stack-boundary=2  -fPIC -g0 -O99 -fomit-frame-pointer -D__USE_STRING_INLINES -fasynchronous-unwind-tables   -I../include -I/home/build/path/uClinux/glibc/build/nptl -I/home/build/path/uClinux/glibc/build -I../sysdeps/i386/elf -I../nptl/sysdeps/unix/sysv/linux/i386/i586 -I../nptl/sysdeps/unix/sysv/linux/i386 -I../sysdeps/unix/sysv/linux/i386 -I../nptl/sysdeps/unix/sysv/linux -I../nptl/sysdeps/pthread -I../sysdeps/pthread -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv/i386 -I../nptl/sysdeps/unix/sysv -I../sysdeps/unix/sysv -I../sysdeps/unix/i386 -I../nptl/sysdeps/unix -I../sysdeps/unix -I../sysdeps/posix -I../nptl/sysdeps/i386/i586 -I../sysdeps/i386/i586 -I../sysdeps/i386/i486 -I../nptl/sysdeps/i386/i486 -I../sysdeps/i386/fpu -I../nptl/sysdeps/i386 -I../sysdeps/i386 -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/ldbl-96 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic -I../nptl  -I.. -I../libio -I. -nostdinc -isystem /home/build/path/crosstool-ng/output/gcc-4.2.1-glibc-2.5/i586-unknown-linux-gnu/lib/gcc/i586-unknown-linux-gnu/4.2.1/include -isystem /home/build/path/uClinux/linux-2.6.x/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h  -DPIC -DSHARED     -DNOT_IN_libc=1 -DIS_IN_rtld=1 -o /home/build/path/uClinux/glibc/build/nptl/rtld-libc-cancellation.os -MD -MP -MF /home/build/path/uClinux/glibc/build/nptl/rtld-libc-cancellation.os.dt -MT /home/build/path/uClinux/glibc/build/nptl/rtld-libc-cancellation.os
make[6]: execvp: i586-unknown-linux-gnu-gcc: Argument list too long
Putting child 0x08e3bdf0 (/home/build/path/uClinux/glibc/build/nptl/rtld-libc-cancellation.os) PID 30194 on the chain.
Live child 0x08e3bdf0 (/home/build/path/uClinux/glibc/build/nptl/rtld-libc-cancellation.os) PID 30194 
Reaping losing child 0x08e3bdf0 PID 30194 
make[6]: *** [/home/build/path/uClinux/glibc/build/nptl/rtld-libc-cancellation.os] Error 127
Removing child 0x08e3bdf0 PID 30194 from chain.
make[6]: Leaving directory `/home/build/path/uClinux/glibc/glibc-2.5/nptl'
Reaping losing child 0x09c22ab0 PID 27931 
make[5]: *** [/home/build/path/uClinux/glibc/build/nptl/rtld-libc-cancellation.os] Error 2
Removing child 0x09c22ab0 PID 27931 from chain.
make[5]: Leaving directory `/home/build/path/uClinux/glibc/glibc-2.5/elf'
Reaping losing child 0x09bcc1d0 PID 25914 
make[4]: *** [/home/build/path/uClinux/glibc/build/elf/rtld-libc.a] Error 2
Removing child 0x09bcc1d0 PID 25914 from chain.
make[4]: Leaving directory `/home/build/path/uClinux/glibc/glibc-2.5/elf'
Reaping losing child 0x09832258 PID 25497 
make[3]: *** [elf/subdir_lib] Error 2
Removing child 0x09832258 PID 25497 from chain.
make[3]: Leaving directory `/home/build/path/uClinux/glibc/glibc-2.5'
make[2]: *** [glibc-2.5-all] Error 2
make[2]: Leaving directory `/home/build/path/uClinux/glibc'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/build/path/uClinux/lib'
make: *** [subdirs] Error 1
[{WIFEXITED(s) && WEXITSTATUS(s) == 2}], 0, NULL) = 28994
--- SIGCHLD (Child exited) @ 0 (0) ---
sigreturn()                             = ? (mask now [])
exit_group(2)                           = ?
Govan
  • 2,079
  • 4
  • 31
  • 53
  • 1
    It might be helpful to use `strace` to see exactly what execvp is being done. – Nate Eldredge Jul 06 '20 at 19:00
  • 1
    The point of the linked answers seems to be that `getconf ARG_MAX` indicates the maximum *total* size of the arguments, but there is a separate maximum length for *each* argument, which is hardcoded at 128kB (could potentially be different on your system). And for a command executed by the shell with `system(3)`, the whole long string is a single argument to `sh`. But the command in your question seems to only be about 1700 bytes so it may be that the error is caused by executing some other command that make hasn't echoed. – Nate Eldredge Jul 06 '20 at 19:13
  • @NateEldredge I will try to get some more info with strace. The strange thing is that the same make file is working on an older kernel version (OpenSuse). But I am getting the same error on both ubuntu 12.04 and 14.04. We had a comment o n build process that said that it is possible to get argumet list too long on ubuntu and to avoid it we can change the stack size with ulimits. I changed stack size from 8 to 1 mbyte but I am still getting the same bug – Govan Jul 06 '20 at 19:29
  • I couldn't find more information by running strace and debug. – Govan Jul 07 '20 at 10:20
  • 1
    When I am moving my glibc library to a shorter path, then build is working without problem – Govan Jul 07 '20 at 14:26
  • Then maybe you reach `PATH_MAX` – KamilCuk Jul 07 '20 at 14:31
  • @KamilCuk , is there a way to change PATH_MAX? – Govan Jul 07 '20 at 14:35
  • Well, never tried it, it was always 4096. But is that really an issue, your path has more then 4k characters? – KamilCuk Jul 07 '20 at 14:37
  • @KamilCuk I don't think it is the path problem. The path I am using is certainly less than 4096. I think the problem is when using longer path then the argument size is exceeding the limit. The argument size is about 2197 when it crashes. But I don't know how I can change argument size – Govan Jul 07 '20 at 14:49

0 Answers0