OpenWrt Toolchains

Hello,

I've downloaded the sources for OpenWRT and successfully compiled it on a Cent OS 7 host. How do I compile the toolchains? I'm reading that it get's compiled as part of OpenWRT compilation but I'm not seeing it anywhere in the folders.

Ty,

Toolchain builds happen in build_dir/toolchain*, and build results are staged in staging_dir/toolchain*. To package it as a sdk archive, you have to enable sdk build by selecting CONFIG_SDK=y

Thx!

Had a check but hmm. Doesn't look like the standard build compiled it:

[root@dd-wrt01 target-arm_cortex-a9_musl_eabi]# cd bin
[root@dd-wrt01 bin]# ls
[root@dd-wrt01 bin]# ls -altri
total 4
134765380 drwxr-xr-x.  2 openwrt openwrt    6 Jul 15 23:57 .
478283397 drwxr-xr-x. 11 openwrt openwrt 4096 Jul 17 00:25 ..
[root@dd-wrt01 bin]# pwd
/openwrt/staging_dir/target-arm_cortex-a9_musl_eabi/bin
[root@dd-wrt01 bin]#

Missing something very fundamental it seems?

Yes. staging_dir/toolchain-... vs. staging_dir/target-...

1 Like

Yep. So I saw that folder earlier but wondered about the version:

566378038 lrwxrwxrwx.  1 openwrt openwrt      37 Jul 17 00:19 arm-openwrt-linux-objdump -> arm-openwrt-linux-muslgnueabi-objdump
566378039 lrwxrwxrwx.  1 openwrt openwrt      36 Jul 17 00:19 arm-openwrt-linux-ranlib -> arm-openwrt-linux-muslgnueabi-ranlib
566378040 lrwxrwxrwx.  1 openwrt openwrt      37 Jul 17 00:19 arm-openwrt-linux-readelf -> arm-openwrt-linux-muslgnueabi-readelf
566378041 lrwxrwxrwx.  1 openwrt openwrt      34 Jul 17 00:19 arm-openwrt-linux-size -> arm-openwrt-linux-muslgnueabi-size
566378043 lrwxrwxrwx.  1 openwrt openwrt      37 Jul 17 00:19 arm-openwrt-linux-strings -> arm-openwrt-linux-muslgnueabi-strings
566378044 lrwxrwxrwx.  1 openwrt openwrt      35 Jul 17 00:19 arm-openwrt-linux-strip -> arm-openwrt-linux-muslgnueabi-strip
576204989 drwxr-xr-x.  2 openwrt openwrt    4096 Jul 17 00:19 .
478283392 drwxr-xr-x. 11 openwrt openwrt    4096 Jul 24 01:05 ..
[root@dd-wrt01 bin]#
[root@dd-wrt01 bin]#
[root@dd-wrt01 bin]#
[root@dd-wrt01 bin]# pwd
/openwrt/staging_dir/toolchain-arm_cortex-a9_gcc-7.5.0_musl_eabi/bin
[root@dd-wrt01 bin]#

Shouldn't this be toolchains version 10 or higher vs 7.5.0 or does that mean something else altogether? Looking around earlier, I'm seeing folks using version 10.

root@DD-WRT:~# cat /proc/version
Linux version 4.4.228 (root@linux) (gcc version 10.0.1 (OpenWrt GCC 10.0.1 r12423-0493d57e04) ) #380 SMP Tue Jun 23 08:47:04 +04 2020
root@DD-WRT:~#

This one is:

[root@dd-wrt01 bin]# ./arm-openwrt-linux-c++ --version
arm-openwrt-linux-c++ (OpenWrt GCC 7.5.0 r11063-85e04e9f46) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@dd-wrt01 bin]# pwd
/openwrt/staging_dir/toolchain-arm_cortex-a9_gcc-7.5.0_musl_eabi/bin
[root@dd-wrt01 bin]#

How do I get the latest toolchains version then?

Thx,
TK

make menuconfig -> [*] Advanced configuration options (for developers) ---> [*] Toolchain Options ---> GCC compiler Version (gcc 10.x)

