Skip to content

[unopy] build wheels for Windows#480

Merged
cvanaret merged 171 commits intomainfrom
wheels_windows
Mar 6, 2026
Merged

[unopy] build wheels for Windows#480
cvanaret merged 171 commits intomainfrom
wheels_windows

Conversation

@cvanaret
Copy link
Owner

No description provided.

@cvanaret
Copy link
Owner Author

cvanaret commented Dec 16, 2025

Hi @AntoineD,
you might be able to help me :) I'm trying to build Python wheels for Windows via cibuildwheel and scikit-build-core and I'd like to compile with gcc/g++/gfortran (because Uno needs a Fortran compiler to perform name mangling). Impossible to get CMake to use them instead of MSVC though 😞

I tried installing msys2/setup-msys2@v2 and setting environment variables:

echo "CC=gcc" >> $env:GITHUB_ENV
echo "CXX=g++" >> $env:GITHUB_ENV
echo "FC=gfortran" >> $env:GITHUB_ENV

but I still get:

  -- The C compiler identification is MSVC 19.44.35221.0
  -- The CXX compiler identification is MSVC 19.44.35221.0
...
    No CMAKE_Fortran_COMPILER could be found.

Also tried a bunch of other solutions.

Hope you can help me out!
Thanks,
Charlie

@cvanaret cvanaret changed the title [unopy] try building wheels for windows-11-arm [unopy] try building wheels for windows-2022 Dec 17, 2025
@AntoineD
Copy link

Hello,

I missed your message, sorry about that (Thanks @FrancoisGallard for pinging me)

You may have a look to pdfo which build involves fortran too, but they use meson instead of cmake (remember?)

@cvanaret
Copy link
Owner Author

Hi @amontoison,
I finally managed to run CMake with MinGW compilers 🥳 Uno compiles but the linking phase fails with stuff like:

C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/a/Uno/Uno/dependencies/lib/libmetis.a(kmetis.c.obj):kmetis.c:(.text+0x71): undefined reference to `_setjmp'

See full log here.

Any idea what the issue might be? Note: it's not urgent ;)

@amontoison
Copy link
Collaborator

I checked a little bit online and you need to link additional libraries on Windows.
It seems that -lmingwex could help.
The symbol _setjmp is standard on linux / mac but not on Windows... And MinGW / MSVC / etc... have all their own version 🙄

@amontoison
Copy link
Collaborator

@cvanaret A solution that is sure to work is to link with libgcc_s.a available in the folder lib of CompilerSupportLibraries_jll.jl.

@cvanaret
Copy link
Owner Author

@cvanaret A solution that is sure to work is to link with libgcc_s.a available in the folder lib of CompilerSupportLibraries_jll.jl.

Thanks! I'll play around with a few more ideas, if they don't work I'll try this out!

@amontoison
Copy link
Collaborator

The linker also complains for symbols in HiGHS (from standard C++...). I hate this platform.

@cvanaret
Copy link
Owner Author

The linker also complains for symbols in HiGHS (from standard C++...). I hate this platform.

Oh yeah I had missed this one. What a f nightmare.

@cvanaret
Copy link
Owner Author

Thanks @amontoison! That's odd:

libmsvcrt.a(libmsvcrt_defs00217.o):(.text+0x0): multiple definition of `_exit'; C:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingw32.a(lib64_libmingw32_a-exit_wrappers.o):exit_wrappers.:(.text+0x10): first defined here

The other issue is that the hard-coded dependencies/lib/gcc/x86_64-w64-mingw32/14/libmsvcrt.a does not exist on other platforms.

Let me try another chatGPT idea 😏

@amontoison
Copy link
Collaborator

amontoison commented Feb 11, 2026

@cvanaret bytecodealliance/wasmtime-go#192
Can you install mingw-w64 v11.2 and not the latest one?

@cvanaret
Copy link
Owner Author

@amontoison good idea! I guess we want to stay in sync with BinaryBuilder.jl?

@amontoison
Copy link
Collaborator

@amontoison good idea! I guess we want to stay in sync with BinaryBuilder.jl?

I think I use 10.2 in BinaryBuilder.jl but if we have _setjmp in 11.2, it is fine.

@cvanaret
Copy link
Owner Author

@amontoison good idea! I guess we want to stay in sync with BinaryBuilder.jl?

I think I use 10.2 in BinaryBuilder.jl but if we have _setjmp in 11.2, it is fine.

Got it. Downgrading doesn't seem trivial on my side, so if you can upgrade to v13.0, don't hesitate 😅

@cvanaret cvanaret changed the title [unopy] try building wheels for windows-2022 [unopy] try building wheels for Windows Feb 11, 2026
@cvanaret cvanaret changed the title [unopy] try building wheels for Windows [unopy] build wheels for Windows Feb 11, 2026
@amontoison
Copy link
Collaborator

pkg_python

@amontoison
Copy link
Collaborator

@cvanaret
Copy link
Owner Author

@cvanaret
Copy link
Owner Author

cvanaret commented Mar 6, 2026

@amontoison victory!!!!
The TestPyPI artifacts run successfully on [ubuntu-latest, ubuntu-24.04-arm, macos-latest, macos-15-intel, windows-latest].
We're ready to merge.

@cvanaret cvanaret merged commit dda1508 into main Mar 6, 2026
21 of 46 checks passed
@amontoison amontoison deleted the wheels_windows branch March 6, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants