msolve icon indicating copy to clipboard operation
msolve copied to clipboard

Port to Windows

Open wegank opened this issue 7 months ago • 0 comments

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.

Does the so-ported msolve work? Well, 54/56 tests passed on my aarch64-windows machine, with the two failing tests differing by the sizes of some root bounding boxes (probably some miscellaneous precision issues?) and thus non-blocking. I'd say that's satisfactory enough.

wegank avatar May 28 '25 00:05 wegank