SyneRBI / SIRF

Main repository for the CCP SynerBI software
http://www.ccpsynerbi.ac.uk
Other
58 stars 29 forks source link

New build errors on windows #496

Closed evgueni-ovtchinnikov closed 3 years ago

evgueni-ovtchinnikov commented 4 years ago

Got these error messages when building SIRF master on Windows 10:

2>C:\Users\wps46139\Documents\GitHub\build\SIRF-SuperBuild\sources\SIRF\src\Registration\NiftyMoMo\BSplineTransformation.cpp(381): error C3028: 'NiftyMoMo::BSplineTransformation::controlPointGridImage': only a variable or static data member can be used in a data-sharing clause

2>C:\Users\wps46139\Documents\GitHub\build\SIRF-SuperBuild\sources\SIRF\src\Registration\NiftyMoMo\BSplineTransformation.cpp(527): error C3028: 'NiftyMoMo::BSplineTransformation::controlPointGridImage': only a variable or static data member can be used in a data-sharing clause

2>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\numeric(98): error C2794: 'iterator_category': is not a member of any direct or indirect base class of 'std::iterator_traits<_InIt1>'
2>          with
2>          [
2>              _InIt1=sirf::NiftiImageData<float>::Iterator_const
2>          ]
2>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\numeric(111): note: see reference to function template instantiation '_Ty std::_Inner_product_no_deprecate<_InIt1,_InIt2,_Ty,_Fn21,_Fn22>(_InIt1,_InIt1,_InIt2,_Ty,_Fn21 &,_Fn22 &)' being compiled
2>          with
2>          [
2>              _Ty=float,
2>              _InIt1=sirf::NiftiImageData<float>::Iterator_const,
2>              _InIt2=sirf::NiftiImageData<float>::Iterator_const,
2>              _Fn21=std::plus<void>,
2>              _Fn22=std::multiplies<void>
2>          ]
2>  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\numeric(139): note: see reference to function template instantiation '_Ty std::inner_product<_InIt1,_InIt2,_Ty,std::plus<void>,std::multiplies<void>>(_InIt1,_InIt1,_InIt2,_Ty,_Fn21,_Fn22)' being compiled
2>          with
2>          [
2>              _Ty=float,
2>              _InIt1=sirf::NiftiImageData<float>::Iterator_const,
2>              _InIt2=sirf::NiftiImageData<float>::Iterator_const,
2>              _Fn21=std::plus<void>,
2>              _Fn22=std::multiplies<void>
2>          ]
2>  C:\Users\wps46139\Documents\GitHub\build\SIRF-SuperBuild\sources\SIRF\src\Registration\cReg\NiftiImageData.cpp(1299): note: see reference to function template instantiation '_Ty std::inner_product<sirf::NiftiImageData<dataType>::Iterator_const,sirf::NiftiImageData<dataType>::Iterator_const,dataType>(_InIt1,_InIt1,_InIt2,_Ty)' being compiled
2>          with
2>          [
2>              _Ty=float,
2>              dataType=float,
2>              _InIt1=sirf::NiftiImageData<float>::Iterator_const,
2>              _InIt2=sirf::NiftiImageData<float>::Iterator_const
2>          ]
2>  C:\Users\wps46139\Documents\GitHub\build\SIRF-SuperBuild\sources\SIRF\src\Registration\cReg\NiftiImageData.cpp(1298): note: while compiling class template member function 'float sirf::NiftiImageData<dataType>::get_inner_product(const sirf::NiftiImageData<dataType> &) const'
2>          with
2>          [
2>              dataType=float
2>          ]
2>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\numeric(98): error C2938: '_Iter_cat_t<sirf::NiftiImageData<dataType>::Iterator_const>' : Failed to specialize alias template
2>          with
2>          [
2>              dataType=float
2>          ]
2>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\numeric(98): error C2062: type 'unknown-type' unexpected

9>test_cReg.obj : error LNK2019: unresolved external symbol "public: float __cdecl sirf::NiftiImageData<float>::get_inner_product(class sirf::NiftiImageData<float> const &)const " (?get_inner_product@?$NiftiImageData@M@sirf@@QEBAMAEBV12@@Z) referenced in function main
9>C:\Users\wps46139\Documents\GitHub\build\SIRF-SuperBuild\builds\SIRF\build\src\Registration\cReg\tests\Release\REG_TEST_CPLUSPLUS.exe : fatal error LNK1120: 1 unresolved externals
evgueni-ovtchinnikov commented 4 years ago

@KrisThielemans This is the first time trying to compile SIRF's registration classes on Windows. Have you ever tried/succeeded?

It seems there are two problems:

  1. something to do with the iterator class (abstract in SIRF ImageData.h, so needs to be specified in inherited classes), probably because NiftiImageData is a templated class, whereas STIRImageData and Gadgetron's ImageWrap aren't.
  2. a Windows/OpenMP problem. A member variable is passed as a shared variable to the OpenMP loop, and it seems that Windows isn't happy with that (but linux travis builds are all ok, some of which have OpenMP enabled).

Do you think you could give the compilation a go and let us know if either solution is immediately obvious to you? It slightly goes over @rijobro 's head.

evgueni-ovtchinnikov commented 3 years ago

I do not seem to have any problem with SIRF Registration code any more.