[PATCH] D98861: [CMAKE] Fix cross-compilation build

Markus Böck via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 18 07:39:17 PDT 2021


zero9178 added a comment.

In D98861#2634455 <https://reviews.llvm.org/D98861#2634455>, @jhenderson wrote:

> Is this approach going to work for all the previous cases we've identified as problematic (and hence why we ended up with this approach)? In other words, is there a risk that this will actually cause things to regress in some cases?

Compared to all the previous states this does not change a whole lot. One case that @abhina.sreeskantharajan has mentioned is when cross compiling LLVM, so that the compiler runs on Windows. If one where to run tests in such a configuration, which I believe is possible if lit uses ssh or similar to go into a remote Windows host to execute the binaries, then it would lead to pythons strerror messages being used (since lit is still used on the non-Windows host I believe) and therefore getting wrong results.

There are actually ways around this problem in it's current state, but each require an extra action. One may set CMAKE_CROSSCOMPILING_EMULATOR to an "emulator" like wine. It would then compile a Windows executable and wine would execute it and give back the correct results.
Alternatively one way also set errc_exit_code and errc_exit_code__TRYRUN_OUTPUT to the stdout as if the code had been run on Windows manually.

Another thing to consider however, is that the above is only applicable in an MSVC environment. That is, if you are using MinGW to cross compile from say, a Linux to a Windows machine, we won't encounter any issues. So one would have to use wine or similar already to be running MSVC or least installed all build tools with it for clang-cl.

Functionality wise I think the patch in it's current form is good. The above situation can't really be solved, but maybe it could be documented? I am not sure.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98861/new/

https://reviews.llvm.org/D98861



More information about the llvm-commits mailing list