[Solved] Build error: "make: [toplevel.mk:218: world] Error 2"?

Don’t use config.seed “raw” as it builds “everything”. Clear out .config, select your board, then add the specific packages/options you want.

Edit:

sed --in-place /CONFIG_PACKAGE_/d .config

doesn’t look right to me

Edit: See above post for how to strip out the “important” things from config.seed - populate-.config-justpackages - remember to select your board!

With the exception of a LuCI package group, you’ll basically get what is in a “release” build for your board by just selecting the board.

I’d suggest enabling ccache as it will speed subsequent builds. The first-time build takes around an hour on a “lowly” J4105. Subsequent builds are 5-15 with ccache.

2 Likes

Thanks. I didn't realize it was building everything. I started over and didn't download config.seed this time. I just selected my board, the packages I want and enabled ccache.

It's been compiling for about an hour. The build directory is only about 1.3 GB right now. I had to kill the last build after I realized it was building everything. The build directory was already over 11 GB when I killed it.

That is almost about the size you'll get for any 'normal' build tree, without that many optional features; a full build would be more than an order of magnitude beyond that.

It's possible that I used Ubuntu 18.04 in a container and actually used the manjaro kernel. When I go home at night, I will try to use real Ubuntu 18.04 in the KVM virtual machine, which allows me to use it. The old kernel of Ubuntu 18.04.
It seems that the ArchLinux user has failed to compile. I have a hunch that this may be because the ArchLinux kernel is too new.

The solution for me was to remove line number 69 in the file

openwrt/build_dir/host/u-boot-2018.03/include/compiler.h

typedef uint64_t __u64;

and then run make again.

1 Like

I found out that people mentioned this in another topic. It seems that the solution is to delete the typedef uint64_t __u64;
https://forum.openwrt.org/t/compile-error-19-07/44423/7

1 Like

It seems that there are still some errors.

make -j1 V=s            

make[1]: Entering directory '/home/*/openwrt-18.06.4'
make[2]: Entering directory '/home/*/openwrt-18.06.4'
+ mkdir -p /home/*/openwrt-18.06.4/staging_dir/target-mipsel_24kc_musl
+ cd /home/*/openwrt-18.06.4/staging_dir/target-mipsel_24kc_musl
+ mkdir -p bin lib include stamp
mkdir -p /home/*/openwrt-18.06.4/build_dir/target-mipsel_24kc_musl/stamp
touch /home/*/openwrt-18.06.4/staging_dir/target-mipsel_24kc_musl/.prepared
make[3]: Entering directory '/home/*/openwrt-18.06.4/toolchain/gdb'
CFLAGS="-O2 -I/home/*/openwrt-18.06.4/staging_dir/host/include " CPPFLAGS="-I/home/*/openwrt-18.06.4/staging_dir/host/include " CXXFLAGS="" LDFLAGS="-L/home/*/openwrt-18.06.4/staging_dir/host/lib " make  -C /home/*/openwrt-18.06.4/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/gdb-8.0.1  
make[4]: Entering directory '/home/*/openwrt-18.06.4/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/gdb-8.0.1'
make[5]: Entering directory '/home/*/openwrt-18.06.4/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/gdb-8.0.1'
make[6]: Entering directory '/home/*/openwrt-18.06.4/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/gdb-8.0.1/libiberty'
if [ x"" != x ]; then \
  gcc -c -DHAVE_CONFIG_H -O2 -I/home/*/openwrt-18.06.4/staging_dir/host/include  -I/home/*/openwrt-18.06.4/staging_dir/host/include  -I. -I./../include  -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -pedantic  -D_GNU_SOURCE  ./fibheap.c -o pic/fibheap.o; \
else true; fi
if [ x"" != x ]; then \
  gcc -c -DHAVE_CONFIG_H -O2 -I/home/*/openwrt-18.06.4/staging_dir/host/include  -I/home/*/openwrt-18.06.4/staging_dir/host/include  -I. -I./../include  -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -pedantic  -D_GNU_SOURCE   ./fibheap.c -o noasan/fibheap.o; \