Latest is 8. What other options do you have enabled? Maybe one of them will allow for GCC 10? Or perhaps I need updated OS packages?

                                                lqqqqqqqqqqqqqqqqqqqq GCC compiler Version qqqqqqqqqqqqqqqqqqqqqk
                                                x  Use the arrow keys to navigate this window or press the      x
                                                x  hotkey of the item you wish to select followed by the <SPACE x
                                                x  BAR>. Press <?> for additional information about this        x
                                                x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
                                                x x                        ( ) gcc 5.x                        x x
                                                x x                        ( ) gcc 7.x                        x x
                                                x x                        (X) gcc 8.x                        x x
                                                x x                                                           x x
                                                x x                                                           x x
                                                x x                                                           x x
                                                x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x
                                                tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
                                                x                    <Select>      < Help >                     x
                                                mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

  lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq Toolchain Options qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
  x  Arrow keys navigate the menu.  <Enter> selects submenus ---> (or empty submenus ----).  Highlighted letters are hotkeys.  Pressing <Y> includes, <N>     x
  x  excludes, <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help, </> for Search.  Legend: [*] built-in  [ ] excluded  <M> module  < > module x
  x  capable                                                                                                                                                  x
  x                                                                                                                                                           x
  x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
  x x                                        --- Toolchain Options                                                                                          x x
  x x                                        [ ]   Enable an extra toolchain target architecture  ----                                                      x x
  x x                                              *** Binary tools ***                                                                                     x x
  x x                                              Binutils Version (Binutils 2.32)  --->                                                                   x x
  x x                                        ()    Additional binutils configure options (NEW)                                                              x x
  x x                                              *** Compiler ***                                                                                         x x
  x x                                              GCC compiler Version (gcc 8.x)  --->                                                                     x x
  x x                                        [ ]   Compile in support for the new Graphite framework in GCC 4.4+                                            x x
  x x                                        ()    Additional gcc configure options (NEW)                                                                   x x
  x x                                        [ ]   Build executable with PIE enabled by default (NEW)                                                       x x
  x x                                        [ ]   Build executable with Stack-Smashing Protection enabled by default (NEW)                                 x x
  x x                                        [ ]   Use setjump()/longjump() exceptions (NEW)                                                                x x
  x x                                        [ ]   Build/install fortran compiler? (NEW)                                                                    x x
  x x                                              *** C Library ***                                                                                        x x
  x x                                              C Library implementation (Use musl)  --->                                                                x x
  x x                                        [*]   Include crypt() support for SHA256, SHA512 and Blowfish ciphers                                          x x
  x x                                              *** Debuggers ***                                                                                        x x
  x x                                        [*]   Build gdb (NEW)                                                                                          x x
  x x                                                                                                                                                       x x
  x x                                                                                                                                                       x x
  x x                                                                                                                                                       x x
  x x                                                                                                                                                       x x
  x x                                                                                                                                                       x x
  x x                                                                                                                                                       x x
  x x                                                                                                                                                       x x
  x x                                                                                                                                                       x x
  x x                                                                                                                                                       x x
  x x                                                                                                                                                       x x
  x x                                                                                                                                                       x x
  x x                                                                                                                                                       x x
  x x                                                                                                                                                       x x
  x x                                                                                                                                                       x x
  x mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj x
  tqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqu
  x                                                 <Select>    < Exit >    < Help >    < Save >    < Load >                                                  x
  mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj

Looks like this is why. I suppose I have to find newer GCC 10 and toss that on the OS?

[root@dd-wrt01 download]# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@dd-wrt01 download]#

The hash 85e04e9f46 refers to a Git commit in the openwrt-19.07 branch. GCC 10.x is only available in the master branch.

Run git checkout master and retry.

Thank you. I'll try that.

Don't build as root. Build as an unprivileged user.

Correct. Always used non-root user.

Running into this at the moment.

