Toplevel.mk:230: world Error 2 (Arch Linux)

I'm using a default .config and Arch Linux for building OpenWRT firmware, but on the latest snapshot I have this strange error:

mkdir -p /mnt/sdc1/openwrt/staging_dir/host/stamp
touch /mnt/sdc1/openwrt/build_dir/host/cmake-3.22.1/.built
touch /mnt/sdc1/openwrt/staging_dir/host/stamp/.cmake_installed
make[3]: Leaving directory '/mnt/sdc1/openwrt/tools/cmake'
time: tools/cmake/compile#561.38#36.18#154.09
make[2]: Leaving directory '/mnt/sdc1/openwrt'
make[1]: *** [tools/Makefile:160: /mnt/sdc1/openwrt/staging_dir/host/stamp/.tools_compile_yyynyynnyyyynyyyyyynyynnyynyyyyyyyyyyyyyyyyyyynynyyyyyyyyy] Error 2
make[1]: Leaving directory '/mnt/sdc1/openwrt'
make: *** [/mnt/sdc1/openwrt/include/toplevel.mk:230: world] Error 2
Making install in gnu
make[5]: Entering directory '/mnt/sdc1/openwrt/build_dir/host/tar-1.34/gnu'
make  install-recursive
make[6]: Entering directory '/mnt/sdc1/openwrt/build_dir/host/tar-1.34/gnu'
make[7]: Entering directory '/mnt/sdc1/openwrt/build_dir/host/tar-1.34/gnu'
make[8]: Entering directory '/mnt/sdc1/openwrt/build_dir/host/tar-1.34/gnu'
make[8]: Nothing to be done for 'install-exec-am'.
make[8]: Nothing to be done for 'install-data-am'.
make[8]: Leaving directory '/mnt/sdc1/openwrt/build_dir/host/tar-1.34/gnu'
make[7]: Leaving directory '/mnt/sdc1/openwrt/build_dir/host/tar-1.34/gnu'
make[6]: Leaving directory '/mnt/sdc1/openwrt/build_dir/host/tar-1.34/gnu'
make[5]: Leaving directory '/mnt/sdc1/openwrt/build_dir/host/tar-1.34/gnu'
Making install in lib
make[5]: Entering directory '/mnt/sdc1/openwrt/build_dir/host/tar-1.34/lib'
make  install-am
make[5]: *** [Makefile:1593: install] Segmentation fault
make[5]: Leaving directory '/mnt/sdc1/openwrt/build_dir/host/tar-1.34/lib'
make[4]: *** [Makefile:1546: install-recursive] Error 1
make[4]: Leaving directory '/mnt/sdc1/openwrt/build_dir/host/tar-1.34'
make[3]: *** [Makefile:31: /mnt/sdc1/openwrt/staging_dir/host/stamp/.tar_installed] Error 2
make[3]: Leaving directory '/mnt/sdc1/openwrt/tools/tar'
time: tools/tar/compile#19.00#6.73#32.77
    ERROR: tools/tar failed to build.
make[2]: *** [tools/Makefile:164: tools/tar/compile] Error 1
make[2]: Leaving directory '/mnt/sdc1/openwrt'
make[1]: *** [tools/Makefile:160: /mnt/sdc1/openwrt/staging_dir/host/stamp/.tools_compile_yyynyynnyyyynyyyyyynyynnyynyyyyyyyyyyyyyyyyyyynynyyyyyyyyy] Error 2
make[1]: Leaving directory '/mnt/sdc1/openwrt'
make: *** [/mnt/sdc1/openwrt/include/toplevel.mk:230: world] Error 2

Arch Linux is known to be problematic for OpenWrt building.
Latest small was a few days ago:

But build breaking already at the host tar phase? Sounds different than the last thing fixed.

Yep.

I run fresh install openwrt and get gcc-11.2.0 errors:

