Cross compiling and SDK binaries

OpenWrt Project: Build system – Installation

OpenWrt Project: Using the SDK

Somewhere I thought for sure I had seen a statement that a 64 bit Linux host system is required when building and cross compiling, but can I find that statement now? No!

I'm new to OpenWRT and I'm currently setting up a Virtualbox VM to compile some packages and coming across system requirements that I'm not sure about. I'd like to make minor Wiki edits to the two Wiki pages at the top of this messages to clarify my questions, which hopefully would benefit others.

  1. Regarding OpenWrt Project: Using the SDK and the verbiage "precompiled SDK", is it a true statement that all binary SDK downloads -- all target devices, everywhere, everything -- require a 64 bit Linux host system?

  2. In order to do development on a 32 bit Linux host system, is it a true statement that the SDK must be compiled from source?

  3. From a developer's point of view, is there any part of building/cross-compiling OpenWRT that absolutely, positively cannot be done on a 32 bit Linux host system? (Not asking about targets, only about the host.)

  4. Is it a true statement that it is recommended the host system be based on Ubuntu or Debian?

Knowing answers to the above will allow me to figure out how best to word my changes.

If you want to use the imagebuilder or the SDK, you must use a linux/ x86_64 host system, because the binaries shipped prebuilt in those tarballs are x86_64 binaries.

If you do build from source, using OpenWrt's buildroot (from the checked out git tree), you can use 'any' kind of (unixoid) host for building - i386, ARMv7, powerpc64le, MacOSX/ x86_64 or MacOSX/ powerpc, whatever (you can then build your own SDK/ imagebuilder according to your host architecture). Just keep in mind that you probably have to submit your own fix, if your host arch/ OS combination is too exotic (or may have to push the patch via upstream, if the resulting change is deemed too invasive for OpenWrt to carry).

You can use 'any' general purpose linux distribution for building from source, but -as before- the more exotic your choice, the more likely you are to encounter corner cases and bugs. OpenWrt's buildbots are mostly using stable Debian releases on x86_64/ amd64, this means this is the most tested way to build OpenWrt, but Debian testing or unstable will do as well (although you may encounter temporary issues after host toolchain updates) and other major distributions (Arch, Fedora, Gentoo, OpenSuSE, Ubuntu, …) should also do; some OpenWrt developers are even using MacOS as their host OS - many users are using a virtual machine on windows (or WSL). However, OpenWrt is not self-hosting, you can not build OpenWrt on a host running OpenWrt itself (as it's lacking development packages, compilers, headers, etc.). While using (Free-)BSD as host is supposed to work as well, apparently no one has succeeded using a BSD as build host in recent years (using a linux VM on xBSD will work, though).

For building OpenWrt, it helps to have a relatively powerful host system, with sufficient amounts of RAM - but if you need it rarely and are patient, it scales down quite a bit.

Understood, and thank you very much for your detailed response.

For all my custom builds of openwrt images, I use ubuntu as host system. Either as a real server (16.04 or 18.04), or, like I am actually doing, running ubuntu14.04 on Workstation Player Windows VM, to build a chaos_calmer image (15.05) for some experiments.
I practically always build from source, to habe best flexibility and control.

1 Like