Failed to build gcc for aarch64_cortex-a53

Hi,

I'm building the master branch (commit) on Ubuntu 22.04, but got the following errors.

src/openwrt/staging_dir/host/bin/g++ -x c++    -I. -I. -I./config -DLOCALEDIR="\"/home/dev/src/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-13.2.0_musl/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I../bfd -I./../bfd -I./../include -I./../readline/readline/.. -I./../zlib -I/home/dev/src/openwrt/staging_dir/host/include -pthread -I../libdecnumber -I./../libdecnumber  -I./../gnulib/import -I../gnulib/import -I./.. -I.. -I./../libbacktrace/ -I../libbacktrace/ -DTUI=1 -I/home/dev/src/openwrt/staging_dir/host/include    -I./.. -pthread  -I/home/dev/src/openwrt/staging_dir/host/include -I/home/dev/src/openwrt/staging_dir/host/include -I/home/dev/src/openwrt/staging_dir/host/include   -Wall -Wpointer-arith -Wno-unused -Wunused-value -Wunused-variable -Wunused-function -Wno-switch -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable -Wno-sign-compare -Wno-error=maybe-uninitialized -Wno-mismatched-tags -Wsuggest-override -Wimplicit-fallthrough=3 -Wduplicated-cond -Wshadow=local -Wdeprecated-copy -Wdeprecated-copy-dtor -Wredundant-move -Wmissing-declarations -Wstrict-null-sentinel -Wformat -Wformat-nonliteral   -c -o gdb.o -MT gdb.o -MMD -MP -MF ./.deps/gdb.Tpo gdb.c
In file included from defs.h:34,
                 from gdb.c:19:
../bfd/config.h:7:4: error: #error config.h must be #included before system headers
    7 | #  error config.h must be #included before system headers
      |    ^~~~~
../bfd/config.h:330: warning: "VERSION" redefined
  330 | #define VERSION "2.41.50"
      | 
In file included from ./../gdbsupport/common-defs.h:23,
                 from defs.h:26,
                 from gdb.c:19:
./../gdbsupport/config.h:399: note: this is the location of the previous definition
  399 | #define VERSION "1.0"
      | 

Step to reproduce:

./scripts/feeds update -a && ./scripts/feeds install -a
# select MediaTek Ralink ARM & Filogic 8x0 (MT798x)
make menuconfig
make defconfig download clean world V=s -j$(nproc) 2>&1 | tee build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"

Anything I can do?

Try in a VM with a more recent Ubuntu version or latest Debian stable.

You can do "make targetclean" or "make dirclean" to clean also the toolchain, and then it will be rebuilt in the next make. your current "make clean" does not touch into toolchain.
See https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem#cleaning_up

gdb is intertwined with gcc etc., and as musl and gcc have been upgraded recently, it is best to rebuild it wholle.

3 Likes

I build for that target without problems on Ubuntu 22.04.

I usually do a full reset before building just like @hnyman advised (make dirclean), takes some extra time but saves some trouble.
After that I do:

make -j $(($(nproc)+1)) download #(-j sets number of CPU's)
make -j $(($(nproc)+1)) toolchain/install V=s 2>&1 | tee build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"
make world V=s 2>&1 | tee build.log | grep -i -E "^make.*(error|[12345]...Entering dir)"

There might be better/smarter ways but it works for me :slight_smile:

I have tried to delete the entire source directory and clone it again, it doesn't work.

cc @egc

Ah, I also tried you commands before with single-thread compilation, but got the same error.

Has been reported before: I had this problem when COMPILING it

You are using the official openwrt source?

Yes, I'm using the official source, without any extra change.

What does git remote -v say?

1 Like

What does git remote -v say?

$ git remote -v
origin  https://github.com/openwrt/openwrt.git (fetch)
origin  https://github.com/openwrt/openwrt.git (push)

$ git diff
diff --git a/feeds.conf.default b/feeds.conf.default
index fc679335e0..afa01cf060 100644
--- a/feeds.conf.default
+++ b/feeds.conf.default
@@ -1,7 +1,7 @@
-src-git packages https://git.openwrt.org/feed/packages.git
-src-git luci https://git.openwrt.org/project/luci.git
-src-git routing https://git.openwrt.org/feed/routing.git
-src-git telephony https://git.openwrt.org/feed/telephony.git
+src-git packages https://github.com/openwrt/packages.git
+src-git luci https://github.com/openwrt/luci.git
+src-git routing https://github.com/openwrt/routing.git
+src-git telephony https://github.com/openwrt/telephony.git
 #src-git video https://github.com/openwrt/video.git
 #src-git targets https://github.com/openwrt/targets.git
 #src-git oldpackages http://git.openwrt.org/packages.git

$ git log
commit a8dde7e5bd6d289db6485cf57d3512ea62eaa827 (HEAD -> main, origin/master, origin/main, origin/HEAD)

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