Provided that my code is fully standards compliant with no undefined behaviour, how can I best assure that it will be possible to cross-compile my software for any architecture?
I had some ideas, but I don’t if it’s wise or possible to implement them. For example, if I could tell the compiler not to assume any paths or architectures when compiling or linking, then any non-cross-compilation would be effectively equivalent to making a cross-compilation build. For example, the compiler shouldn’t assume that a DSO that I’m linking with, will be available under that path under runtime (or actually just before that, startup time).
I am assuming that you are already relying on static code analysers to ensure standards compliance.
Now, because of the way systems are built, I’d strongly recommend actually compiling on a machine that resembles the target machines as close as possible.
You can achieve this using a cloud of build servers such as Jenkins or Electric Commander. With these tools you can also tie down the build break down to the actual code check-in via SCM integration.