else true; fi
gcc -c -DHAVE_CONFIG_H -O2 -I/home/*/openwrt-18.06.4/staging_dir/host/include  -I/home/*/openwrt-18.06.4/staging_dir/host/include  -I. -I./../include  -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -Wshadow=local -pedantic  -D_GNU_SOURCE ./fibheap.c -o fibheap.o
./fibheap.c: In function 'fibheap_replace_key_data':
./fibheap.c:38:24: error: 'LONG_MIN' undeclared (first use in this function)
   38 | #define FIBHEAPKEY_MIN LONG_MIN
      |                        ^~~~~~~~
./fibheap.c:220:30: note: in expansion of macro 'FIBHEAPKEY_MIN'
  220 |   if (okey == key && okey != FIBHEAPKEY_MIN)
      |                              ^~~~~~~~~~~~~~
./fibheap.c:36:1: note: 'LONG_MIN' is defined in header '<limits.h>'; did you forget to '#include <limits.h>'?
   35 | #include "fibheap.h"
  +++ |+#include <limits.h>
   36 | 
./fibheap.c:38:24: note: each undeclared identifier is reported only once for each function it appears in
   38 | #define FIBHEAPKEY_MIN LONG_MIN
      |                        ^~~~~~~~
./fibheap.c:220:30: note: in expansion of macro 'FIBHEAPKEY_MIN'
  220 |   if (okey == key && okey != FIBHEAPKEY_MIN)
      |                              ^~~~~~~~~~~~~~
./fibheap.c: In function 'fibheap_delete_node':
./fibheap.c:38:24: error: 'LONG_MIN' undeclared (first use in this function)
   38 | #define FIBHEAPKEY_MIN LONG_MIN
      |                        ^~~~~~~~
./fibheap.c:261:36: note: in expansion of macro 'FIBHEAPKEY_MIN'
  261 |   fibheap_replace_key (heap, node, FIBHEAPKEY_MIN);
      |                                    ^~~~~~~~~~~~~~
./fibheap.c:38:24: note: 'LONG_MIN' is defined in header '<limits.h>'; did you forget to '#include <limits.h>'?
   38 | #define FIBHEAPKEY_MIN LONG_MIN
      |                        ^~~~~~~~
./fibheap.c:261:36: note: in expansion of macro 'FIBHEAPKEY_MIN'
  261 |   fibheap_replace_key (heap, node, FIBHEAPKEY_MIN);
      |                                    ^~~~~~~~~~~~~~