/usr/bin/ld: vtable-verify.o:(.debug_info+0xd264): undefined reference to `.LASF2820'
/usr/bin/ld: vtable-verify.o:(.debug_info+0xd264): undefined reference to `.LASF2820'
collect2: error: ld returned 1 exit status
make[6]: *** [/mnt/sdc1/openwrt/build_dir/toolchain-mips_24kc_gcc-11.2.0_musl/gcc-11.2.0/gcc/lto/Make-lang.in:95: lto1] Error 1
make[6]: *** Waiting for unfinished jobs....
collect2: error: ld returned 1 exit status
make[6]: *** [/mnt/sdc1/openwrt/build_dir/toolchain-mips_24kc_gcc-11.2.0_musl/gcc-11.2.0/gcc/lto/Make-lang.in:101: lto-dump] Error 1
rm gcc.pod
make[6]: Leaving directory '/mnt/sdc1/openwrt/build_dir/toolchain-mips_24kc_gcc-11.2.0_musl/gcc-11.2.0-final/gcc'
make[5]: *** [Makefile:4433: all-gcc] Error 2
make[5]: Leaving directory '/mnt/sdc1/openwrt/build_dir/toolchain-mips_24kc_gcc-11.2.0_musl/gcc-11.2.0-final'
make[4]: *** [Makefile:962: all] Error 2
make[4]: Leaving directory '/mnt/sdc1/openwrt/build_dir/toolchain-mips_24kc_gcc-11.2.0_musl/gcc-11.2.0-final'
make[3]: *** [Makefile:91: /mnt/sdc1/openwrt/build_dir/toolchain-mips_24kc_gcc-11.2.0_musl/gcc-11.2.0-final/.built] Error 2
make[3]: Leaving directory '/mnt/sdc1/openwrt/toolchain/gcc/final'
time: toolchain/gcc/final/compile#785.88#55.96#426.46
    ERROR: toolchain/gcc/final failed to build.
make[2]: *** [toolchain/Makefile:97: toolchain/gcc/final/compile] Error 1
make[2]: Leaving directory '/mnt/sdc1/openwrt'
make[1]: *** [toolchain/Makefile:93: /mnt/sdc1/openwrt/staging_dir/toolchain-mips_24kc_gcc-11.2.0_musl/stamp/.toolchain_compile] Error 2
make[1]: Leaving directory '/mnt/sdc1/openwrt'
make: *** [/mnt/sdc1/openwrt/include/toplevel.mk:230: world] Error 2

Nope.
This time you get errors much later. "tools" (including tar) should have already been built before "toolchain" including gcc gets built.
Strange.

