Add installation support for windows#82
Conversation
zivy
left a comment
There was a problem hiding this comment.
The windows runner does not seem to be identified correctly (if: startsWith(matrix.config.os, 'windows')), so the actual configuration and building were not run. Successful and fast run on the dashboard, but this isn't a real success. The CircleCI was successful and fast too, so I checked that too and it was indeed run and built.
@Artur-man was this executing for you under your repository?
|
@zivy thanks for catching this, looking at it now. |
|
Is this dependent on a fixed FindR.cmake file? When is that change needed? |
|
@blowekamp yes, will send over that PR too soon. |
|
@blowekamp I think we also need to update the ITK_TAG to the version where problem with GDCM was fixed. I have not touched it here since we only introduce the windows builders, we can leave the PR as it is until we release the fixes to upstream ? or ... ? |
|
It looks like I only back ported the change to ITK release-5.4 branch but never update SImpleITK's release (2.x) branch.
We could just work on the the 3.0.0a03 tag instead of back porting things. Your call based on your needs. |
|
ok, win builds in R=4.4.1 with new SimpleITK release and default ITK_TAG ... but gives a strange error in 4.3 (too big file size?) Will push this here too. Should I use v3.0.0a3 tag now ... one problem is that, this fails in Rcheck since R version cannot have letters ... so it has to be 3.0.0 or smthn |
Use the hash of SimpleITK release: 1899b2 |
|
@Artur-man We have the fixed in SimpleITK upstream with the needed fixes for compilation and cmake configuration. What are the next steps to move this forward? Any additional help needed? |
|
Thanks for checking in @blowekamp. I was preparing for a hackathon so ignored this PR for a while. I think I can start testing again after runs in another branch Currently, my main issue is with the version of the SimpleITK. Currently we parse that from the version field of the DESCRIPTION file in the R package bundle. But in order for build to be successful it should be a proper version number (e.g. 2.5.3 or 3.0.0), but say 3.0.0a3, 1899b2 or release is not acceptable. Is there a tag/version like that we can use now ? or should I pull from 3.0.0a3 or 1899b2 ? (again you cannot put them in DESCRIPTION) Which works fine in R 4.4.1 but 4.3 is failing for some reason |
|
@blowekamp seems my pushes are not triggering actions. |
|
I am not sure. There are some restrictions based on user, but I though I configured those so it would work for you. Please make a separate PR with just the trivial .gitignore changes. Perhaps having a commit in the repo will help. |
|
Hmm, seems I am not allowed to commit either. I thought I accepted the offer to contribute but perhaps it did not work ? |
I am not sure what you mean that you are not allow to commit. Please make a new branch locally, then add and commit the .gitignore change. Next push to your fork, and make a PR to this repo. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - name: Setup R | ||
| uses: r-lib/actions/setup-r@v2 | ||
| with: | ||
| r-version: ${{ matrix.R }} | ||
| - name: System Dependencies | ||
| if: startsWith( matrix.os, 'ubuntu' ) | ||
| run: | | ||
| sudo apt-get -y update && | ||
| sudo apt-get install -y libcurl4-openssl-dev libssh2-1-dev libharfbuzz-dev libfribidi-dev gh && | ||
| sudo rm -rf /var/lib/apt/lists/* | ||
| - name: Configuration Information | ||
| if: runner.os == 'Linux' || runner.os == 'macOS' | ||
| run: | | ||
| mkdir ${R_LIBS} | ||
| c++ --version | ||
| cmake --version | ||
| which R | ||
| R --version | ||
| - name: Configuration Information (Windows) | ||
| if: startsWith(matrix.os, 'windows') | ||
| shell: pwsh | ||
| run: | | ||
| New-Item -ItemType Directory -Force -Path "$env:R_LIBS" | Out-Null | ||
| g++ --version | ||
| cmake --version | ||
| Get-Command R.exe | ||
| R.exe --version |
There was a problem hiding this comment.
The Windows job doesn't install Rtools (or otherwise ensure a working MinGW toolchain is on PATH). Since configure.win requires Rtools and the workflow runs g++ --version and builds C++ code, add an explicit Rtools setup step (e.g., r-lib/actions/setup-rtools) and/or set RTOOLS_HOME so the build is reproducible on GitHub-hosted runners.
| Rscript -e "lib <- Sys.getenv('R_LIBS'); lib <- normalizePath(lib, winslash='/', mustWork=FALSE); dir.create(lib, recursive=TRUE, showWarnings=FALSE); install.packages('remotes', lib=lib, repos='https://cloud.r-project.org/')" | ||
| Rscript.exe -e "install.packages(c('remotes', 'desc'), repos='https://cloud.r-project.org/')" |
There was a problem hiding this comment.
The Windows package-install step installs remotes twice and installs desc without targeting the same library path as $env:R_LIBS. This can lead to packages landing in a non-writable default library or not being visible via .libPaths() during the build. Install both remotes and desc once, explicitly into $env:R_LIBS (after normalizing/creating it).
| Rscript -e "lib <- Sys.getenv('R_LIBS'); lib <- normalizePath(lib, winslash='/', mustWork=FALSE); dir.create(lib, recursive=TRUE, showWarnings=FALSE); install.packages('remotes', lib=lib, repos='https://cloud.r-project.org/')" | |
| Rscript.exe -e "install.packages(c('remotes', 'desc'), repos='https://cloud.r-project.org/')" | |
| Rscript.exe -e "lib <- Sys.getenv('R_LIBS'); lib <- normalizePath(lib, winslash='/', mustWork=FALSE); dir.create(lib, recursive=TRUE, showWarnings=FALSE); install.packages(c('remotes', 'desc'), lib=lib, repos='https://cloud.r-project.org/')" |
| export RTOOLS_HOME="$(ls -d /c/rtools* | head -n 1)" | ||
| if [ -z "$RTOOLS_HOME" ]; then | ||
| echo "Environment variable \"RTOOLS_HOME\" is not set!" 1>&2 |
There was a problem hiding this comment.
The script overwrites RTOOLS_HOME by auto-detecting /c/rtools* but then errors with "RTOOLS_HOME is not set". This is contradictory to the README instructions and prevents users from pinning a specific Rtools install. Only auto-detect when RTOOLS_HOME is empty, and improve the error message to reflect what was checked.
| export RTOOLS_HOME="$(ls -d /c/rtools* | head -n 1)" | |
| if [ -z "$RTOOLS_HOME" ]; then | |
| echo "Environment variable \"RTOOLS_HOME\" is not set!" 1>&2 | |
| if [ -z "$RTOOLS_HOME" ]; then | |
| for rtools_dir in /c/rtools*; do | |
| if [ -d "$rtools_dir" ]; then | |
| export RTOOLS_HOME="$rtools_dir" | |
| break | |
| fi | |
| done | |
| fi | |
| if [ -z "$RTOOLS_HOME" ]; then | |
| echo "Environment variable \"RTOOLS_HOME\" is not set, and no Rtools installation was found under /c/rtools*." 1>&2 |
| fi | ||
|
|
||
| # Update PATH to include Rtools binaries | ||
| export PATH="${RTOOLS_HOME}/usr/bin:${RTOOLS_HOME}/x86_64-w64-mingw32.static.posix/bin:${PATH}" |
There was a problem hiding this comment.
The PATH entry ${RTOOLS_HOME}/x86_64-w64-mingw32.static.posix/bin does not match the Rtools 4.5 layout suggested in the README (e.g., C:/rtools45 uses ucrt64/bin). As written, this will fail to find the compiler on current Rtools installations. Update the PATH logic to handle the current Rtools directory structure (or detect the correct subdir).
| export PATH="${RTOOLS_HOME}/usr/bin:${RTOOLS_HOME}/x86_64-w64-mingw32.static.posix/bin:${PATH}" | |
| if [ -d "${RTOOLS_HOME}/ucrt64/bin" ]; then | |
| RTOOLS_BIN="${RTOOLS_HOME}/ucrt64/bin" | |
| elif [ -d "${RTOOLS_HOME}/x86_64-w64-mingw32.static.posix/bin" ]; then | |
| RTOOLS_BIN="${RTOOLS_HOME}/x86_64-w64-mingw32.static.posix/bin" | |
| elif [ -d "${RTOOLS_HOME}/mingw64/bin" ]; then | |
| RTOOLS_BIN="${RTOOLS_HOME}/mingw64/bin" | |
| else | |
| echo "Could not find an Rtools compiler bin directory under ${RTOOLS_HOME}" 1>&2 | |
| exit 1 | |
| fi | |
| export PATH="${RTOOLS_HOME}/usr/bin:${RTOOLS_BIN}:${PATH}" |
|
not sure why the "file size is big" error in 4.3 but not in 4.4 ... |
|
In SimpleITK 3.0 this filter compilation of type was reduced with this change: SimpleITK/SimpleITK#2272 So hopefully this issue won't be there with shortly. Perhaps it's best to just drop this R version on windows for now? |
|
Yes I can remove 4.3 from windows build, but perhaps we should also renew the R versions as well (in another PR) ? 4.6 is coming up. r-universe builds normally do devel, release and old_release ... thus now it would be 4.6, 4.5 and 4.4. |
|
lastly, now we hard code the SITKTAG but normally should be parsed from DESCRIPTION: SimpleITKRInstaller/DESCRIPTION Lines 1 to 2 in 7c677dc How do you wanna do this @blowekamp ? I can update both Line 10 in 7c677dc Here is the message you gonna get when you put a versioning that R does not like, happens before the build: |
|
It should like hard coding SITKTAG is easiest to get things working and merged at this point. P.S. Also please squash all you commits. I think only one is needed in the repo's history. |
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>
289e9fc to
8a6edc6
Compare
|
This the first time I rebased ever :D let me know if it worked. |
zivy
left a comment
There was a problem hiding this comment.
@Artur-man Thank you for this significant contribution to the SimpleITK ecosystem 🎉 ✨
Having the installer work on windows will significantly increase the availability of SimpleITK to the R community, supporting imaging research from micro-scale 🔬, through meso-scale 🧠, to macro-scale 🔭
|
thanks guys @blowekamp @zivy @richardbeare |
This PR is based on discussions across #72 #78 #80 and meetings with @richardbeare @blowekamp @zivy.
fixes #72
Description
README.md.Notes
SimpleITK/SimpleITK(see WIP: Add support for Windows #78 for more information).