libzmq: Build Failure on Windows 10 for ARM/ARM64

Issue description

When trying to build ZMQ for ARM/ARM64 on Windows, I get these errors:

\src\clock.cpp(260): error C2065: 'CLOCK_MONOTONIC': undeclared identifier
\src\clock.cpp(260): error C3861: 'clock_gettime': identifier not found 

Which makes sense because that’s not a Windows API. I’m unable to build ZMQ other than with VcPkg because I am not familiar with CMake.

I also opened this issue: https://github.com/Microsoft/vcpkg/issues/5171 But the initial feedback I got was that I need to open an issue here.

Environment

  • libzmq version (commit hash if unreleased): 0761e6bb48e34c1499104eaf7f9daa0c6647977c
  • OS: Windows 10.0.17763.253
  • Compiler: Visual Studio 2017 15.9.5
  • Built With: VcPkg

Minimal test code / Steps to reproduce the issue

  1. Run: vcpkg install zeromq:arm64-windows OR
  2. Run: vcpkg install zeromq:arm-windows

What’s the actual result?

The build fails with the above errors.

What’s the expected result?

The build completes successfully.

More Information

I can provide a suitable replacement for clock_gettime that works on Windows, but even if I hack one in, just to test it, I get a linker error because the project isn’t including the .lib you need when linking on Windows (perhaps because it isn’t detecting this to be a Windows build). At that point, I need some help because I don’t know anything about CMake and I don’t know how to change the files to include the right libraries in the linker settings. I really need someone more familiar with this to help. But, let me know if you want my replacement for clock_gettime.

I know that ARM and ARM64 on Windows is a new thing, but it’s a real thing now, and I really hope you intend to support it. Please let me know how I can help.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 24 (13 by maintainers)

Most upvoted comments

I was getting the same issue, but it looks like on windows you have to change the polling setting to use epoll instead of select. The best way I found to build for ARM64 is to edit the port file (with just a couple of changes), rather than messing around manually with the build tree. So in vcpkg/ports/zeromq/portfile.cmake make the following changes:

diff --git a/ports/zeromq/portfile.cmake b/ports/zeromq/portfile.cmake
index 7ec044646..9fa2b2dea 100644
--- a/ports/zeromq/portfile.cmake
+++ b/ports/zeromq/portfile.cmake
@@ -1,8 +1,8 @@
 vcpkg_from_github(
     OUT_SOURCE_PATH SOURCE_PATH
     REPO zeromq/libzmq
-    REF 8d34332ff2301607df0fc9971a2fbe903c0feb7c
-    SHA512 8b3a9b6c4e5236353672b6deb64c94ac79deb116962405f01fe36e2fd8ddc48ec65d88ffc06746ce2e13c93eaeb04e4ba73de8f9d6f2a57a73111765d5ba8ad7
+    REF 54c7f7969b2d783d2d456fca00fb477b8354e50e
+    SHA512 836836bd121db23bb004a27eedbb45692c3d15bee988cc0b49add4a9015122e045b12a4d9975ae8fc9b06123af25da2a49f10e18b78ff36e6af76f7acb506425
     HEAD_REF master
 )

@@ -28,12 +28,13 @@ vcpkg_configure_cmake(
     PREFER_NINJA
     OPTIONS
         -DZMQ_BUILD_TESTS=OFF
-        -DPOLLER=select
+        -DPOLLER=epoll
         -DBUILD_STATIC=${BUILD_STATIC}
         -DBUILD_SHARED=${BUILD_SHARED}
         -DWITH_PERF_TOOL=OFF
         -DWITH_DOCS=OFF
         -DWITH_NSS=OFF
         ${FEATURE_OPTIONS}
         ${PLATFORM_OPTIONS}
     OPTIONS_DEBUG

and then run vcpkg install zeromq:arm64-windows