Build error of libselinux for x86_64 target

Hello,

After some update of master i'm unable to build firmware for my i5-based router (nuc-like box with 6 e1000e ports).

Version: master 89ef883b92b3a87d9ab1bd289de26b9e72681dac
My previous successful build was r16341-bbb9c1c2be.

To reproduce it's enough to:

make defconfig
make menuconfig  # select x86, x86_64
make -j$(nproc)
$ LANG=C make -j1 V=sc package/libs/libselinux/compile
make[2]: Entering directory '/home/vovan/build/LEDE/lede/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/home/vovan/build/LEDE/lede/scripts/config'
make[1]: Entering directory '/home/vovan/build/LEDE/lede'
make[2]: Entering directory '/home/vovan/build/LEDE/lede/package/libs/toolchain'
echo "libc" >> /home/vovan/build/LEDE/lede/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
echo "libgcc" >> /home/vovan/build/LEDE/lede/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
echo "libpthread" >> /home/vovan/build/LEDE/lede/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
echo "librt" >> /home/vovan/build/LEDE/lede/staging_dir/target-x86_64_musl/pkginfo/toolchain.default.install
make[2]: Leaving directory '/home/vovan/build/LEDE/lede/package/libs/toolchain'
time: package/libs/toolchain/compile#0.11#0.01#0.12
make[2]: Entering directory '/home/vovan/build/LEDE/lede/package/libs/libsepol'
mkdir -p /home/vovan/build/LEDE/lede/dl
SHELL= flock /home/vovan/build/LEDE/lede/tmp/.libsepol-3.2.tar.gz.flock -c '  	/home/vovan/build/LEDE/lede/scripts/download.pl "/home/vovan/build/LEDE/lede/dl" "libsepol-3.2.tar.gz" "dfc7f662af8000116e56a01de6a0394ed79be1b34b999e551346233c5dd19508" "" "https://github.com/SELinuxProject/selinux/releases/download/3.2"    '
make[2]: Leaving directory '/home/vovan/build/LEDE/lede/package/libs/libsepol'
time: package/libs/libsepol/compile#0.14#0.02#0.15
make[2]: Entering directory '/home/vovan/build/LEDE/lede/package/libs/pcre'
mkdir -p /home/vovan/build/LEDE/lede/dl
SHELL= flock /home/vovan/build/LEDE/lede/tmp/.pcre-8.44.tar.bz2.flock -c '  	/home/vovan/build/LEDE/lede/scripts/download.pl "/home/vovan/build/LEDE/lede/dl" "pcre-8.44.tar.bz2" "19108658b23b3ec5058edc9f66ac545ea19f9537234be1ec62b714c84399366d" "" "@SF/pcre"    '
make[2]: Leaving directory '/home/vovan/build/LEDE/lede/package/libs/pcre'
time: package/libs/pcre/compile#0.15#0.02#0.15
make[2]: Entering directory '/home/vovan/build/LEDE/lede/package/libs/musl-fts'
mkdir -p /home/vovan/build/LEDE/lede/dl
SHELL= flock /home/vovan/build/LEDE/lede/tmp/.musl-fts-1.2.7.tar.xz.flock -c '  	/home/vovan/build/LEDE/lede/scripts/download.pl "/home/vovan/build/LEDE/lede/dl" "musl-fts-1.2.7.tar.xz" "29c62a600128e9189b1b2e1aea568546178eedf739527f657873b3b773072ecb" "" || (  /home/vovan/build/LEDE/lede/scripts/dl_github_archive.py --dl-dir="/home/vovan/build/LEDE/lede/dl" --url="https://github.com/pullmoll/musl-fts.git" --version="0bde52df588e8969879a2cae51c3a4774ec62472" --subdir="musl-fts-1.2.7" --source="musl-fts-1.2.7.tar.xz" --hash="29c62a600128e9189b1b2e1aea568546178eedf739527f657873b3b773072ecb" || ( 	echo "Checking out files from the git repository..."; mkdir -p /home/vovan/build/LEDE/lede/tmp/dl && cd /home/vovan/build/LEDE/lede/tmp/dl && rm -rf musl-fts-1.2.7 && [ \! -d musl-fts-1.2.7 ] && git clone  https://github.com/pullmoll/musl-fts.git musl-fts-1.2.7 && (cd musl-fts-1.2.7 && git checkout 0bde52df588e8969879a2cae51c3a4774ec62472 && git submodule update --init --recursive) && echo "Packing checkout..." && export TAR_TIMESTAMP=`cd musl-fts-1.2.7 && git log -1 --format='\''@%ct'\''` && rm -rf musl-fts-1.2.7/.git && 	tar --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name ${TAR_TIMESTAMP:+--mtime="$TAR_TIMESTAMP"} -c musl-fts-1.2.7 | 	xz -zc -7e > /home/vovan/build/LEDE/lede/tmp/dl/musl-fts-1.2.7.tar.xz && mv /home/vovan/build/LEDE/lede/tmp/dl/musl-fts-1.2.7.tar.xz /home/vovan/build/LEDE/lede/dl/ && rm -rf musl-fts-1.2.7; );  )    '
make[2]: Leaving directory '/home/vovan/build/LEDE/lede/package/libs/musl-fts'
time: package/libs/musl-fts/compile#0.12#0.01#0.13
make[2]: Entering directory '/home/vovan/build/LEDE/lede/package/libs/libselinux'
mkdir -p /home/vovan/build/LEDE/lede/dl
SHELL= flock /home/vovan/build/LEDE/lede/tmp/.libselinux-3.2.tar.gz.flock -c '  	/home/vovan/build/LEDE/lede/scripts/download.pl "/home/vovan/build/LEDE/lede/dl" "libselinux-3.2.tar.gz" "df758ef1d9d4811051dd901ea6b029ae334ffd7c671c128beb16bce1e25ac161" "" "https://github.com/SELinuxProject/selinux/releases/download/3.2"    '
rm -f /home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/.built
touch /home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/.built_check
CFLAGS="-Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2=libselinux-3.2 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -I/home/vovan/build/LEDE/lede/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/usr/include -I/home/vovan/build/LEDE/lede/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/include/fortify -I/home/vovan/build/LEDE/lede/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/include " CXXFLAGS="-Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2=libselinux-3.2 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -I/home/vovan/build/LEDE/lede/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/usr/include -I/home/vovan/build/LEDE/lede/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/include/fortify -I/home/vovan/build/LEDE/lede/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/include " LDFLAGS="-L/home/vovan/build/LEDE/lede/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/usr/lib -L/home/vovan/build/LEDE/lede/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/lib -znow -zrelro " make -j1 -C /home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/. AR="x86_64-openwrt-linux-musl-gcc-ar" AS="x86_64-openwrt-linux-musl-gcc -c -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2=libselinux-3.2 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" LD=x86_64-openwrt-linux-musl-ld NM="x86_64-openwrt-linux-musl-gcc-nm" CC="x86_64-openwrt-linux-musl-gcc" GCC="x86_64-openwrt-linux-musl-gcc" CXX="x86_64-openwrt-linux-musl-g++" RANLIB="x86_64-openwrt-linux-musl-gcc-ranlib" STRIP=x86_64-openwrt-linux-musl-strip OBJCOPY=x86_64-openwrt-linux-musl-objcopy OBJDUMP=x86_64-openwrt-linux-musl-objdump SIZE=x86_64-openwrt-linux-musl-size CROSS="x86_64-openwrt-linux-musl-" ARCH="x86_64" FTS_LDLIBS=-lfts SHLIBDIR=/usr/lib OS=Linux all;
make[3]: Entering directory '/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2'
make[4]: Entering directory '/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/include'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/include'
make[4]: Entering directory '/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/src'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/src'
make[4]: Entering directory '/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/utils'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/utils'
make[4]: Entering directory '/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/man'
make[4]: Nothing to be done for 'all'.
make[4]: Leaving directory '/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/man'
make[3]: Leaving directory '/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2'
CFLAGS="-Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2=libselinux-3.2 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -I/home/vovan/build/LEDE/lede/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/usr/include -I/home/vovan/build/LEDE/lede/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/include/fortify -I/home/vovan/build/LEDE/lede/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/include " CXXFLAGS="-Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2=libselinux-3.2 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  -I/home/vovan/build/LEDE/lede/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/usr/include -I/home/vovan/build/LEDE/lede/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/include/fortify -I/home/vovan/build/LEDE/lede/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/include " LDFLAGS="-L/home/vovan/build/LEDE/lede/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/usr/lib -L/home/vovan/build/LEDE/lede/staging_dir/toolchain-x86_64_gcc-8.4.0_musl/lib -znow -zrelro " make -C /home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/. AR="x86_64-openwrt-linux-musl-gcc-ar" AS="x86_64-openwrt-linux-musl-gcc -c -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -fmacro-prefix-map=/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2=libselinux-3.2 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro" LD=x86_64-openwrt-linux-musl-ld NM="x86_64-openwrt-linux-musl-gcc-nm" CC="x86_64-openwrt-linux-musl-gcc" GCC="x86_64-openwrt-linux-musl-gcc" CXX="x86_64-openwrt-linux-musl-g++" RANLIB="x86_64-openwrt-linux-musl-gcc-ranlib" STRIP=x86_64-openwrt-linux-musl-strip OBJCOPY=x86_64-openwrt-linux-musl-objcopy OBJDUMP=x86_64-openwrt-linux-musl-objdump SIZE=x86_64-openwrt-linux-musl-size CROSS="x86_64-openwrt-linux-musl-" ARCH="x86_64" FTS_LDLIBS=-lfts SHLIBDIR=/usr/lib OS=Linux DESTDIR="/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/ipkg-install"  install;
make[3]: Entering directory '/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2'
make[4]: Entering directory '/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/include'
test -d /home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/ipkg-install/usr/include/selinux || install -m 755 -d /home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/ipkg-install/usr/include/selinux
install -m 644 selinux/avc.h selinux/context.h selinux/get_context_list.h selinux/get_default_type.h selinux/label.h selinux/restorecon.h selinux/selinux.h /home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/ipkg-install/usr/include/selinux
make[4]: Leaving directory '/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/include'
make[4]: Entering directory '/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/src'
test -d /home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/ipkg-install/usr/lib || install -m 755 -d /home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/ipkg-install/usr/lib
install: error while loading shared libraries: /lib/x86_64-linux-gnu/libc.so: invalid ELF header
make[4]: *** [Makefile:176: install] Error 127
make[4]: Leaving directory '/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/src'
make[3]: *** [Makefile:48: install] Error 1
make[3]: Leaving directory '/home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2'
make[2]: *** [Makefile:159: /home/vovan/build/LEDE/lede/build_dir/target-x86_64_musl/libselinux-3.2/.built] Error 2
make[2]: Leaving directory '/home/vovan/build/LEDE/lede/package/libs/libselinux'
time: package/libs/libselinux/compile#0.21#0.03#0.21
    ERROR: package/libs/libselinux failed to build.
make[1]: *** [package/Makefile:116: package/libs/libselinux/compile] Error 1
make[1]: Leaving directory '/home/vovan/build/LEDE/lede'
make: *** [/home/vovan/build/LEDE/lede/include/toplevel.mk:230: package/libs/libselinux/compile] Error 2
zsh: exit 2     LANG=C make -j1 V=sc package/libs/libselinux/compile

At first it failed to locate libpcre.so.0, then libfts.so.0. Now it tries to load system's glibc instead of toolchain's musl.
And more over that selinux is not selected at all!

report a bug - flyspray
email developers - openwrt-devel@lists.openwrt.org

Well, looks like that Ubuntu 21.04 too fresh. I solved problem by using a container, thanks to @mwarning .
Surprisingly that i'm been able to build arm-target, but fail on x86.

2 Likes

Pretty much by definition there is no 'too fresh', at least not for the master branch (there obviously will be for older releases at some point), just previously unknown bugs that need reporting and fixing.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.