Skip to content

Conversation

@richardbeare
Copy link
Contributor

Compiler warnings are being elevated to errors when encountered by SimpelITKRInstaller - presumably a change of defaults in the package build process in more recent versions of R.
The various prints are all errors, so the calls have also been changed to REprintf

@blowekamp
Copy link
Member

Please rebase the changes onto the release branch.

Also can we get more detains about the compatibility of these functions. We should be able to list compatibility with R versions of the R Rprintf and the new REprintf methods.

@zivy
Copy link
Member

zivy commented Oct 17, 2024

Hi @richardbeare,

Please provide more details in the commit message. Specifically, what build warning and at what version of R was it changed to an error. We want to be able to test these things on the development machines.

Also, I believe this change replaces printing to std::out with printing to std:err. The change makes sense in that the original code was printing to the wrong location, is this both a build fix and bug fix at the same time?

@richardbeare
Copy link
Contributor Author

Will get onto the rebasing - apologies, I always forget where to begin the modifications.

Further details that will get included in the new PR.
Warnings/errors raised below, on ubuntu 22, R 4.4.1. The warnings are elevated to errors by R when installation via SimpleITKRInstaller is attempted.

There are two changes - string formatting and use of REprintf. @zivy zivy Do you prefer them to be separate commits in the next PR, or is documentation sufficient?

/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx: In function ‘SEXPREC* ImAsArray(itk::simple::Image)’:
/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx:54:15: error: format not a string literal and no format arguments [-Werror=format-security]
   54 |       Rprintf(error_msg);
      |               ^~~~~~~~~
/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx:207:15: error: format not a string literal and no format arguments [-Werror=format-security]
  207 |       Rprintf(error_msg);
      |               ^~~~~~~~~
/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx: In function ‘itk::simple::Image ArrayAsIm(SEXP, std::vector<unsigned int>, std::vector<double>, std::vector<double>, unsigned int)’:
/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx:237:13: error: format not a string literal and no format arguments [-Werror=format-security]
  237 |     Rprintf(error_msg);
      |             ^~~~~~~~~
cc1plus: some warnings being treated as errors
make[5]: *** [Wrapping/R/CMakeFiles/SimpleITK_R.dir/build.make:460: Wrapping/R/CMakeFiles/SimpleITK_R.dir/sitkRArray.cxx.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:1855: Wrapping/R/CMakeFiles/SimpleITK_R.dir/all] Error 2
make[3]: *** [Makefile:156: all] Error 2
make[2]: *** [CMakeFiles/SimpleITK-build.dir/build.make:76: SimpleITK-prefix/src/SimpleITK-stamp/SimpleITK-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:289: CMakeFiles/SimpleITK-build.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
ERROR: configuration failed for package ‘SimpleITK’
* removing ‘/home/richard.beare/R/x86_64-pc-linux-gnu-library/4.4/SimpleITK’

@richardbeare
Copy link
Contributor Author

See PR - #2207
This is branched from release.

@blowekamp
Copy link
Member

Will get onto the rebasing - apologies, I always forget where to begin the modifications.

Further details that will get included in the new PR. Warnings/errors raised below, on ubuntu 22, R 4.4.1. The warnings are elevated to errors by R when installation via SimpleITKRInstaller is attempted.

There are two changes - string formatting and use of REprintf. @zivy zivy Do you prefer them to be separate commits in the next PR, or is documentation sufficient?

/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx: In function ‘SEXPREC* ImAsArray(itk::simple::Image)’:
/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx:54:15: error: format not a string literal and no format arguments [-Werror=format-security]
   54 |       Rprintf(error_msg);
      |               ^~~~~~~~~
/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx:207:15: error: format not a string literal and no format arguments [-Werror=format-security]
  207 |       Rprintf(error_msg);
      |               ^~~~~~~~~
/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx: In function ‘itk::simple::Image ArrayAsIm(SEXP, std::vector<unsigned int>, std::vector<double>, std::vector<double>, unsigned int)’:
/tmp/RtmpSL0fo1/R.INSTALL1a911b1dcfc5df/SimpleITK/SITK/SimpleITK/Wrapping/R/sitkRArray.cxx:237:13: error: format not a string literal and no format arguments [-Werror=format-security]
  237 |     Rprintf(error_msg);
      |             ^~~~~~~~~
cc1plus: some warnings being treated as errors
make[5]: *** [Wrapping/R/CMakeFiles/SimpleITK_R.dir/build.make:460: Wrapping/R/CMakeFiles/SimpleITK_R.dir/sitkRArray.cxx.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:1855: Wrapping/R/CMakeFiles/SimpleITK_R.dir/all] Error 2
make[3]: *** [Makefile:156: all] Error 2
make[2]: *** [CMakeFiles/SimpleITK-build.dir/build.make:76: SimpleITK-prefix/src/SimpleITK-stamp/SimpleITK-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:289: CMakeFiles/SimpleITK-build.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
ERROR: configuration failed for package ‘SimpleITK’
* removing ‘/home/richard.beare/R/x86_64-pc-linux-gnu-library/4.4/SimpleITK’

Any idea on compatibility of this change? With what version of R is it required? With what versions of R is it compatible? Will it break any older versions of R?

@richardbeare
Copy link
Contributor Author

richardbeare commented Oct 21, 2024 via email

@zivy zivy merged commit c4e520a into SimpleITK:master Oct 23, 2024
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.

4 participants