You are likely building multi-threaded (with -j x") and that destroys proper error log views to some extent.

Like said, Arch Linux has been problematic. You might try the a virtual machine with Ubuntu, Debian, something.

gcc can work systems hard. I had a PC where I could run the OS happily for days, but trying to build Linux on it would trip seg faults. I don't recall if I eventually found a memory error with memtest as well.

If you can easily build prior versions it may rule out hardware niggles, but pulling any memory, GPU cards, etc and reseating them may be worth a try.

It's really strange cuz on Slackware is the same error:

[511/960] Building C object Source/CursesDialog/form/CMakeFiles/cmForm.dir/fld_arg.c.o
[512/960] Building C object Source/CursesDialog/form/CMakeFiles/cmForm.dir/fld_attr.c.o
[513/960] Building C object Source/CursesDialog/form/CMakeFiles/cmForm.dir/fld_current.c.o
[514/960] Building C object Source/CursesDialog/form/CMakeFiles/cmForm.dir/fld_def.c.o
[515/960] Building C object Source/CursesDialog/form/CMakeFiles/cmForm.dir/fld_dup.c.o
[516/960] Building C object Source/CursesDialog/form/CMakeFiles/cmForm.dir/fld_ftchoice.c.o
[517/960] Building C object Source/CursesDialog/form/CMakeFiles/cmForm.dir/fld_ftlink.c.o
FAILED: Source/CursesDialog/form/CMakeFiles/cmForm.dir/fld_ftlink.c.o 
/mnt/sdc1/openwrt/staging_dir/host/bin/gcc -DLIBARCHIVE_STATIC -I/mnt/sdc1/openwrt/build_dir/host/cmake-3.22.1/Source/CursesDialog/form -isystem /mnt/sdc1/openwrt/build_dir/host/cmake-3.22.1/Utilities/std -isystem /mnt/sdc1/openwrt/build_dir/host/cmake-3.22.1/Utilities -O2 -I/mnt/sdc1/openwrt/staging_dir/host/include -w -O3 -DNDEBUG -std=gnu11 -MD -MT Source/CursesDialog/form/CMakeFiles/cmForm.dir/fld_ftlink.c.o -MF Source/CursesDialog/form/CMakeFiles/cmForm.dir/fld_ftlink.c.o.d -o Source/CursesDialog/form/CMakeFiles/cmForm.dir/fld_ftlink.c.o -c /mnt/sdc1/openwrt/build_dir/host/cmake-3.22.1/Source/CursesDialog/form/fld_ftlink.c
malloc(): invalid next size (unsorted)
In file included from /mnt/sdc1/openwrt/staging_dir/host/include/endian.h:6,
                 from /usr/include/sys/types.h:176,
                 from /usr/include/stdlib.h:394,
                 from /mnt/sdc1/openwrt/build_dir/host/cmake-3.22.1/Source/CursesDialog/form/mf_common.h:39,
                 from /mnt/sdc1/openwrt/build_dir/host/cmake-3.22.1/Source/CursesDialog/form/form.priv.h:33,
                 from /mnt/sdc1/openwrt/build_dir/host/cmake-3.22.1/Source/CursesDialog/form/fld_ftlink.c:33:
/usr/include/endian.h:1: internal compiler error: Aborted
    1 | /* Copyright (C) 1992-2021 Free Software Foundation, Inc.
      | 
0x15a1707 internal_error(char const*, ...)
	???:0
0x7f90a3f60848 __GI_raise
	???:0
0x7f90a3f47525 __GI_abort
	???:0
0x7f90a3fa6247 __libc_message
	???:0
0x7f90a3fae669 malloc_printerr
	???:0
0x7f90a3fb178b _int_malloc
	???:0
0x7f90a3fb4da0 calloc
	???:0
0x160d284 xcalloc
	???:0
0x1608cd2 htab_find_slot_with_hash
	???:0
0x15c2230 _cpp_find_file
	???:0
0x15c2df9 _cpp_stack_include
	???:0
0x15bae48 _cpp_handle_directive
	???:0
0x15c9a08 _cpp_lex_token
	???:0
0x6f17de c_lex_with_flags(tree_node**, unsigned int*, unsigned char*, int)
	???:0
0x6ab64c c_parse_file()
	???:0
0x6f9fed c_common_parse_file()
	???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
ninja: build stopped: subcommand failed.
make[3]: *** [Makefile:52: /mnt/sdc1/openwrt/build_dir/host/cmake-3.22.1/.built] Error 1
make[3]: Leaving directory '/mnt/sdc1/openwrt/tools/cmake'
time: tools/cmake/compile#331.91#34.97#174.21
    ERROR: tools/cmake failed to build.
make[2]: *** [tools/Makefile:164: tools/cmake/compile] Error 1
make[2]: Leaving directory '/mnt/sdc1/openwrt'
make[1]: *** [tools/Makefile:160: /mnt/sdc1/openwrt/staging_dir/host/stamp/.tools_compile_yyynyynnyyyynyyyyyynyynnyynyyyyyyyyyyyyyyyyyyynynyyyyyyyyy] Error 2
make[1]: Leaving directory '/mnt/sdc1/openwrt'
make: *** [/mnt/sdc1/openwrt/include/toplevel.mk:230: world] Error 2
# gcc --version | head -n1
gcc (GCC) 11.2.0

Internal compiler errors (ICE) are compiler bugs, not issues with the source to be compiled.

Reasons may include, pre-release version, hotfixes not applied, etc.

Is this not an issue with cmake-3.22.1?

Not likely. I have rebuilt from scratch (also tools & toolchain) after that change. With Ubuntu as host.

(and cmake is only used for a few packages, it is not used for most of the compilation tasks)

Set this env is slove this issue.
set FORCE_UNSAFE_CONFIGURE=1

1 Like

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