Skip to content

Conversation

@zivy
Copy link
Member

@zivy zivy commented Dec 31, 2025

Add support for building and testing on Windows OS in a consistent manner to Linux and macOS.
Repository URL and tag are specified in a shared
configuration file (SITK_CONFIG) which is used
by both the configure and configure.win scripts.
Testing is performed in CircleCI as it offers a
more powerful build machine under the free plan.

@zivy zivy force-pushed the addWindowsSupport branch 15 times, most recently from 241c015 to ef62e01 Compare January 6, 2026 02:09
@Artur-man
Copy link

trying now with my local win, but it seems MAKEJ and ADDITIONAL_SITK_MODULES are not being passed to cmake at all.

@Artur-man
Copy link

Artur-man commented Jan 12, 2026

as a side note, configure.vars does not apply to windows ... thus these variables have to be set as environmental variables before installation
https://support.posit.co/hc/en-us/articles/200486518-Customizing-Package-Build-Options-in-the-RStudio-IDE

Sys.setenv("ADDITIONAL_SITK_MODULES"="-DSIMPLEITK_USE_ELASTIX=ON")
Sys.setenv("MAKEJ"="6")
remotes::install_github("SimpleITK/SimpleITKRInstaller")

Add support for building and testing on Windows OS
in a consistent manner to Linux and macOS. On
Windows, this uses RTools to provide the necessary
build tools. Testing is performed in CircleCI as
it offers a more powerful build machine under
the free plan.

Co-authored-by: Artur-man <artur-man@hotmail.com>
@zivy zivy force-pushed the addWindowsSupport branch from ef62e01 to cc78177 Compare January 13, 2026 16:02
@Artur-man
Copy link

Artur-man commented Jan 23, 2026

i think the issue is with Rtools not seeing the make, there seems to be a quick fix for that, which i check before installing the package.
https://github.com/BIMSBbioinfo/SimpleITKRInstaller/tree/release

UPDATE: getting close, it seems working with powershell instead of bash is solving the problem. An issue could be to write a separate workflow for windows, I will try unfying mac and win runs afterwards.

@Artur-man
Copy link

Artur-man commented Jan 25, 2026

It is working!, since configure.win is (because we set as so) working on bash, I moved setting RTOOLS_HOME to configure.win directly. Everything else is in powershell.

Screenshot 2026-01-25 at 11 19 41

@Artur-man
Copy link

Artur-man commented Jan 25, 2026

It seems windows require a separate cmake setup because i am getting these compilation errors:

[ 59%] Building C object Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat/CMakeFiles/gdcmMSFF.dir/__/__/Utilities/gdcmext/csa.c.obj
[ 59%] Building C object Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat/CMakeFiles/gdcmMSFF.dir/__/__/Utilities/gdcmext/mec_mr3.c.obj
[ 59%] Building C object Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat/CMakeFiles/gdcmMSFF.dir/__/__/Utilities/gdcmext/mec_mr3_io.c.obj
C:/bld/Build/ITK/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmext/mec_mr3_io.c: In function 'aligned_alloc_impl':
C:/bld/Build/ITK/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmext/mec_mr3_io.c:146:15: error: implicit declaration of function 'posix_memalign' [-Wimplicit-function-declaration]
  146 |   int error = posix_memalign(&allocPtr, alignment, size);
      |               ^~~~~~~~~~~~~~
make[6]: *** [Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat/CMakeFiles/gdcmMSFF.dir/build.make:1625: Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat/CMakeFiles/gdcmMSFF.dir/__/__/Utilities/gdcmext/mec_mr3_io.c.obj] Error 1

UPDATE: looked over the web but couldn't find any specific solution, caused by gdcm ? Using -DITK_USE_SYSTEM_ZLIB:BOOL=ON \ skips one of the compilations that invokes posix but then the same error occurs somewhere else still.

@Artur-man
Copy link

@zivy know any fix to this posix_memalign error ?

@blowekamp
Copy link
Member

The following check looks suspicious for a mingw compiler:
https://github.com/InsightSoftwareConsortium/ITK/blob/5be898bdeadd8c7d2de6daa9962489ed391782e6/Modules/ThirdParty/GDCM/src/gdcm/Utilities/gdcmext/mec_mr3_io.c#L315-L323

I'll have to check to see if ITK has any current build with this compiler.

@Artur-man
Copy link

Artur-man commented Jan 29, 2026

I have tried the win build on my local win machine too and i am getting the same error, thus I will also try GHA in
https://github.com/Artur-man/ITKR/blob/master/configure.win

Getting the same error with the ITK build:
https://github.com/Artur-man/ITKR/actions/runs/21477502152/job/61865100103

C:\Users\runneradmin\AppData\Local\Temp\Rtmp6FJg3S\R.INSTALL2188552d2b27\ITKR\src\itks\Modules\ThirdParty\GDCM\src\gdcm\Utilities\gdcmext\mec_mr3_io.c
C:\Users\runneradmin\AppData\Local\Temp\Rtmp6FJg3S\R.INSTALL2188552d2b27\ITKR\src\itks\Modules\ThirdParty\GDCM\src\gdcm\Utilities\gdcmext\mec_mr3_io.c: In function 'aligned_alloc_impl':
C:\Users\runneradmin\AppData\Local\Temp\Rtmp6FJg3S\R.INSTALL2188552d2b27\ITKR\src\itks\Modules\ThirdParty\GDCM\src\gdcm\Utilities\gdcmext\mec_mr3_io.c:146:15: error: implicit declaration of function 'posix_memalign' [-Wimplicit-function-declaration]
  146 |   int error = posix_memalign(&allocPtr, alignment, size);
      |               ^~~~~~~~~~~~~~
mingw32-make[3]: *** [Modules\ThirdParty\GDCM\src\gdcm\Source\MediaStorageAndFileFormat\CMakeFiles\gdcmMSFF.dir\build.make:1627: Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat/CMakeFiles/gdcmMSFF.dir/__/__/Utilities/gdcmext/mec_mr3_io.c.obj] Error 1

@blowekamp
Copy link
Member

blowekamp commented Jan 29, 2026

What should be tested is building vanilla ITK with the mingw compiler.

I suspect that a the preprocessor logic around this function need adjustment:
https://github.com/search?q=repo%3Amalaterre%2FGDCM%20posix_memalign&type=code

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