Skip to content
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

Problems with using ARM64EC #40158

Open
walbourn opened this issue Jul 29, 2024 · 5 comments
Open

Problems with using ARM64EC #40158

walbourn opened this issue Jul 29, 2024 · 5 comments
Labels
category:community-triplet A PR or issue related to community triplets not officially validated by the vcpkg team.

Comments

@walbourn
Copy link
Member

walbourn commented Jul 29, 2024

I'm attempting to use ARM64EC with VCPKG and CMake. I'm using the arm64ec-windows community triplet, and have run into a number of problems.

  • When using VCPKG_DEFAULT_TRIPLET=arm64ec-windows on a x64_arm64 command prompt, it's emitting a false warning
warning: vcpkg appears to be in a Visual Studio prompt targeting arm64 but installing for arm64ec-windows. Consider using --triplet arm64-windows or --triplet arm64-uwp.
  • The VCPKG_DEFAULT_TRIPLET environment variable seems to be ignored or overwritten in the vcpkg.cmake toolchain file and I have to explicitly use VCPKG_TARGET_TRIPLET=arm64ec-windows to make it work at all.

  • When using 'manifest mode', it still insists on trying to use vcpkg_installed\arm64-windows instead of vcpkg_installed\arm64ec-windows even with VCPKG_DEFAULT_TRIPLET=arm64ec-windows and VCPKG_TARGET_TRIPET=arm64ec-windows set. It only works with an explicit -DVCPKG_TARGET_TRIPLET=arm64ec-windows. Are the environment variables ignored for manifest mode?

  • For ARM64EC, you can use binaries that are x64 or arm64ec, but not arm64. Therefore, this warning is false and confusing:

D:\vcpkg\ports\dstorage\portfile.cmake: warning: The triplet requests that binaries are built for arm64ec, but the following binaries were built for a different architecture. This usually means toolchain information is incorrectly conveyed to the binaries' build system. To suppress this message, add set(VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK enabled)
D:\vcpkg\packages\dstorage_arm64ec-windows: note: the binaries are relative to ${CURRENT_PACKAGES_DIR} here
note: debug/lib/dstorage.lib is built for x64
note: lib/dstorage.lib is built for x64
note: debug/bin/dstorage.dll is built for x64
note: debug/bin/dstoragecore.dll is built for x64
note: bin/dstorage.dll is built for x64
note: bin/dstoragecore.dll is built for x64
@dg0yt
Copy link
Contributor

dg0yt commented Jul 29, 2024

Triplet initialization in manifest mode? #23607, #25529.

@WangWeiLin-MV WangWeiLin-MV added the category:community-triplet A PR or issue related to community triplets not officially validated by the vcpkg team. label Jul 30, 2024
@walbourn
Copy link
Member Author

Triplet initialization in manifest mode? #23607, #25529.

That does seem to be the issue I was hitting with setting the triplet. I worked around it, but it was a bit frustrating to do in a GitHub Actions YAML pipeline.

@BillyONeal
Copy link
Member

  • When using VCPKG_DEFAULT_TRIPLET=arm64ec-windows on a x64_arm64 command prompt, it's emitting a false warning
warning: vcpkg appears to be in a Visual Studio prompt targeting arm64 but installing for arm64ec-windows. Consider using --triplet arm64-windows or --triplet arm64-uwp.

How is the warning false? The warning is generated by looking at what things vcvarsall.bat sets, and comparing that with the selected architecture, and emitting a warning if they don't match. As far as I understand it you can't set vcvarsall.bat to give you an arm64ec build prompt?

  • The VCPKG_DEFAULT_TRIPLET environment variable seems to be ignored or overwritten in the vcpkg.cmake toolchain file and I have to explicitly use VCPKG_TARGET_TRIPLET=arm64ec-windows to make it work at all.

CMake integration explicitly sets triplets, it doesn't use the default one:

--triplet "${VCPKG_TARGET_TRIPLET}"

  • When using 'manifest mode', it still insists on trying to use vcpkg_installed\arm64-windows instead of vcpkg_installed\arm64ec-windows even with VCPKG_DEFAULT_TRIPLET=arm64ec-windows and VCPKG_TARGET_TRIPET=arm64ec-windows set. It only works with an explicit -DVCPKG_TARGET_TRIPLET=arm64ec-windows. Are the environment variables ignored for manifest mode?

VCPKG_TARGET_TRIPLET is not an environment variable, it's a CMake variable:

if(VCPKG_TARGET_TRIPLET)
. VCPKG_DEFAULT_TRIPLET only affects the command line when a triplet is not supplied, but the CMake integration sets one.

  • For ARM64EC, you can use binaries that are x64 or arm64ec, but not arm64. Therefore, this warning is false and confusing:
D:\vcpkg\ports\dstorage\portfile.cmake: warning: The triplet requests that binaries are built for arm64ec, but the following binaries were built for a different architecture. This usually means toolchain information is incorrectly conveyed to the binaries' build system. To suppress this message, add set(VCPKG_POLICY_SKIP_ARCHITECTURE_CHECK enabled)
D:\vcpkg\packages\dstorage_arm64ec-windows: note: the binaries are relative to ${CURRENT_PACKAGES_DIR} here
note: debug/lib/dstorage.lib is built for x64
note: lib/dstorage.lib is built for x64
note: debug/bin/dstorage.dll is built for x64
note: debug/bin/dstoragecore.dll is built for x64
note: bin/dstorage.dll is built for x64
note: bin/dstoragecore.dll is built for x64

If the user asks for arm64ec, the produced bits need to be built for arm64ec. That you can ultimately compose a process with a mix of different bits later doesn't change what the user asked for. Removing this check would allow the vast majority of OSS world, that does not care about arm64ec, to give up and continue building for amd64, and thus 'succeed' but not actually produce arm64 bits.

@walbourn
Copy link
Member Author

walbourn commented Jan 21, 2025

There is no "Developer Command Prompt for ARM64EC". ARM64EC and ARM64 use the same developer command prompt, and compiler toolset version. The only difference is adding a /arm64ec switch to the build. My recommendation is to treat arm64ec-windows, arm64-windows as the same for determining if this warning should be emitted.

The confusing thing is that you are allowed to freely mix ARM64, X64, and ARM64EC binaries in the same process. That's why the binaries warning here is super confusing.

@BillyONeal
Copy link
Member

There is no "Developer Command Prompt for ARM64EC". ARM64EC and ARM64 use the same developer command prompt, and compiler toolset version. The only difference is adding a /arm64ec switch to the build. My recommendation is to treat arm64ec-windows, arm64-windows as the same for determining if this warning should be emitted.

This is microsoft/vcpkg-tool#1581 . I'm still not sure about the architecture check. I asked around with some arm64ec experts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:community-triplet A PR or issue related to community triplets not officially validated by the vcpkg team.
Projects
None yet
Development

No branches or pull requests

4 participants