[Help] [External toolchain] How to properly set external toolchain

Hi I am trying to build the firmware for RPI3B with external toolchain. I have configured the toolchain as shown in the picture.

Then I run make -j4 command. The compilation stopped at libnl-tiny package. When I run again with -j1 V=s option, the following error is shown.

Package libnl-tiny is missing dependencies for the following libraries:
libc.so.6
make[2]: *** [Makefile:57: /home/nayab/openwrt/bin/packages/aarch64_cortex-a53/base/libnl-tiny_2019-10-29-0219008c-1_aarch64_cortex-a53.ipk] Error 1
make[2]: Leaving directory '/home/nayab/openwrt/package/libs/libnl-tiny'
time: package/libs/libnl-tiny/compile#2.04#0.49#2.39
make[1]: *** [package/Makefile:113: package/libs/libnl-tiny/compile] Error 2
make[1]: Leaving directory '/home/nayab/openwrt'
make: *** [/home/nayab/openwrt/include/toplevel.mk:220: package/libnl-tiny/compile] Error 2

Here is my toolchain directory tree.

$ tree -L 2 ~/x-tools/aarch64-rpi3-linux-gnu/
/home/nayab/x-tools/aarch64-rpi3-linux-gnu/
├── aarch64-rpi3-linux-gnu
│   ├── bin
│   ├── debug-root
│   ├── include
│   ├── lib
│   ├── lib64
│   └── sysroot
├── bin
│   ├── aarch64-rpi3-linux-gnu-addr2line
│   ├── aarch64-rpi3-linux-gnu-ar
│   ├── aarch64-rpi3-linux-gnu-as
│   ├── aarch64-rpi3-linux-gnu-c++
│   ├── aarch64-rpi3-linux-gnu-cc -> aarch64-rpi3-linux-gnu-gcc
│   ├── aarch64-rpi3-linux-gnu-c++filt
│   ├── aarch64-rpi3-linux-gnu-cpp
│   ├── aarch64-rpi3-linux-gnu-ct-ng.config
│   ├── aarch64-rpi3-linux-gnu-dwp
│   ├── aarch64-rpi3-linux-gnu-elfedit
│   ├── aarch64-rpi3-linux-gnu-g++
│   ├── aarch64-rpi3-linux-gnu-gcc
│   ├── aarch64-rpi3-linux-gnu-gcc-9.2.0
│   ├── aarch64-rpi3-linux-gnu-gcc-ar
│   ├── aarch64-rpi3-linux-gnu-gcc-nm
│   ├── aarch64-rpi3-linux-gnu-gcc-ranlib
│   ├── aarch64-rpi3-linux-gnu-gcov
│   ├── aarch64-rpi3-linux-gnu-gcov-dump
│   ├── aarch64-rpi3-linux-gnu-gcov-tool
│   ├── aarch64-rpi3-linux-gnu-gdb
│   ├── aarch64-rpi3-linux-gnu-gdb-add-index
│   ├── aarch64-rpi3-linux-gnu-gprof
│   ├── aarch64-rpi3-linux-gnu-ld
│   ├── aarch64-rpi3-linux-gnu-ld.bfd
│   ├── aarch64-rpi3-linux-gnu-ldd
│   ├── aarch64-rpi3-linux-gnu-ld.gold
│   ├── aarch64-rpi3-linux-gnu-nm
│   ├── aarch64-rpi3-linux-gnu-objcopy
│   ├── aarch64-rpi3-linux-gnu-objdump
│   ├── aarch64-rpi3-linux-gnu-populate
│   ├── aarch64-rpi3-linux-gnu-ranlib
│   ├── aarch64-rpi3-linux-gnu-readelf
│   ├── aarch64-rpi3-linux-gnu-size
│   ├── aarch64-rpi3-linux-gnu-strings
│   └── aarch64-rpi3-linux-gnu-strip
├── build.log.bz2
├── include
├── lib
│   ├── bfd-plugins
│   ├── gcc
│   ├── ldscripts
│   ├── libcc1.so -> libcc1.so.0.0.0
│   ├── libcc1.so.0 -> libcc1.so.0.0.0
│   └── libcc1.so.0.0.0
├── libexec
│   └── gcc
└── share
    ├── gcc-9.2.0
    ├── gdb
    └── licenses

19 directories, 39 files

Is the configuration correct? Do I need to configure anything else to make the build success?

Thanks in advance.

1 Like

Hi,
as per the error, libc.so.6 is missing from your toolchain.

I'm not sure which branch you are working with but this was definitely an issue on 17.01 a couple of years back for toolchains built using OpenWRT (and was fixed on master at the time). The thread I'm referring to is here:

If you're getting that toolchain from another source, make sure to get libc.so.6 in there.

Hi @VincentR,

Thanks for the replay.

The libc.so.6 is already present in the toolchain

$ find ~/x-tools/aarch64-rpi3-linux-gnu/aarch64-rpi3-linux-gnu/ -name libc.so*
/home/nayab/x-tools/aarch64-rpi3-linux-gnu/aarch64-rpi3-linux-gnu/sysroot/lib/libc.so.6
/home/nayab/x-tools/aarch64-rpi3-linux-gnu/aarch64-rpi3-linux-gnu/sysroot/usr/lib/libc.so

I cloned the OpenWrt from github. The latest commit id is b1604b744b716a592841757c43bc5156c7772aca on March 24th, 2020.

I am not sure how to check current tag as git branch always shows * master. The patch mentioned in the earlier thread is already available in package/libs/toolchain/Makefile.

But this time I am unable to cross the Linux compile also.

make[5]: Entering directory '/home/nayab/openwrt/build_dir/target-aarch64-rpi3-linux-gnu_glibc/linux-bcm27xx_bcm2710/linux-5.4.42'
  CC      scripts/mod/devicetable-offsets.s
In file included from scripts/mod/devicetable-offsets.c:3:
./include/linux/mod_devicetable.h:349:48: error: 'BITS_PER_LONG' undeclared here (not in a function)
  349 |  kernel_ulong_t evbit[INPUT_DEVICE_ID_EV_MAX / BITS_PER_LONG + 1];
      |                                                ^~~~~~~~~~~~~
./include/linux/mod_devicetable.h:807:2: error: unknown type name 'uuid_t'
  807 |  uuid_t uuid;
      |  ^~~~~~
./include/linux/mod_devicetable.h:820:25: error: 'UUID_STRING_LEN' undeclared here (not in a function)
  820 |  const char guid_string[UUID_STRING_LEN+1];
      |                         ^~~~~~~~~~~~~~~

Do I need to configure anything related to Linux in the toolchain?

1 Like

do you remember what the issue was with the kernel? I've run into the same problem where I'm unable to compile it, getting the exact same build error