Compile error 19.07

Built OpenWrt 19.07 some weeks ago and was working fine (Kernel 4.14.138).

When I try to compile it now, it always fails.

git clone https://git.openwrt.org/openwrt/openwrt.git/
cd openwrt
git checkout openwrt-19.07
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
make download -j5
make -j5 (running make without "j5" doesn't improve anything)

[user@localhost openwrt]$ make -j5 V=s
make[1]: Entering directory '/home/user/Downloads/openwrt'
make[2]: Entering directory '/home/user/Downloads/openwrt'
make[2]: Entering directory '/home/user/Downloads/openwrt'
+ mkdir -p /home/user/Downloads/openwrt/staging_dir/target-mipsel_24kc_musl
+ mkdir -p /home/user/Downloads/openwrt/staging_dir/host
+ cd /home/user/Downloads/openwrt/staging_dir/target-mipsel_24kc_musl
+ mkdir -p bin lib include stamp
+ cd /home/user/Downloads/openwrt/staging_dir/host
+ mkdir -p bin lib include stamp
mkdir -p /home/user/Downloads/openwrt/build_dir/target-mipsel_24kc_musl/stamp
mkdir -p /home/user/Downloads/openwrt/build_dir/host/stamp /home/user/Downloads/openwrt/staging_dir/host/include/sys
rm -rf /home/user/Downloads/openwrt/staging_dir/target-mipsel_24kc_musl/root-ramips
touch /home/user/Downloads/openwrt/staging_dir/target-mipsel_24kc_musl/.prepared
install -m0644 /home/user/Downloads/openwrt/tools/include/*.h /home/user/Downloads/openwrt/staging_dir/host/include/
make[2]: Leaving directory '/home/user/Downloads/openwrt'
install -m0644 /home/user/Downloads/openwrt/tools/include/sys/*.h /home/user/Downloads/openwrt/staging_dir/host/include/sys/
ln -sf lib /home/user/Downloads/openwrt/staging_dir/host/lib64
touch /home/user/Downloads/openwrt/staging_dir/host/.prepared
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/flock'
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/flock'
time: tools/flock/compile#0.17#0.06#0.21
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/xz'
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/xz'
time: tools/xz/compile#0.20#0.07#0.24
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/sed'
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/sed'
time: tools/sed/compile#0.20#0.08#0.26
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/tar'
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/patch'
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/patch'
time: tools/patch/compile#0.18#0.08#0.25
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/tar'
time: tools/tar/compile#0.20#0.07#0.27
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/m4'
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/sstrip'
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/expat'
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/pkg-config'
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/patch-image'
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/patch-image'
time: tools/patch-image/compile#0.23#0.06#0.35
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/sstrip'
time: tools/sstrip/compile#0.21#0.08#0.38
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/m4'
time: tools/m4/compile#0.26#0.11#0.46
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/scons'
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/pkg-config'
time: tools/pkg-config/compile#0.24#0.11#0.45
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/mtools'
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/expat'
time: tools/expat/compile#0.25#0.09#0.51
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/lzma'
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/zip'
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/autoconf'
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/scons'
time: tools/scons/compile#0.22#0.09#0.45
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/mtools'
time: tools/mtools/compile#0.26#0.09#0.46
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/lzma'
time: tools/lzma/compile#0.26#0.09#0.44
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/libressl'
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/zip'
time: tools/zip/compile#0.25#0.09#0.43
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/autoconf'
time: tools/autoconf/compile#0.25#0.08#0.42
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/missing-macros'
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/automake'
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/missing-macros'
time: tools/missing-macros/compile#0.16#0.05#0.22
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/libressl'
time: tools/libressl/compile#0.24#0.10#0.34
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/cmake'
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/mkimage'
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/automake'
time: tools/automake/compile#0.23#0.09#0.34
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/libtool'
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/dosfstools'
make -C /home/user/Downloads/openwrt/build_dir/host/u-boot-2018.03 HOSTCFLAGS="-O2 -I/home/user/Downloads/openwrt/staging_dir/host/include " HOSTLDFLAGS="-L/home/user/Downloads/openwrt/staging_dir/host/lib " no-dot-config-targets=tools-only CONFIG_MKIMAGE_DTC_PATH=dtc CONFIG_FIT_SIGNATURE=y tools-only
make[4]: Entering directory '/home/user/Downloads/openwrt/build_dir/host/u-boot-2018.03'
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/dosfstools'
time: tools/dosfstools/compile#0.26#0.08#0.38
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/libtool'
time: tools/libtool/compile#0.25#0.09#0.41
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/cmake'
  HOSTCC  scripts/basic/fixdep
time: tools/cmake/compile#0.36#0.22#0.55
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/gmp'
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/libelf'
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/flex'
make[3]: Entering directory '/home/user/Downloads/openwrt/tools/mklibs'
  CHK     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  HOSTCC  tools/mkenvimage.o
In file included from /usr/include/asm-generic/types.h:7,
                 from /usr/include/asm/types.h:5,
                 from /usr/include/linux/types.h:5,
                 from /usr/include/linux/stat.h:5,
                 from /usr/include/bits/statx.h:30,
                 from /usr/include/sys/stat.h:446,
                 from tools/mkenvimage.c:21:
/usr/include/asm-generic/int-ll64.h:31:42: error: conflicting types for '__u64'
   31 | __extension__ typedef unsigned long long __u64;
      |                                          ^~~~~
In file included from <command-line>:
././include/compiler.h:69:18: note: previous declaration of '__u64' was here
   69 | typedef uint64_t __u64;
      |                  ^~~~~
make[5]: *** [scripts/Makefile.host:116: tools/mkenvimage.o] Error 1
make[4]: *** [Makefile:1509: tools-only] Error 2
make[4]: Leaving directory '/home/user/Downloads/openwrt/build_dir/host/u-boot-2018.03'
make[3]: *** [Makefile:47: /home/user/Downloads/openwrt/build_dir/host/u-boot-2018.03/.built] Error 2
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/mkimage'
time: tools/mkimage/compile#0.55#0.26#1.02
make[2]: *** [tools/Makefile:159: tools/mkimage/compile] Error 2
make[2]: *** Waiting for unfinished jobs....
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/gmp'
time: tools/gmp/compile#0.27#0.11#0.48
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/libelf'
time: tools/libelf/compile#0.26#0.09#0.48
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/flex'
time: tools/flex/compile#0.25#0.10#0.48
make[3]: Leaving directory '/home/user/Downloads/openwrt/tools/mklibs'
time: tools/mklibs/compile#0.25#0.09#0.45
make[2]: Leaving directory '/home/user/Downloads/openwrt'
make[1]: *** [tools/Makefile:155: /home/user/Downloads/openwrt/staging_dir/target-mipsel_24kc_musl/stamp/.tools_compile_yynyynnyyynyyyyynyynnyyyynyyyyyyyyyyyyyyynyynynnyyynnyyy] Error 2
make[1]: Leaving directory '/home/user/Downloads/openwrt'
make: *** [/home/user/Downloads/openwrt/include/toplevel.mk:218: world] Fehler 2

OS: Fedora 30
GCC: 9.2.1
TARGETS: ar71xx, ramips
DEVICES: tl-wa860re, tl-wa850re, ex2700

Clearing the temp directory, downgrading the gcc version or starting all over again didn't work either.

Any hints what the problem could be?

Please give the following patch a try to remove the __u64 typedef.

diff --git a/tools/mkimage/patches/060-remove_kernel_includes.patch b/tools/mkimage/patches/060-remove_kernel_includes.patch
index e61d8cc496..0d69b99214 100644
--- a/tools/mkimage/patches/060-remove_kernel_includes.patch
+++ b/tools/mkimage/patches/060-remove_kernel_includes.patch
@@ -1,10 +1,9 @@
 --- a/include/compiler.h
 +++ b/include/compiler.h
-@@ -66,6 +66,11 @@ typedef uint8_t __u8;
+@@ -66,6 +66,10 @@ typedef uint8_t __u8;
  typedef uint16_t __u16;
  typedef uint32_t __u32;
  typedef unsigned int uint;
-+typedef uint64_t __u64;
 +#ifndef linux
 +typedef int __kernel_daddr_t;
 +typedef unsigned int __kernel_ino_t;
1 Like

@yousong

Wonderful solution, thank you!

Can you please submit this patch change?

Patch applied to openwrt-19.07 branch: https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=f54bc3985a2fbc30256d9aee8ea3b60b8aee593a

2 Likes

Does this affect the building of any older tags, or just 19.07/master?

Thanks for the remainder. I just also applied it to openwrt-18.06 branch. As for lede-17.01, it's discontinued and the uboot version is different so I do not bother.

2 Likes