Skip to content

Doesn't seem to build on arm64 Windows (Python 3.12) #390

@da-woods

Description

@da-woods

I was trying to set up tests for Cython on ARM-Windows, and as part of that it requires line_profiler as a test dependency.

When it tries to install that, line_profiler fails to build. Full output is at https://github.com/cython/cython/actions/runs/17012093880/job/48229495248?pr=7091 (but link won't be good forever). Representative output of the failure is:

"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\bin\HostARM64\ARM64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -DCYTHON_TRACE=0 -Ipython25.pxd -Iline_profiler -IC:\hostedtoolcache\windows\Python\3.12.10\arm64\include -IC:\hostedtoolcache\windows\Python\3.12.10\arm64\Include "-IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\ATLMFC\include" "-IC:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\VS\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.26100.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\um" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\shared" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\winrt" "-IC:\Program Files (x86)\Windows Kits\10\\include\10.0.26100.0\\cppwinrt" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" /EHsc /Tpline_profiler/_line_profiler.cpp /Fobuild\temp.win-arm64-cpython-312\Release\line_profiler\_line_profiler.obj
  _line_profiler.cpp
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(437): error C2664: '__int64 _InterlockedCompareExchange64_acq(volatile __int64 *,__int64,__int64)': cannot convert argument 1 from 'volatile uintptr_t *' to 'volatile __int64 *'
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(437): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\intrin0.inl.h(175): note: see declaration of '_InterlockedCompareExchange64_acq'
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(437): note: while trying to match the argument list '(volatile uintptr_t *, uintptr_t, uintptr_t)'
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(444): error C2664: '__int64 _InterlockedCompareExchange64_rel(volatile __int64 *,__int64,__int64)': cannot convert argument 1 from 'volatile uintptr_t *' to 'volatile __int64 *'
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(444): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\intrin0.inl.h(177): note: see declaration of '_InterlockedCompareExchange64_rel'
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(444): note: while trying to match the argument list '(volatile uintptr_t *, uintptr_t, uintptr_t)'
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(454): error C2664: '__int64 _InterlockedCompareExchange64(volatile __int64 *,__int64,__int64)': cannot convert argument 1 from 'volatile uintptr_t *' to 'volatile __int64 *'
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(454): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\intrin0.inl.h(174): note: see declaration of '_InterlockedCompareExchange64'
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(454): note: while trying to match the argument list '(volatile uintptr_t *, uintptr_t, uintptr_t)'
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(475): error C2664: 'long _InterlockedCompareExchange_acq(volatile long *,long,long)': cannot convert argument 1 from 'volatile int *' to 'volatile long *'
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(475): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\intrin0.inl.h(182): note: see declaration of '_InterlockedCompareExchange_acq'
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(475): note: while trying to match the argument list '(volatile int *, int, int)'
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(482): error C2664: 'long _InterlockedCompareExchange_rel(volatile long *,long,long)': cannot convert argument 1 from 'volatile int *' to 'volatile long *'
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(482): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\intrin0.inl.h(184): note: see declaration of '_InterlockedCompareExchange_rel'
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(482): note: while trying to match the argument list '(volatile int *, int, int)'
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(492): error C2664: 'long _InterlockedCompareExchange(volatile long *,long,long)': cannot convert argument 1 from 'volatile int *' to 'volatile long *'
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(492): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or parenthesized function-style cast
  C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.44.35207\include\intrin0.inl.h(168): note: see declaration of '_InterlockedCompareExchange'
  C:\hostedtoolcache\windows\Python\3.12.10\arm64\include\internal\pycore_atomic.h(492): note: while trying to match the argument list '(volatile int *, int, int)'
  line_profiler/_line_profiler.cpp(16819): warning C4244: 'argument': conversion from 'Py_ssize_t' to 'int', possible loss of data
  line_profiler/_line_profiler.cpp(28665): warning C4551: function call missing argument list
  line_profiler/_line_profiler.cpp(28666): warning C4551: function call missing argument list
  line_profiler/_line_profiler.cpp(28667): warning C4551: function call missing argument list
  line_profiler/_line_profiler.cpp(29168): warning C4244: '=': conversion from 'Py_ssize_t' to 'long', possible loss of data
  line_profiler/_line_profiler.cpp(31597): warning C4551: function call missing argument list
  line_profiler/_line_profiler.cpp(31604): warning C4551: function call missing argument list
  line_profiler/_line_profiler.cpp(32206): warning C4551: function call missing argument list
  line_profiler/_line_profiler.cpp(32207): warning C4551: function call missing argument list
  line_profiler/_line_profiler.cpp(32208): warning C4551: function call missing argument list
  line_profiler/_line_profiler.cpp(32386): warning C4244: '=': conversion from 'Py_ssize_t' to 'long', possible loss of data
  line_profiler/_line_profiler.cpp(32636): warning C4551: function call missing argument list
  line_profiler/_line_profiler.cpp(35412): warning C4551: function call missing argument list
  error: command 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.44.35207\\bin\\HostARM64\\ARM64\\cl.exe' failed with exit code 2

I think that's happening is that you're including the internal header pycore_atomic.h transiently, and it doesn't work in C++ mode.

It's possible (but I'm not sure) that leaving the standard library atomics on might help.

# ifdef HAVE_STD_ATOMIC
# undef HAVE_STD_ATOMIC
# endif

(Note that Github Actions has a windows-11-arm runner so this is an easy way to test)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions