Skip to content

Port to Windows#214

Open
wegank wants to merge 3 commits intoalgebraic-solving:masterfrom
wegank:port-to-windows-0
Open

Port to Windows#214
wegank wants to merge 3 commits intoalgebraic-solving:masterfrom
wegank:port-to-windows-0

Conversation

@wegank
Copy link
Contributor

@wegank wegank commented May 28, 2025

This work was done during the JNCF 2025 and is now rebased on master. I guess I won't have time to clean up everything or split it into multiple PRs before going on vacation tonight, so I'm marking it as a draft (but at least it can serve as a demo).

In short, this is achieved by providing the following headers:

  • src/fglm/aligned_alloc.h, which provides a handwritten implementation of posix_memalign on Windows. I also provided posix_memalign_free for the reason in https://learn.microsoft.com/en-us/cpp/standard-library/cstdlib?view=msvc-170#remarks-6, and modified files doing free over memory allocated by posix_memalign to use posix_memalign_free.
  • src/msolve/getdelim.h, which provides Gnulib's implementation of getdelim and getline on Windows.

In addition, I modified src/neogb/sort_r.h to prevent undefined reference to qsort_r (though noporpoise/sort_r#17 might be a better idea), and added b to fopen access modes so that we have LF instead of CRLF on Windows. I modified src/usolve/refine.c to use mpz_get_ull from Bitwuzla instead of mpz_get_ui to always get 64-bit integers even if long is 32-bit. I also fixed a few bugs that will be the subject of separate PRs.

All tests passed on CI and my aarch64-windows machine.

Copy link
Contributor

@ederc ederc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit f72bc6c is already included in #252.

@wegank
Copy link
Contributor Author

wegank commented Dec 15, 2025

Sure, my goal was precisely to split this into multiple PRs to make it easier to review; I included the last three commits because each of them is necessary to fix part of the tests on Windows.

@wegank
Copy link
Contributor Author

wegank commented Mar 8, 2026

I had almost forgot that I had this PR on Windows, and it is already post JNCF 2026, so another quick rebase; I haven't checked if everything still works on Windows (the CI should tell me anyway).

@talregev
Copy link

talregev commented Mar 12, 2026

This PR can also handle the msvc atan2?

I check with the AI, it only the test on configure.ac, that can test with flags for configure.

@wegank
Copy link
Contributor Author

wegank commented Mar 12, 2026

This port targets MinGW. I assume that MSVC support won't be available until CMake builds are implemented…

@talregev
Copy link

This port targets MinGW. I assume that MSVC support won't be available until CMake builds are implemented…

That not true. In vcpkg we can compile msvc with autoconf.
I already succeeded to run the config step, now it fail on build step, and that you PR is needed.

@wegank
Copy link
Contributor Author

wegank commented Mar 12, 2026

Ah, that's good news. I really should try to figure out how to build with MSVC one day.

@talregev
Copy link

I can help you to do it on the ci.

currently when I compile with msvc (without your PR)
I get this error:

C:\src\vcpkg\buildtrees\msolve\src\v0.9.4-7cd9c24250.clean\src\usolve../neogb/tools.h(25): fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory

Do you want first let your PR merge, then we can deal with msvc errors?

@wegank
Copy link
Contributor Author

wegank commented Mar 12, 2026

I can help you to do it on the ci.

currently when I compile with msvc (without your PR) I get this error:

C:\src\vcpkg\buildtrees\msolve\src\v0.9.4-7cd9c24250.clean\src\usolve../neogb/tools.h(25): fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory

This looks like a portability issue. If you find a solution, feel free to open a new PR for that.

Do you want first let your PR merge, then we can deal with msvc errors?

I don't think this PR will be merged anytime soon. As you can see, there has been no new review for a few months, while my other PRs are processed rather quickly. It is clear that Windows support is absolutely not a priority for the devs…

@talregev
Copy link

It is clear that Windows support is absolutely not a priority for the devs…

I guess the msvc support is very low priority as well.

@talregev
Copy link

Keep your good job and split this PR to many smaller PRs that devs may be interested.

@wegank wegank force-pushed the port-to-windows-0 branch from ae7e0a8 to 3562257 Compare March 12, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants