New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMake: Not possible to cross-compile due to settinsgen/strgen #8249
Comments
I'm not sure if it's a great solution, but I suppose it'd be possible to have settings pointing to strgen and settingsgen executables to use instead of those built. |
https://stackoverflow.com/a/61385572 seems to be a good option. |
I tried something using the link in my previous comment in master...glx22:cross_compile |
This fixes the issue for me, many thanks :) |
Hm, I assume this works for gcc or similar, but doesn't appear to work when trying to cross-compile ARM64 on x64 with MSVC 2019. I'll have a dig around and see if I can work out a solution. |
Yeah, for now I hardcoded host compiler, but I think it can be configurable. |
Ok I tried ARM64 on x64 with VS2019, it's not detected as cross-compiling ( |
It's not particularly elegant, but master...orudge:msvc-crosscompile works for me when crosscompiling for ARM64 on x64. Compiling x64 and x86 on x64 work too in the conventional manner, and building with mingw-w64/msys2 also looks OK. |
Alternate option in master...glx22:cross_compile_alt.
|
I like your solution @glx22, and it works very well. Did you already make a PR out of this? There is one change in your commit I am not sure is correct, the one where you add a WIN32 line .. feels a bit out-of-place. To make it an official option in CMake, might be good to set |
Cross-compiling (i.e. using CMAKE_TOOLCHAIN_FILE such that CMAKE_CROSSCOMPILING is ON) does not work because settingsgen and strgen are built for the target platform but executed on the host platform as part of the build.
In the case where the host and target are different, the settingsgen/strgen executables cannot be found/executed.
The configure script handled this correctly.
Unfortunately cmake doesn't seem to support the standard host/build distinction.
Stackoverflow suggest various convoluted and ugly workarounds, which I haven't been able to get working.
It'd be useful to get an "official" take on how this is supposed to work.
I'm attempting to use MinGW, but I can imagine that similar issues would arise when cross-building for other architectures like ARM, etc.
The text was updated successfully, but these errors were encountered: