anaelorlinski / OpenWrt-NanoPi-R2S-R4S-Builds

OpenWRT Builds for NanoPi R2S & R4S from official Openwrt source code with minimal set of patches
MIT License
175 stars 58 forks source link

Can't compile on Ubuntu 22.04 #41

Closed mikegleasonjr closed 1 year ago

mikegleasonjr commented 1 year ago

Hi,

I cleaned installed a new Ubuntu 22.04 build and installed the necessary dependencies and since then I can't compile OpenWRT anymore... Seems like m4 is causing a bug or something at step 7. All other previous steps are working fine...

$ ./openwrt-22.03/steps/07-all_kmods.sh
/OpenWrt-NanoPi-R2S-R4S-Builds
#
# configuration written to .config
#
make[2]: Entering directory '/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/scripts/config'
time: target/linux/prereq#0.08#0.01#0.09
 make[1] target/compile
 make[2] -C target/linux compile
    ERROR: target/linux failed to build.
make -r target/compile: build failed. Please re-run make with -j1 V=s or V=sc for a higher verbosity level to see what's going on
make: *** [/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/include/toplevel.mk:230: target/compile] Error 1
make[2]: Entering directory '/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/scripts/config'
make[1]: Entering directory '/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt'
cd "/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt"; git log --format=%h -1 toolchain > /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/tmp/.ver_check
cmp -s /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/tmp/.ver_check /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/staging_dir/toolchain-aarch64_generic_gcc-11.2.0_musl/stamp/.ver_check || { \
    rm -rf /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/staging_dir/target-aarch64_generic_musl /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/staging_dir/toolchain-aarch64_generic_gcc-11.2.0_musl /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/toolchain-aarch64_generic_gcc-11.2.0_musl; \
    mkdir -p /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/staging_dir/toolchain-aarch64_generic_gcc-11.2.0_musl/stamp; \
    mv /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/tmp/.ver_check /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/staging_dir/toolchain-aarch64_generic_gcc-11.2.0_musl/stamp/.ver_check; \
}
make[2]: Entering directory '/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/target/linux'
make[3]: Entering directory '/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/target/linux/rockchip'
rm -f /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/localversion
/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/scripts/kconfig.pl  + /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/target/linux/generic/config-5.10 /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/target/linux/rockchip/armv8/config-5.10 > /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.target
awk '/^(#[[:space:]]+)?CONFIG_KERNEL/{sub("CONFIG_KERNEL_","CONFIG_");print}' /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/.config >> /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.target
echo "# CONFIG_KALLSYMS_EXTRA_PASS is not set" >> /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.target
echo "# CONFIG_KALLSYMS_ALL is not set" >> /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.target
echo "CONFIG_KALLSYMS_UNCOMPRESSED=y" >> /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.target
/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/scripts/package-metadata.pl kconfig /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/tmp/.packageinfo /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/.config 5.10 > /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.override
/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/scripts/kconfig.pl 'm+' '+' /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.target /dev/null /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.override > /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.set
mv /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.set /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.old
grep -v INITRAMFS /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.old > /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.set
echo 'CONFIG_INITRAMFS_SOURCE=""' >> /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.set
echo '# CONFIG_INITRAMFS_FORCE is not set' >> /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.set
rm -rf /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/modules
cmp -s /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.set /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.prev || { cp /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.set /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config; cp /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.set /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.prev; }
export MAKEFLAGS= ; [ -d /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/user_headers ] || make -C /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161 KCFLAGS="-ffile-prefix-map=/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl=target-aarch64_generic_musl -fno-caller-saves " HOSTCFLAGS="-O2 -I/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/staging_dir/host/include  -Wall -Wmissing-prototypes -Wstrict-prototypes" CROSS_COMPILE="aarch64-openwrt-linux-musl-" ARCH="arm64" KBUILD_HAVE_NLS=no KBUILD_BUILD_USER="mike" KBUILD_BUILD_HOST="openwrt" KBUILD_BUILD_TIMESTAMP="Tue Jan  3 00:24:21 2023" KBUILD_BUILD_VERSION="0" HOST_LOADLIBES="-L/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/staging_dir/host/lib" KBUILD_HOSTLDLIBS="-L/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/staging_dir/host/lib" CONFIG_SHELL="bash" V=''  cmd_syscalls=  KERNELRELEASE=5.10.161 CC="aarch64-openwrt-linux-musl-gcc" INSTALL_HDR_PATH=/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/user_headers headers_install
grep '=[ym]' /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.config.set | LC_ALL=C sort | /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/staging_dir/host/bin/mkhash md5 > /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.vermagic
touch /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.configured
rm -f /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/vmlinux /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/System.map
make -C /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161 KCFLAGS="-ffile-prefix-map=/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl=target-aarch64_generic_musl -fno-caller-saves " HOSTCFLAGS="-O2 -I/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/staging_dir/host/include  -Wall -Wmissing-prototypes -Wstrict-prototypes" CROSS_COMPILE="aarch64-openwrt-linux-musl-" ARCH="arm64" KBUILD_HAVE_NLS=no KBUILD_BUILD_USER="mike" KBUILD_BUILD_HOST="openwrt" KBUILD_BUILD_TIMESTAMP="Tue Jan  3 00:24:21 2023" KBUILD_BUILD_VERSION="0" HOST_LOADLIBES="-L/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/staging_dir/host/lib" KBUILD_HOSTLDLIBS="-L/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/staging_dir/host/lib" CONFIG_SHELL="bash" V=''  cmd_syscalls=  KERNELRELEASE=5.10.161 CC="aarch64-openwrt-linux-musl-gcc" Image dtbs modules
make[4]: Entering directory '/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161'
make[4]: aarch64-openwrt-linux-musl-gcc: No such file or directory
  SYNC    include/config/auto.conf.cmd
  LEX     scripts/kconfig/lexer.lex.c
