Support multiple execution platforms with system_cxx_toolchain #629
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As mentioned in #612, I have a C++ project that can be built for either Linux or Windows, without any cross-compilation so Linux and Windows are also the two execution platforms. Since there is remote execution, I wanted to be able to build for Linux from my Windows machine using RE, and vice versa.
From the response I got in the above issue, I need to add an
exec_dep
to the toolchain, pointing a compiler target, that then has atarget_compatible_with
with the execution platform the compiler can run on.I tried to add the
target_compatible_with
but it didn't work, probably intentional.So I moved some parts of the current system_cxx_toolchain to a separate
NativeCompiler
provider that is then returned by some rules defining a compiler. This compiler target then has thetarget_compatible_with
attribute.Can this be merged or should I just have this toolchain in my own repository? It seems useful for everyone, the only disadvantage I can see being that it is not fully backwards compatible. Hopefully I didn't completely misunderstand how execution platforms are supposed to be used.
I improved the Visual Studio example to use this new updated toolchain to easily support remote execution.
Manual testing
I used the Visual Studio example and setup my RE workers with Buildbarn. Unfortunately its Windows workers don't really work and the linking step fails with "The system cannot open the device or file specified.". I haven't investigated why.
Local builds
Windows
Passes
Linux
Passes
Remote builds
From Windows
Target Windows
Linking fails (The system cannot open the device or file specified.)
Target Linux
Passes
From Linux
Target Windows
Linking fails (The system cannot open the device or file specified.)
Target Linux
Passes