SCons/scons

Documentation lacks guidance for cross compiling

Closed this issue · 2 comments

While readers might get the idea how to set up a cross toolchain, there's not a single example present in the documentation.

E.g., I need to build a Linux Qt C++ and QML application on an amd64 machine for i386 and arm (aarch64), and would like to know how easy it is to get there with SCons. Currently, we have a layered setup of Make running SCons running Buildroot running bash running QMake and Make. I consider evaluating SCons to replace the last three layers, hoping for build performance gains (e.g. much faster incremental static code analysis which leverages caching and scanning facilities, for which I have a promising prototype).

For start, it would be helpful to see how to build a hello_world example with a pre-built bootlin cross toolchain, given a downloaded toolchain tarball and a main.cpp file.

I might provide it myself if my progress and learning curve is steep enough.

Agreed, there's not much on cross-compiling now.

The wiki and the cookbook project (https://scons-cookbook.readthedocs.io/en/latest/) are both potential homes for such. There's actually an article on setting up for cross compiling in the latter, but it's light on details. Past SCons contributors recognized that the current scheme of calling individual tool specification modules doesn't extend very smoothly to specifying entire toolchains - definitely a cross-compile concern - and had all kinds of revamp plans, but that generation of developers drifted away from the project before that refactor was completed.

For a more interactive discussion, you might consider joining the Discord server.

In theory, SCons should work well for the use case you describe. Building is controlled by a construction environment, and you can create one of those for each target arch with its own toolchain setup. Keeping the builds separate can be done by setting up variant directories. Of course, the devil is always in the detials...