gcc version/linkage fails with SHARK module and boost
Hello,
I’m trying to compile OTB 6.6.1 in a centos7 docker using the SuperBuild with cmake3 version 3.14.6 and default gcc/++ (4.8). SuperBuild well installed all the dependency. But when it started to compile the otb code itself I got lot of errors as the following.
/install/OTB/otb/Modules/Learning/Sampling/src/otbSampleAugmentationFilter.cxx: In member function 'otb::ogr::Feature otb::SampleAugmentationFilter::SelectTemplateFeature(const otb::ogr::Layer&, const string&, int)':
/install/OTB/otb/Modules/Learning/Sampling/src/otbSampleAugmentationFilter.cxx:260:36: error: parameter declared 'auto'
[&](auto& featureIt)
^
/install/OTB/otb/Modules/Learning/Sampling/src/otbSampleAugmentationFilter.cxx: In lambda function:
/install/OTB/otb/Modules/Learning/Sampling/src/otbSampleAugmentationFilter.cxx:262:35: error: 'featureIt' was not declared in this scope
return featureIt.ogr().GetFieldAsInteger(classField.c_str()) ==
^
In file included from /usr/include/c++/4.8.2/algorithm:62:0,
from /install/OTB/install/include/ITK-4.13/itkProcessObject.h:39,
from /install/OTB/otb/Modules/Learning/Sampling/include/otbSampleAugmentationFilter.h:24,
from /install/OTB/otb/Modules/Learning/Sampling/src/otbSampleAugmentationFilter.cxx:21:
/usr/include/c++/4.8.2/bits/stl_algo.h: In instantiation of '_InputIterator std::__find_if(_InputIterator, _InputIterator, _Predicate, std::input_iterator_tag) [with _InputIterator = otb::ogr::Layer::feature_iter<const otb::ogr::Feature>; _Predicate = otb::SampleAugmentationFilter::SelectTemplateFeature(const otb::ogr::Layer&, const string&, int)::__lambda0]':
/usr/include/c++/4.8.2/bits/stl_algo.h:4465:41: required from '_IIter std::find_if(_IIter, _IIter, _Predicate) [with _IIter = otb::ogr::Layer::feature_iter<const otb::ogr::Feature>; _Predicate = otb::SampleAugmentationFilter::SelectTemplateFeature(const otb::ogr::Layer&, const string&, int)::__lambda0]'
/install/OTB/otb/Modules/Learning/Sampling/src/otbSampleAugmentationFilter.cxx:264:27: required from here
/usr/include/c++/4.8.2/bits/stl_algo.h:150:56: error: no match for call to '(otb::SampleAugmentationFilter::SelectTemplateFeature(const otb::ogr::Layer&, const string&, int)::__lambda0) (const otb::ogr::Feature&)'
while (__first != __last && !bool(__pred(*__first)))
^
/install/OTB/otb/Modules/Learning/Sampling/src/otbSampleAugmentationFilter.cxx:260:28: note: candidate is:
[&](auto& featureIt)
^
/install/OTB/otb/Modules/Learning/Sampling/src/otbSampleAugmentationFilter.cxx:260:45: note: otb::SampleAugmentationFilter::SelectTemplateFeature(const otb::ogr::Layer&, const string&, int)::__lambda0
[&](auto& featureIt)
^
/install/OTB/otb/Modules/Learning/Sampling/src/otbSampleAugmentationFilter.cxx:260:45: note: candidate expects 0 arguments, 1 provided
make[5]: *** [Modules/Learning/Sampling/src/CMakeFiles/OTBSampling.dir/otbSampleAugmentationFilter.cxx.o] Error 1
I though it came from the gcc/++ version/linkage so I try a new version (gcc 5.5, 6.3, 7.3). But I got the following errors for SHARK->BOOST module. This seems to be also because of the gcc version/linkage, but for another gcc version. Like if only gcc 4.8 was fine for SHARK->BOOST. By the way the boost version is the one generated by superbuild. I did not change it as I don't know the impact on the whole code.
/install/OTB/install/lib/libboost_serialization.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)@GLIBCXX_3.4.21'
/install/OTB/install/lib/libboost_serialization.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::reserve(unsigned long)@GLIBCXX_3.4.21'
/install/OTB/install/lib/libboost_serialization.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::_M_mutate(unsigned long, unsigned long, wchar_t const*, unsigned long)@GLIBCXX_3.4.21'
/install/OTB/install/lib/libboost_serialization.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned long, char)@GLIBCXX_3.4.21'
/install/OTB/install/lib/libboost_serialization.so: undefined reference to `std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >::resize(unsigned long, wchar_t)@GLIBCXX_3.4.21'
/install/OTB/install/lib/libboost_serialization.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)@GLIBCXX_3.4.21'
/install/OTB/install/lib/libboost_serialization.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(char const*) const@GLIBCXX_3.4.21'
/install/OTB/install/lib/libboost_serialization.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_mutate(unsigned long, unsigned long, char const*, unsigned long)@GLIBCXX_3.4.21'
/install/OTB/install/lib/libboost_serialization.so: undefined reference to `operator delete(void*, unsigned long)@CXXABI_1.3.9'
/install/OTB/install/lib/libboost_serialization.so: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace(unsigned long, unsigned long, char const*, unsigned long)@GLIBCXX_3.4.21'
What I did…
• To install gcc 4.8 I used yum install gcc gcc-c++
and when I tried newer version I did as above:
yum -y install wget tar bzip2
yum -y install make gcc gcc-c++
wget http://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-6.3.0/gcc-6.3.0.tar.gz
tar xvf gcc-6.3.0.tar.gz
cd gcc-6.3.0
./contrib/download_prerequisites
./configure --disable-multilib --enable-languages=c,c++
make -j8
make -j8 install
yum -y remove gcc gcc-c++
yum -y remove make
yum -y remove bzip2
yum -y remove wget
rm -f $GCC_HOME/gcc-6.3.0.tar.gz
• To install otb 6.6.1 I did as above:
yum -y install wget tar make patch
yum -y install libXrandr libXrandr-devel libXinerama libXinerama-devel libXcursor libXcursor-devel
yum -y install mesa-libGLU mesa-libGLU-devel
yum -y install perl swig
yum -y install gcc gcc-c++ # if working with gcc 4.8
yum -y install epel-release cmake3
export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib:/usr/local/lib64:/usr/lib64
echo "$LD_LIBRARY_PATH" >> /etc/profile.d/cmake3.sh
# To find XInput.h
if [ ! -f "/usr/include/X11/extensions/XInput.h" ] && [ -f /usr/include/X11/extensions/XI.h ]
then
ln -s /usr/include/X11/extensions/XI.h /usr/include/X11/extensions/XInput.h
fi
wget https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/archive/6.6.1/otb-6.6.1.tar.gz
tar xvf otb-6.6.1.tar.gz
mv otb-6.6.1 $OTB_SOURCE
mkdir $OTB_BUILD
mkdir $OTB_INSTALL
# some file are not available anymore, replace them
sed -i '/211ed5fdf2dd45aeb9c0abc8e1fe42be/d' $OTB_SOURCE/SuperBuild/CMake/External_libkml.cmake
sed -i 's/libkml_1.3.0~r863.orig.tar.gz/libkml_1.3.0~r864+dfsg.orig.tar.gz/g' $OTB_SOURCE/SuperBuild/CMake/External_libkml.cmake
sed -i '/7e167b9617e7bd64012daaacb85477af/d' $OTB_SOURCE/SuperBuild/CMake/External_qt5.cmake
sed -i '/skip qtwebglplugin/d' $OTB_SOURCE/SuperBuild/CMake/External_qt5.cmake
sed -i 's/5.10\/5.10.1\/single\/qt-everywhere-src-5.10.1.tar.xz/5.9\/5.9.1\/single\/qt-everywhere-opensource-src-5.9.1.tar.xz/g' $OTB_SOURCE/SuperBuild/CMake/External_qt5.cmake
cd $OTB_BUILD
cmake3 -DCMAKE_INSTALL_PREFIX=$OTB_INSTALL -DOTB_USE_QT=OFF $OTB_SOURCE/SuperBuild
cd $OTB_BUILD
make -j8
It looks like the gcc version can’t be compatible with SHARK and OTB itself at the same time... Any idea about how to solve it? Thanks