checking linker --as-needed support... yes
checking for cos in -lm... yes
*** BFD does not support target -linux-muslgnueabi.
*** Look in bfd/config.bfd for supported targets.
make[5]: *** [configure-bfd] Error 1
make[5]: Leaving directory `/openwrt/build_dir/toolchain-arm_cortex-a9_gcc-10.1.0_musl_eabi/binutils-2.34'
make[4]: *** [all] Error 2
make[4]: Leaving directory `/openwrt/build_dir/toolchain-arm_cortex-a9_gcc-10.1.0_musl_eabi/binutils-2.34'
make[3]: *** [/openwrt/build_dir/toolchain-arm_cortex-a9_gcc-10.1.0_musl_eabi/binutils-2.34/.built] Error 2
make[3]: Leaving directory `/openwrt/toolchain/binutils'
time: toolchain/binutils/compile#4.31#5.32#9.19
make[2]: *** [toolchain/binutils/compile] Error 2
make[2]: Leaving directory `/openwrt'
make[1]: *** [/openwrt/staging_dir/toolchain-arm_cortex-a9_gcc-10.1.0_musl_eabi/stamp/.toolchain_compile] Error 2
make[1]: Leaving directory `/openwrt'
make: *** [world] Error 2
[openwrt@dd-wrt01 openwrt]$
  x x                                            Target System (Broadcom BCM47xx/53xx (ARM))  --->                                                          x x
  x x                                            Subtarget (Generic)  --->                                                                                  x x
  x x                                            Target Profile (Broadcom SoC, BCM43xx WiFi (b43, brcmfmac, default))  --->                                 x x
  x x                                            Target Images  --->                                                                                        x x
  x x                                            Global build settings  --->                                                                                x x
  x x                                        [*] Advanced configuration options (for developers)  --->                                                      x x
  x x                                        [*] Build the OpenWrt Image Builder                                                                            x x
  x x                                        [*]   Include package repositories                                                                             x x
  x x                                        [*] Build the OpenWrt SDK                                                                                      x x
  x x                                        [*] Package the OpenWrt-based Toolchain                                                                        x x
  x x                                        [ ] Image configuration  --->                                                                                  x x
  x x                                            Base system  --->                                                                                          x x
  x x                                            Administration  --->                                                                                       x x
  x x                                            Boot Loaders  ----                                                                                         x x
  x x                                            Development  --->                                                                                          x x
  x x                                            Extra packages  --->                                                                                       x x
  x x                                            Firmware  --->                                                                                             x x
  x x                                            Fonts  --->                                                                                                x x
  x x                                            Kernel modules  --->                                                                                       x x
  x x                                            Languages  --->                                                                                            x x
  x x                                            Libraries  --->                                                                                            x x
  x x                                            LuCI  --->                                                                                                 x x
  x x                                            Mail  --->                                                                                                 x x
  x x                                            Multimedia  --->                                                                                           x x
  x x                                            Network  --->                                                                                              x x
  x x                                            Sound  --->                                                                                                x x
  x x                                            Utilities  --->                                                                                            x x
  x x                                            Xorg  --->                                                                                                 x x
[openwrt@dd-wrt01 openwrt]$ grep eabi ./build_dir/toolchain-arm_cortex-a9_gcc-10.1.0_musl_eabi/gdb-8.3.1/bfd/config.bfd
  armeb-*-elf | arm*b-*-freebsd* | arm*b-*-linux-* | armeb-*-eabi*)
  arm*-*-eabi* | arm-*-rtems* | arm*-*-uclinuxfdpiceabi)
  powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
  powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \
[openwrt@dd-wrt01 openwrt]$
[openwrt@dd-wrt01 openwrt]$
[openwrt@dd-wrt01 openwrt]$
[openwrt@dd-wrt01 openwrt]$ grep eabi ./build_dir/toolchain-arm_cortex-a9_gcc-10.1.0_musl_eabi/binutils-2.34/bfd/config.bfd
  armeb-*-elf | arm*b-*-freebsd* | arm*b-*-linux-* | armeb-*-eabi*)
  arm*-*-eabi* | arm-*-rtems* | arm*-*-uclinuxfdpiceabi)
  powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
  powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \
[openwrt@dd-wrt01 openwrt]$ make menuconfig


*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

[openwrt@dd-wrt01 openwrt]$