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

These are the steps I took to try to build the firmware:

$ git clone https://git.openwrt.org/openwrt/openwrt.git

$ git checkout v18.06.46

$ ./scripts/feeds update -a && ./scripts/feeds install -a

$ wget -O .config 'http://downloads.openwrt.org/releases/18.06.4/targets/ramips/mt7620/config.seed'

$ make defconfig

$ mkdir files/etc/config/

$ scp hplaptop:~/{firewall,network,wireless} files/etc/config/

$ IGNORE_ERRORS=1 make PROFILE=netgear_ex3700 FILES=files/ PACKAGES="ebtables ebtables-utils" -j4 V=sc

-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/cmake-3.11/Templates/TestDriver.cxx.in
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/cmake-3.11/Templates/AppleInfo.plist
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/cmake-3.11/Templates/CMakeVSMacros1.vsmacros
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/cmake-3.11/Templates/MSBuild
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/cmake-3.11/Templates/MSBuild/nasm.xml
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/cmake-3.11/Templates/MSBuild/nasm.props.in
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/cmake-3.11/Templates/MSBuild/nasm.targets
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/cmake-3.11/Templates/CPackConfig.cmake.in
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/doc/cmake-3.11/cmsys/Copyright.txt
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/doc/cmake-3.11/cmlibrhash/COPYING
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/doc/cmake-3.11/cmlibrhash/README
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/doc/cmake-3.11/cmzlib/Copyright.txt
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/doc/cmake-3.11/cmcurl/COPYING
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/doc/cmake-3.11/cmcompress/Copyright.txt
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/doc/cmake-3.11/cmliblzma/COPYING
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/doc/cmake-3.11/cmlibarchive/COPYING
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/doc/cmake-3.11/cmlibuv/LICENSE
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/bin/ccmake
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/bin/cmake
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/bin/ctest
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/bin/cpack
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/cmake-3.11/include/cmCPluginAPI.h
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/cmake-3.11/editors/vim/indent
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/cmake-3.11/editors/vim/indent/cmake.vim
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/cmake-3.11/editors/vim/syntax
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/cmake-3.11/editors/vim/syntax/cmake.vim
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/cmake-3.11/editors/emacs/cmake-mode.el
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/aclocal/cmake.m4
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/cmake-3.11/completions/cmake
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/cmake-3.11/completions/cpack
-- Installing: /home/loophole/openwrt/github/openwrt/staging_dir/host/share/cmake-3.11/completions/ctest
make[4]: Leaving directory '/home/loophole/openwrt/github/openwrt/build_dir/host/cmake-3.11.4'
mkdir -p /home/loophole/openwrt/github/openwrt/staging_dir/host/stamp
touch /home/loophole/openwrt/github/openwrt/build_dir/host/cmake-3.11.4/.built
touch /home/loophole/openwrt/github/openwrt/staging_dir/host/stamp/.cmake_installed
find /home/loophole/openwrt/github/openwrt/build_dir/host/cmake-3.11.4 -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' | xargs -r rm -rf
make[3]: Leaving directory '/home/loophole/openwrt/github/openwrt/tools/cmake'
time: tools/cmake/compile#3474.38#263.30#1451.57
make[2]: Leaving directory '/home/loophole/openwrt/github/openwrt'
make[1]: *** [tools/Makefile:150: /home/loophole/openwrt/github/openwrt/staging_dir/target-mipsel_24kc_musl/stamp/.tools_compile_yyyyyyyyynyyyyynyynnyyyynyyyyyyyyyyyyyyyn
yynynnyyynnyy] Error 2
make[1]: Leaving directory '/home/loophole/openwrt/github/openwrt'
make: *** [/home/loophole/openwrt/github/openwrt/include/toplevel.mk:218: world] Error 2
arch2 openwrt $

This is imagebuilder syntax...

Just do;

make -j1 V=s #for first build

but you don't want the full seed... before your make command... manually....

populate-.config-justpackages
make menuconfig #select your target and ebtables etc.
wget -q -O - 'http://downloads.openwrt.org/releases/18.06.4/targets/ramips/mt7620/config.seed' | \
	grep -E '(CONFIG_PACKAGE|CONFIG_VERSION)' >> .config
make defconfig
#optionally> ./scripts/diffconfig.sh > config.seed.mine
2 Likes

thank you. :slight_smile:

It didn't finish compiling again.

/usr/include/asm-generic/int-ll64.h:31:42: errors 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;
uname -a
1 Like

Linux arch2 5.3.5-arch1-1-ARCH #1 SMP PREEMPT Mon Oct 7 19:03:08 UTC 2019 x86_64 GNU/Linux