flex: fatal internal error, exec of /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/staging_dir/host/bin/m4 failed
make[6]: *** [scripts/Makefile.host:9: scripts/kconfig/lexer.lex.c] Error 141
make[6]: *** Deleting file 'scripts/kconfig/lexer.lex.c'
make[5]: *** [Makefile:606: syncconfig] Error 2
Makefile:701: include/config/auto.conf.cmd: No such file or directory
make[4]: *** [Makefile:724: include/config/auto.conf.cmd] Error 2
make[4]: Leaving directory '/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161'
make[3]: *** [Makefile:23: /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/build_dir/target-aarch64_generic_musl/linux-rockchip_armv8/linux-5.10.161/.modules] Error 2
make[3]: Leaving directory '/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/target/linux/rockchip'
make[2]: *** [Makefile:11: compile] Error 2
make[2]: Leaving directory '/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/target/linux'
time: target/linux/compile#0.25#0.01#0.25
    ERROR: target/linux failed to build.
make[1]: *** [target/Makefile:30: target/linux/compile] Error 1
make[1]: Leaving directory '/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt'
make: *** [/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/include/toplevel.mk:230: target/compile] Error 2

The error is here: flex: fatal internal error, exec of /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/staging_dir/host/bin/m4 failed. Indeed the m4 shortcut doesn't exist:

$ ls -l /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/staging_dir/host/bin/m4                                                                                                   [main]
ls: cannot access '/OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/staging_dir/host/bin/m4': No such file or directory
$ ls -l /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/staging_dir/host/bin
total 32
lrwxrwxrwx 1 mike mike    13 Mar 27 15:16 awk -> /usr/bin/gawk
lrwxrwxrwx 1 mike mike    13 Mar 27 15:16 bash -> /usr/bin/bash
lrwxrwxrwx 1 mike mike    14 Mar 27 15:16 bzip2 -> /usr/bin/bzip2
lrwxrwxrwx 1 mike mike    11 Mar 27 15:16 cp -> /usr/bin/cp
lrwxrwxrwx 1 mike mike    13 Mar 27 15:16 diff -> /usr/bin/diff
lrwxrwxrwx 1 mike mike    14 Mar 27 15:16 egrep -> /usr/bin/egrep
lrwxrwxrwx 1 mike mike    13 Mar 27 15:16 file -> /usr/bin/file
lrwxrwxrwx 1 mike mike    13 Mar 27 15:16 find -> /usr/bin/find
lrwxrwxrwx 1 mike mike    12 Mar 27 15:16 g++ -> /usr/bin/g++
lrwxrwxrwx 1 mike mike    11 Mar 27 15:16 gcc -> /usr/bin/cc
lrwxrwxrwx 1 mike mike    15 Mar 27 15:16 getopt -> /usr/bin/getopt
lrwxrwxrwx 1 mike mike    12 Mar 27 15:16 git -> /usr/bin/git
lrwxrwxrwx 1 mike mike    13 Mar 27 15:16 grep -> /usr/bin/grep
lrwxrwxrwx 1 mike mike    16 Mar 27 15:16 install -> /usr/bin/install
lrwxrwxrwx 1 mike mike     9 Mar 27 15:16 ldconfig -> /bin/true
-rwxrwxr-x 1 mike mike 25384 Mar 27 15:16 mkhash
lrwxrwxrwx 1 mike mike    14 Mar 27 15:16 patch -> /usr/bin/patch
lrwxrwxrwx 1 mike mike    13 Mar 27 15:16 perl -> /usr/bin/perl
lrwxrwxrwx 1 mike mike    19 Mar 27 15:16 python -> /usr/bin/python3.10
lrwxrwxrwx 1 mike mike    19 Mar 27 15:16 python3 -> /usr/bin/python3.10
lrwxrwxrwx 1 mike mike    17 Mar 27 15:16 realpath -> /usr/bin/realpath
lrwxrwxrwx 1 mike mike    14 Mar 27 15:16 rsync -> /usr/bin/rsync
lrwxrwxrwx 1 mike mike    12 Mar 27 15:16 seq -> /usr/bin/seq
lrwxrwxrwx 1 mike mike    13 Mar 27 15:16 stat -> /usr/bin/stat
lrwxrwxrwx 1 mike mike    12 Mar 27 15:16 tar -> /usr/bin/tar
lrwxrwxrwx 1 mike mike    14 Mar 27 15:16 unzip -> /usr/bin/unzip
lrwxrwxrwx 1 mike mike    13 Mar 27 15:16 wget -> /usr/bin/wget
lrwxrwxrwx 1 mike mike    14 Mar 27 15:16 which -> /usr/bin/which
lrwxrwxrwx 1 mike mike    14 Mar 27 15:16 xargs -> /usr/bin/xargs
lrwxrwxrwx 1 mike mike    89 Mar 27 15:16 xxd -> /OpenWrt-NanoPi-R2S-R4S-Builds/build/openwrt/scripts/xxdi.pl

flex and m4 are installed:

$ which m4
/usr/bin/m4
$ m4 --version                                                                                                                                                                 [main]
m4 (GNU M4) 1.4.18
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Rene' Seindal.
mikegleasonjr commented 1 year ago

I was finally able to compile a version by skipping the step 07 and directly calling make in the build/openwrt folder...

anaelorlinski commented 1 year ago

Ok thanks for reporting anyway. I know that something wrong might happen with m4 soon