-
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
[benchmark] Add MSVC ARM64 support #14021
Conversation
3c5e58c
to
44febdd
Compare
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.
Could you please also update CONTROL file?
Add Port-version
field:
Port-Version: 1
+if(MSVC) | ||
+ # As of CMake 3.18, CMAKE_SYSTEM_PROCESSOR is not set properly for MSVC and | ||
+ # cross-compilation (e.g. Host=x86_64, target=aarch64) requires using the | ||
+ # undocumented, but working variable. | ||
+ # See https://gitlab.kitware.com/cmake/cmake/-/issues/15170 | ||
+ set(CMAKE_SYSTEM_PROCESSOR ${MSVC_CXX_ARCHITECTURE_ID}) | ||
+ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "ARM") | ||
+ set(CMAKE_CROSSCOMPILING TRUE) | ||
+ endif() | ||
+endif() |
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.
this is a failure in the vcpkg windows toolchain not setting CMAKE_SYSTEM_PROCESSOR
to arm for ARM builds.
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.
While vcpkg might share the issue, it's a consequence of MSVC's quirks and not limited to vcpkg. Even building manually with ninja requires this fixup.
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.
No it is a consequence of CMake always setting CMAKE_SYSTEM_PROCESSOR
to CMAKE_HOST_SYSTEM_PROCESSOR
(in make land this would be --build and not --host) unless otherwise specified. So if you crosscompile with CMake you are expected to correctly set the values for crosscompiling in the toolchain
73889d1
to
75a0579
Compare
I think you need to let upstream discuss this google/benchmark#1052 |
There are two upstreams in this context:
This leaves this PR in a limbo, as I don't intend to work on cmake fix at this point. |
@janisozaur My point is, we, vcpkg, are a packaging system, not a "fix everyone's bugs clearinghouse". If upstream looked at the patch and rejected it, it would be wrong of us to go around them and apply it anyway. Note that upstream is likely to be blamed for any bugs in such patches, not us. This isn't adding a header file or something like that, this is adding a whole new feature directly relevant to the upstream authors' core competencies. They probably have strong opinions about how timing stuff is done given that this is a benchmarking library. See https://github.com/microsoft/vcpkg/blob/master/docs/maintainers/maintainer-guide.md#do-not-implement-features-in-patches As for the cmake change, I agree with other commenters that if that setting for |
Since this PR requires upstream changes. We're not sure when upstream will complete these work. What do you think? |
As upstream had comments on the cmake part of the patch, not the actual code changes, I believe this is the correct way to address the compilation problem. The cmake stuff I've now separated out to another PR upstream, which I imagine can get rejected on the grounds that it's a problem with cmake and not something downstream should bother with. As vcpkg is a collection of cmake patches, I'd hope the CMakeLists.txt portion can get merged here until cmake itself gets fixed. How does that sound to you? |
let me just cite myself #14021 (comment) It is a problem with vcpkg not setting |
I think we should wait on this until we merge the fixes to the Windows toolchain that @Neumann-A has implied. |
Sounds ok. Is there pr already I can subscribe to? |
That is: #16111 |
Since the required PR #16111 isn't merged, switch this PR to draft. |
The upstream has merged both patches provided, so it should be possible to use it directly, without any patching. I will submit a pr later today |
So I checked it just now on current master and it seems there's nothing to do anymore? Upstream took two of my PRs which were both the gist of this PR to vcpkg: google/benchmark#1090 Since they were merged, there was at least 1.5.5 release, which is the version currently in use by vcpkg: vcpkg/ports/benchmark/portfile.cmake Line 9 in 1345050
In 18595 arm was also removed from unsupported architectures and the scripts/ci.baseline.txt file was updated in #14246 to not include benchmark anymore. It seems there are no changes required to get a build of benchmark working for WoA. Please confirm and close this PR or point what I might be missing. |
@janisozaur So can you please resolve the file conflicts first? |
So I think the upgrade PR #18595 fixed this issue? |
Used current master to do a test build for arm64-windows and it compiled correctly: https://github.com/janisozaur/benchmark-arm64-test/runs/3158745801?check_suite_focus=true https://github.com/janisozaur/benchmark-arm64-test/blob/main/.github/workflows/ci.yml
I can't test it right now, but given all the issues this PR aimed to fix were spotted at compile-time, I believe this PR is no longer required as upstream took my fixes there. |
Adds MSVC ARM64 support to Google Benchmark.
PR sent upstream over week ago with no changes requested, but not merged yet and no information about planned releases.