ANTsX / ANTsRCore

Rcpp bindings for the C++ ANTs library used by the ANTsR package
9 stars 9 forks source link

installation problem #147

Open boboshaq opened 2 years ago

boboshaq commented 2 years ago

Describe the bug I can't install ANTsRCore because of error: compilation failed for package 'ANTsRCore'

To Reproduce

  1. mkdir antsrcore
  2. cd antsrcore
  3. wget https://github.com/ANTsX/ANTsRCore/archive/refs/tags/v0.7.5.0.tar.gz
  4. R CMD INSTALL v0.7.5.0.tar.gz

Screenshots

/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkImageBufferRange.h:470:62: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkImageBufferRange.h:477:5: error: 'reference' does not name a type
     reference operator[](const difference_type n) const noexcept { return *(*this + n); }
     ^
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkImageBufferRange.h:482:40: error: expected ';' at end of member declaration
     operator=(const QualifiedIterator &) noexcept = default;
                                        ^
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkImageBufferRange.h:482:42: error: 'noexcept' does not name a type
     operator=(const QualifiedIterator &) noexcept = default;
                                          ^
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkImageBufferRange.h:482:42: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkImageBufferRange.h:485:10: error: 'constexpr' does not name a type
   static constexpr bool IsImageTypeConst = std::is_const<TImage>::value;
          ^
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkImageBufferRange.h:485:10: note: C++11 'constexpr' only available with -std=c++11 or -std=gnu++11
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkImageBufferRange.h:487:9: error: expected nested-name-specifier before 'QualifiedInternalPixelType'
   using QualifiedInternalPixelType = std::conditional_t<IsImageTypeConst, const InternalPixelType, InternalPixelType>;
         ^
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkImageBufferRange.h:489:9: warning: override controls (override/final) only available with -std=c++11 or -std=gnu++11
   class AccessorFunctorInitializer final
         ^
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkImageBufferRange.h:492:5: error: 'ImageType' does not name a type
     ImageType & m_Image;
     ^
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkImageBufferRange.h:495:51: error: expected ')' before '&' token
     explicit AccessorFunctorInitializer(ImageType & image) noexcept
                                                   ^
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkImageBufferRange.h:499:37: error: expected ';' at end of member declaration
     operator EmptyAccessorFunctor() const noexcept { return {}; }
                                     ^
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkImageBufferRange.h:499:43: error: 'noexcept' does not name a type
     operator EmptyAccessorFunctor() const noexcept { return {}; }
                                           ^
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkImageBufferRange.h:499:43: note: C++11 'noexcept' only available with -std=c++11 or -std=gnu++11
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkImageBufferRange.h:501:14: error: expected type-specifier before 'AccessorFunctorType'
     operator AccessorFunctorType() const noexcept
              ^
In file included from ../inst/include/ANTS_affine_registration2.h:23:0,
                 from ../inst/include/itkANTSImageRegistrationOptimizer.h:49,
                 from ANTSIntegrateVelocityField.cpp:13:
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkTransformFileReader.h:144:20: error: expected '}' before end of line
 ITK_GCC_PRAGMA_DIAG_PUSH()
                    ^
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkTransformFileReader.h:144:20: error: expected unqualified-id before end of line
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkTransformFileReader.h:144:20: error: expected '}' before end of line
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkTransformFileReader.h:144:20: error: expected unqualified-id before end of line
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkTransformFileReader.h:144:20: error: expected '}' before end of line
/R/4.2.1/lib64/R/library/ITKR/libs/include/ITK-5.3/itkTransformFileReader.h:144:20: error: expected declaration before end of line
make: *** [ANTSIntegrateVelocityField.o] Error 1
ERROR: compilation failed for package 'ANTsRCore'
* removing '/R/4.2.1/lib64/R/library/ANTsRCore'

Desktop (please complete the following information):

boboshaq commented 2 years ago

I think that this is a problem with gcc versions. ITKR was compiled with different version of gcc than this ANTsCORE installation. I have multiple versions of gcc installed in my system. Default gcc in my system is 4.8.5 version but I may use 5.5.0 and 7.5.0 versions too. Originally installed version 4.8.5 is to old to install ITKR+ANTsCORE+ANTsR packages so I typically use 7.5.0 version (before i tried 5.5.0 version). I have it in my PATH and lib64 path is in LD_LIBRARY_PATH variable . While ITKR use 7.5.0 gcc version, ANTsCORE and ANTsR use 4.8.5 version inside R installation and in cmdline installation (R CMD INSTALL). They do not use ~/.R/Makevars file at all. In my case, to install ANTsCORE and ANTsR packages I had to export CXX and CC variable with pathes to 7.5.0 version of gcc before installation begins (R CMD INSTALL ...)