######### as root
pacman -Sy --noconfirm archlinux-keyring
pacman -Su --noconfirm --needed asciidoc bash bc binutils bzip2 fastjar flex git gcc util-linux gawk intltool zlib make cdrkit ncurses openssl patch perl-extutils-makemaker rsync unzip wget gettext libxslt boost libusb bin86 sharutils b43-fwcutter findutils time
############ not sure how up to date they are...
#EDIT -> needs 
pacman -Su --noconfirm --needed nettle gnutls python3 

############as normal user
make clean
make -j1 V=s

edit: that error in the screenshot... is something your likely to come across when the compiler / source get out of whack = version compatibility issues...

sometimes you can use an older/alternate os.... sometimes the maintainer updates the source to support newer constructs...

as it's only cropping up here... ( arch / 18 = not common )... and most of the arch guides i've found are for previous releases...

this points to the compiler versions in the newer arch maybe... but it's just a guess...

simplest thing to do tho' is to switch to debian/ubuntu...

1 Like
/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/*/openwrt-18.06.4/build_dir/host/u-boot-2018.03'
make[3]: *** [Makefile:49: /home/*/openwrt-18.06.4/build_dir/host/u-boot-2018.03/.built] Error 2
make[3]: Leaving directory '/home/*/openwrt-18.06.4/tools/mkimage'
time: tools/mkimage/compile#1.88#0.76#2.28
make[2]: *** [tools/Makefile:154: tools/mkimage/compile] Error 2
make[2]: Leaving directory '/home/*/openwrt-18.06.4'
make[1]: *** [tools/Makefile:150: /home/*/openwrt-18.06.4/staging_dir/target-mipsel_24kc_musl/stamp/.tools_compile_yynyyyyynyyyyynyynnyyyynyyyyyyyyyyyyyyynyynynnyyynnyy] Error 2
make[1]: Leaving directory '/home/*/openwrt-18.06.4'
make: *** [/home/*/openwrt-18.06.4/include/toplevel.mk:218:world]

I also encountered the same problem.:frowning:
I tried to compile openwrt 18.06.4 on manjaro, but all failed.

1 Like

Verify test a basic build with master ....

from the start with no fancy config... with fresh directory / source...

1 Like
make[5]: Entering directory '/home/*/openwrt/build_dir/host/e2fsprogs-1.45.4/e2fsck'
        MKDIR_P /home/*/openwrt/staging_dir/host/bin /home/*/openwrt/staging_dir/host/share/man/man8
make[5]: config/install-sh: Command not found
Makefile:522: recipe for target 'installdirs' failed
make[5]: *** [installdirs] Error 127
make[5]: Leaving directory '/home/*/openwrt/build_dir/host/e2fsprogs-1.45.4/e2fsck'
Makefile:434: recipe for target 'install-progs-recursive' failed
make[4]: *** [install-progs-recursive] Error 1
make[4]: Leaving directory '/home/*/openwrt/build_dir/host/e2fsprogs-1.45.4'
Makefile:53: recipe for target '/home/*/openwrt/staging_dir/host/stamp/.e2fsprogs_installed' failed
make[3]: *** [/home/*/openwrt/staging_dir/host/stamp/.e2fsprogs_installed] Error 2
make[3]: Leaving directory '/home/*/openwrt/tools/e2fsprogs'
time: tools/e2fsprogs/compile#0.13#0.02#0.15
tools/Makefile:157: recipe for target 'tools/e2fsprogs/compile' failed
make[2]: *** [tools/e2fsprogs/compile] Error 2
make[2]: Leaving directory '/home/*/openwrt'
tools/Makefile:155: recipe for target '/home/*/openwrt/staging_dir/host/stamp/.tools_compile_yynyynnyyynyyyyynyynnyyyynyyyyyyyyyyyyyyynynynnyyynnyyy' failed
make[1]: *** [/home/*/openwrt/staging_dir/host/stamp/.tools_compile_yynyynnyyynyyyyynyynnyyyynyyyyyyyyyyyyyyynynynnyyynnyyy] Error 2
make[1]: Leaving directory '/home/*/openwrt'
/home/*/openwrt/include/toplevel.mk:225: recipe for target 'world' failed
make: *** [world] Error 2

I tried to compile the openwrt master on ubuntu 18.04 and manjao, but it failed.:frowning:
Even though I only configured the routing model.

1 Like
$ sudo pacman -Su --noconfirm --needed asciidoc bash bc binutils fastjar flex git gcc util-linux gawk intltool zlib make cdrkit ncutses openssl patch perl-extutils-makemaker rsync unzip wget gettext libxslt boost libusb bin86 sharutils b43-fwcutter findutils time
warning: asciidoc-8.6.10-1 is up to date -- skipping
warning: bash-5.0.011-1 is up to date -- skipping
warning: bc-1.07.1-3 is up to date -- skipping
warning: fastjar-0.98-5 is up to date -- skipping
warning: flex-2.6.4-2 is up to date -- skipping
warning: git-2.23.0-1 is up to date -- skipping
warning: util-linux-2.34-3 is up to date -- skipping
warning: gawk-5.0.1-1 is up to date -- skipping
warning: intltool-0.51.0-4 is up to date -- skipping
warning: zlib-1:1.2.11-3 is up to date -- skipping
warning: make-4.2.1-3 is up to date -- skipping
warning: cdrtools-3.02a09-2 is up to date -- skipping
warning: ncurses-6.1-6 is up to date -- skipping
warning: openssl-1.1.1.d-1 is up to date -- skipping
warning: patch-2.7.6-7 is up to date -- skipping
warning: perl-5.30.0-3 is up to date -- skipping
warning: rsync-3.1.3-1 is up to date -- skipping
warning: unzip-6.0-13 is up to date -- skipping
warning: wget-1.20.3-2 is up to date -- skipping
warning: gettext-0.20.1-2 is up to date -- skipping
warning: libxslt-1.1.33-1 is up to date -- skipping
warning: boost-1.71.0-2 is up to date -- skipping
warning: libusb-1.0.23-1 is up to date -- skipping
warning: bin86-0.16.21-2 is up to date -- skipping
warning: sharutils-4.15.2-3 is up to date -- skipping
warning: b43-fwcutter-019-2 is up to date -- skipping
warning: findutils-4.7.0-1 is up to date -- skipping
warning: time-1.9-2 is up to date -- skipping
:: Starting full system upgrade...
resolving dependencies...
looking for conflicting packages...
error: failed to prepare transaction (could not satisfy dependencies)
:: installing x265 (3.2.1-1) breaks dependency 'libx265.so=176-64' required by ffmpeg2.8

Changed it to pacman -S instead of -Su so that it didn't try to perform a full system upgrade. It installed four packages that weren't previously installed. Unfortunately I'm getting another compile error. Looks like the same error but it seems like it's in a different spot this time.

EDIT: I think the problem may be a mismatch between the version of the kernel in memory and the version on disk:

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/tonybryantjr/openwrt/github/openwrt/build_dir/host/u-boot-2018.03'                                                      make[3]: *** [Makefile:49: /home/tonybryantjr/openwrt/github/openwrt/build_dir/host/u-boot-2018.03/.built] Error 2                                        make[3]: Leaving directory '/home/tonybryantjr/openwrt/github/openwrt/tools/mkimage'                                                                      time: tools/mkimage/compile#0.82#0.53#1.41                                   make[2]: *** [tools/Makefile:154: tools/mkimage/compile] Error 2             make[2]: Leaving directory '/home/tonybryantjr/openwrt/github/openwrt'       make[1]: *** [tools/Makefile:150: /home/tonybryantjr/openwrt/github/openwrt/staging_dir/target-mipsel_24kc_musl/stamp/.tools_compile_yynyyyyynyyyyynyynnyyyynyyyyyyyyyyyyyyynyynynnyyynnyy] Error 2                                    make[1]: Leaving directory '/home/tonybryantjr/openwrt/github/openwrt'       make: *** [/home/tonybryantjr/openwrt/github/openwrt/include/toplevel.mk:218$
arch2 openwrt $ pkgfile /usr/include/asm-generic/int-ll64.h
core/linux-api-headers
arch2 openwrt $ printf "%s" "linux-api-headers Installed " && sudo pacman -Qi linux-api-headers | grep Version && echo "Running Kernel Version: `uname -r`"
linux-api-headers Installed Version         : 5.3.1-1
Running Kernel Version: 5.3.5-arch1-1-ARCH

I'm going to reboot the machine and try to compile again.

Edit: actually, the versions are different in the repos:

arch2 openwrt $ sudo pacman -Syi linux-api-headers | grep Version
Version         : 5.3.1-1
arch2 openwrt $ sudo pacman -Si linux | grep Version
Version         : 5.3.7.arch1-2

I don't know if that has anything to do with the compile error or not.

they seem ok...

1 Like

It's weird that I'm having problems compiling this way but when I compiled with image builder it worked with no errors.

nah, image builder doesn't really compile anything... it just "packs" all the pre-compiled elements together...

2 Likes

I deleted the top-level directory and started over a few hours ago, and its still compiling. It was error'ing out after a few minutes earlier. I put the commands in a script and ran it instead of doing all the steps manually.

git clone https://git.openwrt.org/openwrt/openwrt.git
cd openwrt
git checkout v18.06.4
./scripts/feeds update -a && ./scripts/feeds install -a
wget -O .config https://downloads.openwrt.org/releases/18.06.4/targets/ramips/mt7620/config.seed
sed --in-place /CONFIG_PACKAGE_/d .config
make defconfig
echo "Press enter to start menuconfig"
read
make menuconfig
echo "Press enter to start build"
read ; cp -rv ~/openwrt/files .
make download
export IGNORE_ERRORS=1
make V=s 2>&1 | tee build.log | grep -i '[^_-"a-z]error[^_-.a-z]'
unset IGNORE_ERRORS

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