Build error with libbpf - path forward?

In building for x86/64 I am getting the following. Any ideas?

touch /scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0/.prepared_5db5ec0aeef5edad61fe9f065b32ee92_6664517399ebbbc92a37c5bb081b5c53_check
. /scratch/union/include/shell.sh; zstdcat /scratch/union/dl/libbpf-1.4.0.tar.zst | tar -C /scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0/.. -xf -
[ ! -d ./src/ ] || cp -fpR ./src/. /scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0
touch /scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0/.prepared_5db5ec0aeef5edad61fe9f065b32ee92_6664517399ebbbc92a37c5bb081b5c53
rm -f /scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0/.configured_*
rm -f /scratch/union/staging_dir/target-x86_64_musl/stamp/.libbpf_installed
(cd /scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0/./; if [ -x ./configure ]; then find /scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0/ -name config.guess | xargs -r chmod u+w; find /scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0/ -name config.guess | xargs -r -n1 cp --remove-destination /scratch/union/scripts/config.guess; find /scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0/ -name config.sub | xargs -r chmod u+w; find /scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0/ -name config.sub | xargs -r -n1 cp --remove-destination /scratch/union/scripts/config.sub; AR="x86_64-openwrt-linux-musl-gcc-ar" AS="x86_64-openwrt-linux-musl-gcc -c -march=znver3 -O3 -pipe -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0=libbpf-1.4.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  " LD="x86_64-openwrt-linux-musl-ld.bfd" 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 CFLAGS="-march=znver3 -O3 -pipe -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0=libbpf-1.4.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro   " CXXFLAGS="-march=znver3 -O3 -pipe -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0=libbpf-1.4.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro   " CPPFLAGS="-I/scratch/union/staging_dir/toolchain-x86_64_gcc-13.2.0_musl/usr/include -I/scratch/union/staging_dir/toolchain-x86_64_gcc-13.2.0_musl/include -I/scratch/union/staging_dir/toolchain-x86_64_gcc-13.2.0_musl/include/fortify   " LDFLAGS="-L/scratch/union/staging_dir/toolchain-x86_64_gcc-13.2.0_musl/usr/lib -L/scratch/union/staging_dir/toolchain-x86_64_gcc-13.2.0_musl/lib -fuse-ld=bfd -znow -zrelro   "   ./configure --target=x86_64-openwrt-linux --host=x86_64-openwrt-linux --build=x86_64-pc-linux-gnu --disable-dependency-tracking --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls  ; fi; )
touch /scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0/.configured_a17fb5ef857664f03cd0ce37cc5ea591
rm -f /scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0/.built
touch /scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0/.built_check
CFLAGS="-march=znver3 -O3 -pipe -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0=libbpf-1.4.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro    -I/scratch/union/staging_dir/toolchain-x86_64_gcc-13.2.0_musl/usr/include -I/scratch/union/staging_dir/toolchain-x86_64_gcc-13.2.0_musl/include -I/scratch/union/staging_dir/toolchain-x86_64_gcc-13.2.0_musl/include/fortify   " CXXFLAGS="-march=znver3 -O3 -pipe -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0=libbpf-1.4.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro    -I/scratch/union/staging_dir/toolchain-x86_64_gcc-13.2.0_musl/usr/include -I/scratch/union/staging_dir/toolchain-x86_64_gcc-13.2.0_musl/include -I/scratch/union/staging_dir/toolchain-x86_64_gcc-13.2.0_musl/include/fortify   " LDFLAGS="-L/scratch/union/staging_dir/toolchain-x86_64_gcc-13.2.0_musl/usr/lib -L/scratch/union/staging_dir/toolchain-x86_64_gcc-13.2.0_musl/lib -fuse-ld=bfd -znow -zrelro   " make  -C /scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0/src AR="x86_64-openwrt-linux-musl-gcc-ar" AS="x86_64-openwrt-linux-musl-gcc -c -march=znver3 -O3 -pipe -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0=libbpf-1.4.0 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro  " LD="x86_64-openwrt-linux-musl-ld.bfd" 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" V='' LIBSUBDIR=lib ;
make[4]: Entering directory '/scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0/src'
  MKDIR    staticobjs
  CC       staticobjs/bpf.o
  CC       staticobjs/btf.o
In file included from btf.c:18:
/scratch/union/staging_dir/target-x86_64_musl/usr/include/gelf.h:86:9: error: unknown type name 'Elf64_Relr'
   86 | typedef Elf64_Relr GElf_Relr;
      |         ^~~~~~~~~~
cc1: note: unrecognized command-line option '-Wno-unknown-warning-option' may have been intended to silence earlier diagnostics
make[4]: *** [Makefile:134: staticobjs/btf.o] Error 1
make[4]: Leaving directory '/scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0/src'
make[3]: *** [Makefile:75: /scratch/union/build_dir/target-x86_64_musl/libbpf-1.4.0/.built] Error 2
make[3]: Leaving directory '/scratch/union/package/libs/libbpf'
time: package/libs/libbpf/compile#0.61#0.18#1.04
    ERROR: package/libs/libbpf failed to build.
make[2]: *** [package/Makefile:129: package/libs/libbpf/compile] Error 1
make[2]: Leaving directory '/scratch/union'
make[1]: *** [package/Makefile:123: /scratch/union/staging_dir/target-x86_64_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/scratch/union'
make: *** [/scratch/union/include/toplevel.mk:233: world] Error 2

No solution, but similar issue reported on GH.

Or try a completely clean build environment as mentioned here:

2 Likes

Yeah, I'm seeing that one, too, since I think yesterday. Also seeing python3 not building when I add CONFIG_PACKAGE_nmap starting about the same time...

Ok, I looked at those links Dave pointed to, did rm -fr bin/ dl/ staging_dir/ build_dir/ tmp/ and now everything's working (that caused a rebuild of the toolchain).

EDIT
After digging through the makefile, it appears that make dirclean is what I was looking for, it wipes all that stuff (and maybe more).

1 Like

This explains a lot. Thanks.

I usually do a rm -rf bin build_dir tmp clean before a build, and spent pretty well all day two days ago trying to get a clean build. Updated build pre-requisites, dropped down to gcc 12, . . . So yesterday I wiped all and cloned a new build environment and all was good with the world.

Just looked at the git log from yesterday and that revert is sitting there at Head. Bad timing :face_vomiting:

Or by looking at wiki?

1 Like

Thanks, the toolchain rebuild fixed it.

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