SyneRBI / SIRF

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

Windows 10 build errors #587

Closed evgueni-ovtchinnikov closed 3 years ago

evgueni-ovtchinnikov commented 4 years ago

This issue was created by my mistake on ULS/STIR (issue 461), reproducing here now.

Building SIRF on my Windows 10 laptop I get:

1>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
1>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

Commenting out the two offendng #pragma omp, I get another error caused apparently by NiftiImageData<dataType>::get_inner_product():

7>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>'
7>          with
7>          [
7>              _InIt1=sirf::NiftiImageData<float>::Iterator_const
7>          ]
7>  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
7>          with
7>          [
7>              _Ty=float,
7>              _InIt1=sirf::NiftiImageData<float>::Iterator_const,
7>              _InIt2=sirf::NiftiImageData<float>::Iterator_const,
7>              _Fn21=std::plus<void>,
7>              _Fn22=std::multiplies<void>
7>          ]
7>  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
7>          with
7>          [
7>              _Ty=float,
7>              _InIt1=sirf::NiftiImageData<float>::Iterator_const,
7>              _InIt2=sirf::NiftiImageData<float>::Iterator_const,
7>              _Fn21=std::plus<void>,
7>              _Fn22=std::multiplies<void>
7>          ]
7>  C:\Users\wps46139\Documents\GitHub\build\SIRF-SuperBuild\sources\SIRF\src\Registration\cReg\NiftiImageData.cpp(1438): 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
7>          with
7>          [
7>              _Ty=float,
7>              dataType=float,
7>              _InIt1=sirf::NiftiImageData<float>::Iterator_const,
7>              _InIt2=sirf::NiftiImageData<float>::Iterator_const
7>          ]
7>  C:\Users\wps46139\Documents\GitHub\build\SIRF-SuperBuild\sources\SIRF\src\Registration\cReg\NiftiImageData.cpp(1437): note: while compiling class template member function 'float sirf::NiftiImageData<dataType>::get_inner_product(const sirf::NiftiImageData<dataType> &) const'
7>          with
7>          [
7>              dataType=float
7>          ]
7>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
7>          with
7>          [
7>              dataType=float
7>          ]
7>C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\numeric(98): error C2062: type 'unknown-type' unexpected

After commenting out all occurences of get_inner_product() in C++, Matlab and Python, I finally managed to build all projects except SYN_TESTS_CPLUSPLUS, which fails with this weird message:

4>C:\Users\wps46139\Documents\GitHub\build\SIRF-SuperBuild\INSTALL\include\boost-1_65_1\boost/asio/detail/socket_types.hpp(24): fatal error C1189: #error:  WinSock.h has already been included

(even more weirdly, my Visual Studio solution does not even have this project in the Solution Explorer window - its name only appears in the Error List window). After that, at least all non-MR tests run ok except SYN_TESTS_CPLUSPLUS, which is skipped by ctest, and SYN_TEST_PYTHON, which throws exception after about 7 sec.

evgueni-ovtchinnikov commented 4 years ago

Kris' commented:

evgueni-ovtchinnikov commented 4 years ago

@KrisThielemans: thanks a lot!

Fixed openmp and asio errors, do not quite get iterator_category stuff, sorry.

evgueni-ovtchinnikov commented 4 years ago

Found a workaround for iterators problem: just use dot inherited from DataContainer instead of std::inner_product.

evgueni-ovtchinnikov commented 3 years ago

looks sorted

KrisThielemans commented 3 years ago

This Winsock.h error comes up for me. We probably have to define the WIN32_LEAN_AND_MEAN variable at CMake level such that it's used everywhere