-
Notifications
You must be signed in to change notification settings - Fork 844
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 fails on Windows when building ARM64 on x64 host #1352
Comments
Could you add the steps to reproduce the problem? |
I don't think we've ever supported cross-compiling on Windows. But, it seems that "Windows" as a value for CMAKE_SYSTEM_NAME is wrong, if it implies x86_64, and Windows now supports building for ARM. Maybe WSL + ./configure is a better route. |
The CMake command I ran is in a script in Npcap's source tree. I believe the crucial part is the
|
According to the CMake 3.12 "cmake" command documentation (3.12 being the minimum version of CMake we require on Windows), Unfortunately, as you noted, It appears that "cross-compiling for a different instruction set" amounts to |
CMake appears to have the notion that a build is only a cross-compile if the targt *operating system* is different. This is an incorrect notion, as even if the target is the *same* OS but a different instruction set, you may not be able to do tests that involve compiling and running a program. Check whether CMAKE_GENERATOR_PLATFORM is set and has a value different from that of CMAKE_HOST_SYSTEM_PROCESSOR and, if that's the case, set CMAKE_CROSSCOMPILING to TRUE. This should fix issue the-tcpdump-group#1352. (A different strategy may be necessary for cross-builds with UNIX toolchains.)
CMake appears to have the notion that a build is only a cross-compile if the targt *operating system* is different. This is an incorrect notion, as even if the target is the *same* OS but a different instruction set, you may not be able to do tests that involve compiling and running a program. Check whether CMAKE_GENERATOR_PLATFORM is set and has a value different from that of CMAKE_HOST_SYSTEM_PROCESSOR and, if that's the case, set CMAKE_CROSSCOMPILING to TRUE. This should fix issue #1352. (A different strategy may be necessary for cross-builds with UNIX toolchains.)
See if this fixes it. (The check for a cross-compile doesn't occur in the 1.10 branch, so this doesn't need to be backported; we're not doing a check for a working |
It's working for me now, thanks. |
CMake appears to have the notion that a build is only a cross-compile if the targt *operating system* is different. This is an incorrect notion, as even if the target is the *same* OS but a different instruction set, you may not be able to do tests that involve compiling and running a program. Check whether CMAKE_GENERATOR_PLATFORM is set and has a value different from that of CMAKE_HOST_SYSTEM_PROCESSOR and, if that's the case, set CMAKE_CROSSCOMPILING to TRUE. This comes from libpcap, where the equivalent change fixed issue the-tcpdump-group/libpcap#1352. (A different strategy may be necessary for cross-builds with UNIX toolchains.)
CMake appears to have the notion that a build is only a cross-compile if the targt *operating system* is different. This is an incorrect notion, as even if the target is the *same* OS but a different instruction set, you may not be able to do tests that involve compiling and running a program. Check whether CMAKE_GENERATOR_PLATFORM is set and has a value different from that of CMAKE_HOST_SYSTEM_PROCESSOR and, if that's the case, set CMAKE_CROSSCOMPILING to TRUE. This comes from libpcap, where the equivalent change fixed issue the-tcpdump-group/libpcap#1352. (A different strategy may be necessary for cross-builds with UNIX toolchains.)
The SUITABLE_SNPRINTF check fails because the resulting ARM64 code cannot be run on the x64 host. CMAKE_CROSSCOMPILING is not set because both systems have the same CMAKE_SYSTEM_NAME ("Windows"). Not sure the best way to handle this, since a general check for identical architectures would miss the cases of ARM64 and x64 host systems targeting x86.
libpcap/CMakeLists.txt
Lines 738 to 792 in 3bb233f
The text was updated successfully, but these errors were encountered: