Can not build the project in W11 on ARM64
alexwan7 opened this issue · 5 comments
I failed to install the package directly from PIP or manual build.
I found a related issue opened at #644 (comment) from two years ago. I installed all the tools and dependencies mentioned in the comment and repository's Manual Build section. However, I see bunch of error messages related to the cmake building.
I am wondering if ARM64 on W11 is supported? Could you please add the ARM64 on windows wheel to the CI?
Please provide native wheel for WoA. GitHub Actions now supports win-arm64 for free.
Due to the library's popularity, a native version for the growing number of Windows on ARM (WoA) devices offers a better user experience
Latest info about the build process I have:
- VS22 with v143 toolkits. No success.
- VS19 with v142 toolkits. No success. Issue with virtual memory. Couldn't make it work.
- Got back to VS22 to debug those errors. Issues are related to FP16 support or better to say non-support. MSVC++ doesn't support FP16 identifiers used all across opencv-python codebase. Tried replacing them with known data types, but it would take some time considering how deep some of them are inside modules.
- Had to turn off NEON flag. Take a look at the snippet
- After carefully examining all problematic paths, turned out they are related to only two files - Winograd convolution and standard convolution. Both part of so-called DNN module.
- I simply turned DNN modules build off and build it without them.
cmake_args.append("-DBUILD_opencv_dnn=OFF")
cmake_args.append("-DENABLE_NEON=OFF")related #806
- I simply turned DNN modules build off and build it without them.
cmake_args.append("-DBUILD_opencv_dnn=OFF")
cmake_args.append("-DENABLE_NEON=OFF")
Thanks!
So in GitHub action, this is how I achieved it:
env:
# https://github.com/opencv/opencv-python#source-distributions
# Allows building OpenCV on Windows ARM64
# https://github.com/opencv/opencv-python/issues/1092#issuecomment-2862538656
CMAKE_ARGS: "-DBUILD_opencv_dnn=OFF -DENABLE_NEON=OFF"
jobs:
Build:
runs-on: windows-11-arm
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.13
- run: pip install opencv-contrib-python-headlessEdit: numpy 2.3.2 released with out of the box Python 3.14 support and solves my error below.
The above fix only seem to work for Python 3.13
For Python 3.14 Windows on ARM I'm getting the following errors: https://github.com/Toufool/AutoSplit/actions/runs/16301051322/job/46035468926?pr=323
[34/329] Linking target
numpy/_core/_struct_ufunc_tests.cp314-win_arm64.pyd
FAILED: numpy/_core/_struct_ufunc_tests.cp314-win_arm64.pyd
"gcc" -o numpy/_core/_struct_ufunc_tests.cp314-win_arm64.pyd
numpy/_core/_struct_ufunc_tests.cp314-win_arm64.pyd.p/src_umath__struct_ufunc_tests.c.obj
"-Wl,--allow-shlib-undefined" "-Wl,-O1" "-shared" "-Wl,--start-group"
"-Wl,--out-implib=numpy\_core\_struct_ufunc_tests.cp314-win_arm64.dll.a"
"-lm" "-lucrt" "-static"
"C:\hostedtoolcache\windows\Python\3.14.0-beta.4\arm64\python314.dll"
"-lkernel32" "-luser32" "-lgdi32" "-lwinspool" "-lshell32" "-lole32"
"-loleaut32" "-luuid" "-lcomdlg32" "-ladvapi32" "-Wl,--end-group"
C:\hostedtoolcache\windows\Python\3.14.0-beta.4\arm64\python314.dll:
file not recognized: file format not recognized
collect2.exe: error: ld returned 1 exit status
[35/329] Linking target numpy/_core/_umath_tests.cp314-win_arm64.pyd
FAILED: numpy/_core/_umath_tests.cp314-win_arm64.pyd
"gcc" -o numpy/_core/_umath_tests.cp314-win_arm64.pyd
numpy/_core/_umath_tests.cp314-win_arm64.pyd.p/meson-generated__umath_tests.c.obj
numpy/_core/_umath_tests.cp314-win_arm64.pyd.p/src_common_npy_cpu_features.c.obj
"-Wl,--allow-shlib-undefined" "-Wl,-O1" "-shared" "-Wl,--start-group"
"-Wl,--out-implib=numpy\_core\_umath_tests.cp314-win_arm64.dll.a"
"-lm" "-lucrt" "-static" "numpy/_core/lib_umath_tests_mtargets.a"
"C:\hostedtoolcache\windows\Python\3.14.0-beta.4\arm64\python314.dll"
"-lkernel32" "-luser32" "-lgdi32" "-lwinspool" "-lshell32" "-lole32"
"-loleaut32" "-luuid" "-lcomdlg32" "-ladvapi32" "-Wl,--end-group"
C:\hostedtoolcache\windows\Python\3.14.0-beta.4\arm64\python314.dll:
file not recognized: file format not recognized
collect2.exe: error: ld returned 1 exit status
[36/329] Linking target numpy/_core/_multiarray_tests.cp314-win_arm64.pyd
FAILED: numpy/_core/_multiarray_tests.cp314-win_arm64.pyd
"c++" -o numpy/_core/_multiarray_tests.cp314-win_arm64.pyd
numpy/_core/_multiarray_tests.cp314-win_arm64.pyd.p/meson-generated__multiarray_tests.c.obj
numpy/_core/_multiarray_tests.cp314-win_arm64.pyd.p/src_common_mem_overlap.c.obj
numpy/_core/_multiarray_tests.cp314-win_arm64.pyd.p/src_common_npy_argparse.c.obj
numpy/_core/_multiarray_tests.cp314-win_arm64.pyd.p/src_common_npy_hashtable.cpp.obj
"-Wl,--allow-shlib-undefined" "-Wl,-O1" "-shared" "-Wl,--start-group"
"-Wl,--out-implib=numpy\_core\_multiarray_tests.cp314-win_arm64.dll.a"
"-lucrt" "-static" "numpy/_core/libnpymath.a"
"C:\hostedtoolcache\windows\Python\3.14.0-beta.4\arm64\python314.dll"
"-lkernel32" "-luser32" "-lgdi32" "-lwinspool" "-lshell32" "-lole32"
"-loleaut32" "-luuid" "-lcomdlg32" "-ladvapi32" "-Wl,--end-group"
C:\hostedtoolcache\windows\Python\3.14.0-beta.4\arm64\python314.dll:
file not recognized: file format not recognized
collect2.exe: error: ld returned 1 exit status
Looks related to numpy, although i do target numpy >=2.4.0.dev0 from https://anaconda.org/scientific-python-nightly-wheels/numpy for Python 3.14 support