-
Notifications
You must be signed in to change notification settings - Fork 910
AppVeyor: Add workaround for build with Visual Studio 2019 on ARM64 #1583
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
base: master
Are you sure you want to change the base?
Conversation
|
Test with the last Appveyor OK (like 730a8db). |
183c4e1 to
98dbc4a
Compare
|
Squashed. Seems ok. Waiting for a new Appveyor full run. |
|
If it's run OK, Ii will be rebased on top of master before a merge. |
|
I will wait until it has settled. |
OK. The reason of the break is still unknown. With the same head commit, it is now broken (before my hack) but worked before... |
|
It looks worth asking Appveyor support about it. |
98dbc4a to
bc08d43
Compare
|
Something has changed in the AppVeyor build system. |
bc08d43 to
9b500ea
Compare
|
Is actions/runner-images#11684 related to this? |
9b500ea to
164f809
Compare
It seems similar in another context. |
|
Workaround v2, simpler, already used in other projects. |
164f809 to
44bf5ef
Compare
|
Perhaps related to: |
|
I wiil try: |
0326443 to
66205e0
Compare
|
On test. The problem with |
Avoid the SDK 10.0.26100.0. Use an older SDK: 10.0.22621.0. The problem first appeared on 2025-11-07, after the 2025-11-06 image update (Visual Studio 2019/2022). The errors were: C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\winnt.h (6343,27): warning C4013: '_CountOneBits64' undefined; assuming extern returning int When it was OK: cmake version 4.1.0 -- The C compiler identification is MSVC 19.29.30159.0 Current: cmake version 4.1.0 -- Selecting Windows SDK version 10.0.26100.0 to target Windows 10.0.17763. -- The C compiler identification is MSVC 19.29.30159.0 [skip ci]
66205e0 to
5ee0310
Compare
|
Don't work, Back to v2. |
|
Thank you for debugging this. |
894a4c7 to
5ee0310
Compare
|
Microsoft's documentation for Visual Studio 2019 and for Visual Studio 2022 seems to indicate that However, somebody named Google McGemini (I'm guessing the AI summaries for Google searches are from Gemini) says, in response to [this Google search]("visual studio 2019" "arm64" "_CountOneBits64" "undefined"), that
and has a workaround that provides an inline McGemini links to Bit.h from the Nvidia Carbonite SDK, which does the same workaround, with what it labels as a "Naive impl". I'm not sure whether the problem is that 1) Microsoft's documentation is wrong about VS 2019 or 2) some versions of VS 2019 have a bug in which they don't supply |
|
The Nvidia code links to https://developercommunity.visualstudio.com/t/-countonebits-intrinsics-are-not-defined-for-arm64/957551, in which somebody from Microsoft says
This somewhat misunderstands the full purpose of these sort of things - "as it does not map to a single instruction on XXX" is not a reason not to implement it; these intrinsics are intended to implement operations on all platforms, so they can be used in portable code (at least if the target platform has a compiler that supports the intrinsic in question), and uses whatever instruction sequence does them best on that platform, whether it's a single-instruction implementation or not. At least they seem to acknowledge that not implementing it wasn't the right thing to do. That still doesn't explain why this only showed up recently, if it was working before with VS 2019. |
It seems that the SDK upgrade from 10.0.22621.X to 10.0.26100.0 add a problem. |
|
I currently see 3 options
diff --git a/.appveyor.yml b/.appveyor.yml
index ed2861f9..24d55ce9 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -95,12 +95,14 @@ environment:
PLATFORM: ARM64
SDK: npcap-sdk
REMOTE: -DENABLE_REMOTE=NO
+ POPULATIONCOUNT64: -DPOPULATIONCOUNT64=1
# VS 2019, Npcap, 64-bit ARM, with remote
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
GENERATOR: "Visual Studio 16 2019"
PLATFORM: ARM64
SDK: npcap-sdk
OPENSSL_ROOT_DIR: -DOPENSSL_ROOT_DIR=C:\OpenSSL-v33-Win64\bin
+ POPULATIONCOUNT64: -DPOPULATIONCOUNT64=1
# VS 2022, WinPcap, 32-bit and 64-bit x86, without remote
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2022
GENERATOR: "Visual Studio 17 2022"
@@ -167,5 +169,5 @@ build_script:
- md build
- cd build
- cmake --version
- - cmake %REMOTE% %OPENSSL_ROOT_DIR% -DPacket_ROOT=c:\projects\libpcap\Win32\%SDK% -G"%GENERATOR%" -DPacket_ROOT=c:\projects\libpcap\Win32\%SDK% -DPacket_ROOT=c:\projects\libpcap\Win32\%SDK% -G"%GENERATOR%" -G"%GENERATOR%" -A %PLATFORM% ..
+ - cmake %POPULATIONCOUNT64% %REMOTE% %OPENSSL_ROOT_DIR% -DPacket_ROOT=c:\projects\libpcap\Win32\%SDK% -G"%GENERATOR%" -DPacket_ROOT=c:\projects\libpcap\Win32\%SDK% -DPacket_ROOT=c:\projects\libpcap\Win32\%SDK% -G"%GENERATOR%" -G"%GENERATOR%" -A %PLATFORM% ..
- msbuild /m /nologo /p:Configuration=Release pcap.sln
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 55199378..45112f69 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -656,6 +656,9 @@ endif(WIN32)
if(MSVC)
add_definitions(-D__STDC__)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+ if(DEFINED POPULATIONCOUNT64)
+ add_compile_definitions(PopulationCount64=${POPULATIONCOUNT64})
+ endif()
endif(MSVC)
if(USE_STATIC_RT)
Knowing that:
|
|
For what it's worth, for Mike Godbolt's Compiler Explorer shows, for ARM64 Visual Studio 16.11 - according to the Wikipedia article on Visual Studio, that's a version of VS 2019 - with and, for Visual Studio 17.14 - according to the Wikipedia article on Visual Studio, that's a version of VS 2022: It looks, from the Armv8.9 documentation, the The generated code is using the vector (SIMD) |
|
Any thoughts on the three options suggested, or another suggestion? |
|
No opinion from me: the last time I compiled anything on Windows was about 25 years ago. |
Avoid the SDK 10.0.26100.0. Use an older SDK: 10.0.22621.0.
The problem first appeared on 2025-11-07, after the 2025-11-06
image update (Visual Studio 2019/2022).
The errors were:
C:\Program Files (x86)\Windows Kits\10\Include\10.0.26100.0\um\winnt.h
(6343,27): warning C4013: '_CountOneBits64' undefined; assuming extern
returning int
When it was OK:
cmake version 4.1.0
-- The C compiler identification is MSVC 19.29.30159.0
Current:
cmake version 4.1.0
-- Selecting Windows SDK version 10.0.26100.0 to target Windows 10.0.17763.
-- The C compiler identification is MSVC 19.29.30159.0