-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[vcpkg scripts] toolchain/osx: Fix CMAKE_HOST_SYSTEM_PROCESSOR condition with lower case arm64 #40503
[vcpkg scripts] toolchain/osx: Fix CMAKE_HOST_SYSTEM_PROCESSOR condition with lower case arm64 #40503
Conversation
AdditionalThere is an issue that it seems that this optimization has not taken effect:
Currently, the additional host dependencies could be avoided by specifying Possible impact: When the option Quote from previous discussion #40474 (comment)
if(CMAKE_CROSSCOMPILING)
find_package(MyGen)
else()
add_executable(mygen gen.c)
export(TARGETS mygen FILE
"${CMAKE_BINARY_DIR}/MyGenConfig.cmake")
endif()
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated.h"
COMMAND mygen -o "${CMAKE_CURRENT_BINARY_DIR}/generated.h"
) Reference
|
I see that the old line didn't make sense, but the new behaviour might not be desired either. Basically, I would suggest to let a cross build be a cross build. At least for ports, there are no CPU-based short-cuts. When the target triplet is different from the host triplet, it is |
In that case, it will make "CMAKE_CROSSCOMPILING" true even if "--host-triplet" is specified. |
This particular toolchain file sets vcpkg/scripts/toolchains/osx.cmake Lines 44 to 46 in 2f210a9
But vcpkg doesn't control I can't tell how far one would get with running x64 build tools on arm64 osx but this would clearly remove the crosscompiling from targeting x64 osx. And everything else could be subeject to a specific toolchain instead of vcpkg's generic one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that it didn't work in the past, I would prefer to not introduce it now.
5c33fff
to
07a1cdf
Compare
After not setting SUMMARY FOR x86-windows It is basically be caused that these packages have different behavior depending on the variable Temporarily suspended modifications. |
07a1cdf
to
60671a8
Compare
This is expected. The x86 windows hack hides the poor cross-build capabilities of several ports. The android triplets where the first real cross builds in CI. |
This was intentionally changed in #26240 with the expectation that arm64 macs can run x64 tools, and setting it to off can allow some ports to work that would not otherwise. It isn't clear to me that rolling this change back as this PR does will lead to a better user experience; in particular, it isn't clear that it fixes the original reported issue in #40474 . Is the real problem that we need to supply a native arm64 cmake?
set(CMAKE_CROSSCOMPILING OFF CACHE STRING "") sets |
@AugP @vicroms @JavierMatosD @data-queue @ras0219-msft We aren't sure how this change fixes the problems described in #40474 and agree with the original design intent clearing |
Speaking personally, I think if we were to make this change on macOS we should make similar changes for Windows, and that is going to break a lot of users. So we need a big carrot to go with that stick. |
As @dg0yt said, there are many ports depends on this hack for x86 windows. I'll try to fix these portability issues.
I'll change this PR to fix the original issue. |
60671a8
to
99257ff
Compare
Failed ports on x86-windows cross compiling
|
Thanks to @JavierMatosD for testing this on an arm64 macOS device for me. It fixes things to have the intended behavior for him. |
And it makes vcpkg build host tools for the arm64-osx host triplet but not reliably use them when targeting x64-osx, leaving more port bugs hidden. |
@dg0yt Except the ports that can be disabled cross-compiling check, for the other ports that require tools to be compiled and run in-place , we will try make these depend on their own host ports. Subsequent fixes will be updated in the list above for the time being. |
I don't believe this will happen. |
Fix #40474
CMake
STREQUAL
is case-sensitive, changeARM64
toarm64
https://cmake.org/cmake/help/latest/variable/CMAKE_APPLE_SILICON_PROCESSOR.html