make[6]: *** [Makefile:754: fibheap.o] Error 1
make[6]: Leaving directory '/home/*/openwrt-18.06.4/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/gdb-8.0.1/libiberty'
make[5]: *** [Makefile:7041: all-libiberty] Error 2
make[5]: Leaving directory '/home/*/openwrt-18.06.4/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/gdb-8.0.1'
make[4]: *** [Makefile:851: all] Error 2
make[4]: Leaving directory '/home/*/openwrt-18.06.4/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/gdb-8.0.1'
make[3]: *** [Makefile:69: /home/*/openwrt-18.06.4/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/gdb-8.0.1/.built] Error 2
make[3]: Leaving directory '/home/*/openwrt-18.06.4/toolchain/gdb'
time: toolchain/gdb/compile#0.12#0.02#0.14
make[2]: *** [toolchain/Makefile:100: toolchain/gdb/compile] Error 2
make[2]: Leaving directory '/home/*/openwrt-18.06.4'
make[1]: *** [toolchain/Makefile:96: /home/*/openwrt-18.06.4/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/stamp/.toolchain_compile] Error 2
make[1]: Leaving directory '/home/*/openwrt-18.06.4'
make: *** [/home/*/openwrt-18.06.4/include/toplevel.mk:218: world] Error 2

Mine is still compiling and I haven't seen any more errors yet. Can you check to see if you have this file:

openwrt/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/gcc-7.3.0/gcc/glimits.h

It looks like that file defines LONG_MIN on line 94.

make -j24 V=s

It seems that the performance of the R9 3900X is really strong enough, but I have already gone to work, and it may take at night to continue compiling.:grin:

I'm getting more errors now.


...

openwrt/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/musl-1.1.19/src/complex/csqrt.c:89: undefined reference to `__muldf3'

openwrt/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/musl-1.1.19/src/internal/floatscan.c:421: undefined reference to `__floatsidf'

openwrt/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/musl-1.1.19/src/math/__rem_pio2.c:133: undefined reference to `__subdf3'

...

collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:164: lib/libc.so] Error 1
make[4]: Leaving directory '/home/loophole/openwrt/github/openwrt/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/musl-1.1.19'
make[3]: *** [Makefile:32: /home/loophole/openwrt/github/openwrt/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/musl-1.1.19/.built] Error 2
make[3]: Leaving directory '/home/loophole/openwrt/github/openwrt/toolchain/musl'                                                                                 time: toolchain/musl/compile#239.18#104.30#308.43
make[2]: *** [toolchain/Makefile:100: toolchain/musl/compile] Error 2
make[2]: Leaving directory '/home/loophole/openwrt/github/openwrt'
make[1]: *** [toolchain/Makefile:96: /home/loophole/openwrt/github/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/stamp/.toolchain_compile] Error 2
make[1]: Leaving directory '/home/loophole/openwrt/github/openwrt'
make: *** [/home/loophole/openwrt/github/openwrt/include/toplevel.mk:218: world] Error 2

So, i've ran some tests with arch5.1/gcc-9.2.0;

  1. master/gcc-8.3.0 ... for x64/mips24k [ok]
  2. v18.06.4/gcc-7.3.0 mips24-pistaccio [ok]
  3. v18.06.4/gcc-7.3.0 mips24-ramips_mt7620 [fail] interesting...
dodgy-workaround

-seems the wireless-regdb Makefile references src which is python2 but arch wants to use python3 ( maybe because i didn't "make distclean" after checking out v18... ) workaround by changing "python" to "python2.7" in /home/osboxes/openwrt/package/firmware/wireless-regdb/Makefile
also installed...
pacman -Sy python2
pacman -Sy python-pip
pacman -Sy python2-pytools

Note: a better fix is just to use a new src in the Makefile / find the patch that updated it to python3...

But I did not see errors similar to yours... [OK]

Narrowing down.... your issue seems related to;

  1. arch5.3/gcc?/prereq/tmux/shell/fs/path etc. etc.
  2. possibly the target makefiles require an old uboot / or similar? or some other target>src specific bug
  3. your build procedure
  4. your source state ( clean/distclean )

( in other words cutting edge OS and not so cutting edge source and/or related complications, for aging source things go much smoother using an OS/environment from the equivalent era or thereabouts )

1 Like

I removed the line "sloppiness = file_macro,locale,time_macros" from ~/.ccache/ccache.conf and make started working again.

I forgot to post this part of the log that clued me in on ccache because I had stdout and stderr going to different terminals:

ccache: error: /home/tonybryantjr/.ccache/ccache.conf:2: unknown sloppiness: "locale"
ccache: error: /home/tonybryantjr/.ccache/ccache.conf:2: unknown sloppiness: "locale"
ccache: error: /home/tonybryantjr/.ccache/ccache.conf:2: unknown sloppiness: "locale"
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:164: lib/libc.so] Error 1
make[3]: *** [Makefile:32: /home/tonybryantjr/openwrt/github/openwrt/build_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/musl-1.1.19/.built] Error 2
make[2]: *** [toolchain/Makefile:100: toolchain/musl/compile] Error 2
make[1]: *** [toolchain/Makefile:96: /home/tonybryantjr/openwrt/github/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-7.3.0_musl/stamp/.toolchain_compile] Error 2
1 Like

The build completed this time. As a recap, I had two issues during the build that required me to edit a couple files. I'm putting those two edits below for quick access in case anyone runs into this problem in the future.

Remove line number 69 in the file:

openwrt/build_dir/host/u-boot-2018.03/include/compiler.h

typedef uint64_t __u64;

and I had to remove this line from

~/.ccache/ccache.conf

"sloppiness = file_macro,locale,time_macros"

Directory listing after make finished:

arch2 openwrt $ ls -R bin/targets/ramips/mt7620/
bin/targets/ramips/mt7620/:
config.seed
openwrt-ramips-mt7620-device-ex3700-ex3800.manifest
openwrt-ramips-mt7620-ex3700-ex3800-squashfs-factory.chk
openwrt-ramips-mt7620-ex3700-ex3800-squashfs-sysupgrade.bin
packages
sha256sums

bin/targets/ramips/mt7620/packages:
base-files_194.2-r7808-ef686b7292_mipsel_24kc.ipk
fstools_2019-03-28-ff1ded63-5_mipsel_24kc.ipk
fwtool_1_mipsel_24kc.ipk
ip6tables_1.6.2-1_mipsel_24kc.ipk
iptables_1.6.2-1_mipsel_24kc.ipk
iwinfo_2018-07-31-65b8333f-1_mipsel_24kc.ipk
kernel_4.14.131-1-08bfb2457bc0f6cefd1e86fde4ae52e3_mipsel_24kc.ipk
kmod-cfg80211_4.14.131+2017-11-01-10_mipsel_24kc.ipk
kmod-ebtables_4.14.131-1_mipsel_24kc.ipk
kmod-eeprom-93cx6_4.14.131-1_mipsel_24kc.ipk
kmod-gpio-button-hotplug_4.14.131-2_mipsel_24kc.ipk
kmod-ip6tables_4.14.131-1_mipsel_24kc.ipk
kmod-ipt-conntrack_4.14.131-1_mipsel_24kc.ipk
kmod-ipt-core_4.14.131-1_mipsel_24kc.ipk
kmod-ipt-nat_4.14.131-1_mipsel_24kc.ipk
kmod-ipt-offload_4.14.131-1_mipsel_24kc.ipk
kmod-leds-gpio_4.14.131-1_mipsel_24kc.ipk
kmod-lib-crc-ccitt_4.14.131-1_mipsel_24kc.ipk
kmod-lib-crc-itu-t_4.14.131-1_mipsel_24kc.ipk
kmod-mac80211_4.14.131+2017-11-01-10_mipsel_24kc.ipk
kmod-mt76-core_4.14.131+2019-03-23-a5f5605f-1_mipsel_24kc.ipk
kmod-mt76x02-common_4.14.131+2019-03-23-a5f5605f-1_mipsel_24kc.ipk
kmod-mt76x2_4.14.131+2019-03-23-a5f5605f-1_mipsel_24kc.ipk
kmod-mt76x2-common_4.14.131+2019-03-23-a5f5605f-1_mipsel_24kc.ipk
kmod-nf-conntrack_4.14.131-1_mipsel_24kc.ipk
kmod-nf-conntrack6_4.14.131-1_mipsel_24kc.ipk
kmod-nf-flow_4.14.131-1_mipsel_24kc.ipk
kmod-nf-ipt_4.14.131-1_mipsel_24kc.ipk
kmod-nf-ipt6_4.14.131-1_mipsel_24kc.ipk
kmod-nf-nat_4.14.131-1_mipsel_24kc.ipk
kmod-nf-reject_4.14.131-1_mipsel_24kc.ipk
kmod-nf-reject6_4.14.131-1_mipsel_24kc.ipk
kmod-ppp_4.14.131-1_mipsel_24kc.ipk
kmod-pppoe_4.14.131-1_mipsel_24kc.ipk
kmod-pppox_4.14.131-1_mipsel_24kc.ipk
kmod-rt2800-lib_4.14.131+2017-11-01-10_mipsel_24kc.ipk
kmod-rt2800-mmio_4.14.131+2017-11-01-10_mipsel_24kc.ipk
kmod-rt2800-pci_4.14.131+2017-11-01-10_mipsel_24kc.ipk
kmod-rt2800-soc_4.14.131+2017-11-01-10_mipsel_24kc.ipk
kmod-rt2x00-lib_4.14.131+2017-11-01-10_mipsel_24kc.ipk
kmod-rt2x00-mmio_4.14.131+2017-11-01-10_mipsel_24kc.ipk
kmod-rt2x00-pci_4.14.131+2017-11-01-10_mipsel_24kc.ipk
kmod-slhc_4.14.131-1_mipsel_24kc.ipk
libc_1.1.19-1_mipsel_24kc.ipk
libgcc_7.3.0-1_mipsel_24kc.ipk
libip4tc_1.6.2-1_mipsel_24kc.ipk
libip6tc_1.6.2-1_mipsel_24kc.ipk
libiwinfo_2018-07-31-65b8333f-1_mipsel_24kc.ipk
libpthread_1.1.19-1_mipsel_24kc.ipk
libxtables_1.6.2-1_mipsel_24kc.ipk
mtd_23_mipsel_24kc.ipk
Packages
Packages.gz
Packages.manifest
Packages.sig
1 Like

You are right. It seems that my network has a problem and the package cannot be downloaded. The master repository seems to have no problem, but the 18.06.4 version seems to have some compatibility problems with the compiler.:grinning:

normal compilation

not root user:

make folder
cd folder
git clone https://git.openwrt.org/openwrt/openwrt.git
cd openwrt
scripts/feeds update -a
scripts/feeds install -a

make menuconfig
choice platform … kmod … luci ...
save ( write a .config file with your configuration)

make -j4

Help me

make[4]: Entering directory '/home/server/openwrt/build_dir/target-mips_24kc_musl/automake-1.15'
: && /bin/mkdir -p doc && { PATH='/home/server/openwrt/build_dir/target-mips_24kc_musl/automake-1.15/t/wrap:'$PATH && export PATH; } && /home/server/openwrt/staging_dir/host/bin/perl ./doc/help2man --output=doc/automake-1.15.1 automake-1.15
help2man: can't get `--help' info from automake-1.15
Try `--no-discard-stderr' if option outputs to stderr
Makefile:3687: recipe for target 'doc/automake-1.15.1' failed
make[4]: *** [doc/automake-1.15.1] Error 255
make[4]: Leaving directory '/home/server/openwrt/build_dir/target-mips_24kc_musl/automake-1.15'
Makefile:65: recipe for target '/home/server/openwrt/build_dir/target-mips_24kc_musl/automake-1.15/.built' failed
make[3]: *** [/home/server/openwrt/build_dir/target-mips_24kc_musl/automake-1.15/.built] Error 2
make[3]: Leaving directory '/home/server/openwrt/feeds/packages/devel/automake'
time: package/feeds/packages/automake/compile#0.31#0.07#0.39
package/Makefile:107: recipe for target 'package/feeds/packages/automake/compile' failed
make[2]: *** [package/feeds/packages/automake/compile] Error 2
make[2]: Leaving directory '/home/server/openwrt'
package/Makefile:103: recipe for target '/home/server/openwrt/staging_dir/target-mips_24kc_musl/stamp/.package_compile' failed
make[1]: *** [/home/server/openwrt/staging_dir/target-mips_24kc_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/server/openwrt'
/home/server/openwrt/include/toplevel.mk:216: recipe for target 'world' failed
make: *** [world] Error 2

best to create a new thread "make fail 18 mipsXYZ arch" etc. etc. and link to this one...

include the exact commands / steps you have used...

your issues appear to be related to general setup / buildroot workflow ( albeit complicated by some os/target specific fixes herein )

1 Like

thank you for replying I am currently creating all IPK files using Buildrot and selecting this option in the global build settings, my question is should I not choose the buildrot option when I make all ipk files?

I think buildroot has to be enabled to build anything, but I'm not sure. I didn't touch that option in the menu so I'd leave it at it's default value unless you have a reason to change it.

Edit: I think you may have been referring to buildbot. I don't know much about that, either, but I'd suggest leaving that at it's default value as well unless you have a reason to change it.

It might be a version issue. I would do an update and upgrade with your package manager and try again.

Here's a thread about the Error 255:

Building automake in current master fails with help2man error

Someone on this thread suggests the installed version of automake may be outdated:

https://issm.ess.uci.edu/forum/d/201-autotools-help2man-can-t-get-help-info-from-automake-1-14/2

1 Like