lundi 26 août 2019

Installation of SimpleITK manually with clang5.0

I have installed ITK5.0 on my system and now I want to install manually SimpleITK-1.2.0 using Superbuild. I tried to compile with ubuntu default c++ compiler, but it seems that I need to compile with c++11 if I am not mistaken. Because everytime I was running make command, it was showing errors on the ITK codes. What I did is as follows:

  • installing clang-5.0 as it has mentioned in this link enter image description here
  • Setting the flag SimpleITK_USE_SYSTEM_ITK to be ON. and I cleaned up the fields ITK_GIT_REPOSITORY and ITK_GIT_TAG. Because I need to link the SimpleITK to the installed ITK in the system.

However, I am getting the following error (that I only included a small part of it):

CCLD     libpcreposix.la
ar: `u' modifier ignored since `D' is the default (see `U')
  CCLD     pcretest
ar: `u' modifier ignored since `D' is the default (see `U')
  CCLD     pcregrep
  CXXLD    pcre_scanner_unittest
./.libs/libpcrecpp.a(libpcrecpp_la-pcrecpp.o): In function `pcrecpp::RE::Init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, pcrecpp::RE_Options const*)':
/home/user/softwares/vtk-itk/SimpleITK-build/PCRE-prefix/src/PCRE/pcrecpp.cc:(.text+0xb): 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&)'
./.libs/libpcrecpp.a(libpcrecpp_la-pcrecpp.o): In function `pcrecpp::RE::Compile(pcrecpp::RE::Anchor)':
/home/user/softwares/vtk-itk/SimpleITK-build/PCRE-prefix/src/PCRE/pcrecpp.cc:(.text+0xc6): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)'
/home/user/softwares/vtk-itk/SimpleITK-build/PCRE-prefix/src/PCRE/pcrecpp.cc:(.text+0xf3): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_append(char const*, unsigned long)'
/home/user/softwares/vtk-itk/SimpleITK-build/PCRE-prefix/src/PCRE/pcrecpp.cc:(.text+0x11e): undefined reference to `operator delete(void*)'
/home/user/softwares/vtk-itk/SimpleITK-build/PCRE-prefix/src/PCRE/pcrecpp.cc:(.text+0x165): undefined reference to `operator new(unsigned long)'
/home/user/softwares/vtk-itk/SimpleITK-build/PCRE-prefix/src/PCRE/pcrecpp.cc:(.text+0x1a2): undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)'
/home/user/softwares/vtk-itk/SimpleITK-build/PCRE-prefix/src/PCRE/pcrecpp.cc:(.text+0x203): undefined reference to `std::__throw_length_error(char const*)'
/home/user/softwares/vtk-itk/SimpleITK-build/PCRE-prefix/src/PCRE/pcrecpp.cc:(.text+0x20d): undefined reference to `std::__throw_logic_error(char const*)'
/home/user/softwares/vtk-itk/SimpleITK-build/PCRE-prefix/src/PCRE/pcrecpp.cc:(.text+0x227): undefined reference to `operator delete(void*)'
./.libs/libpcrecpp.a(libpcrecpp_la-pcrecpp.o): In function `pcrecpp::RE::Cleanup()':
/home/user/softwares/vtk-itk/SimpleITK-build/PCRE-prefix/src/PCRE/pcrecpp.cc:(.text+0x282): undefined reference to `operator delete(void*)'
/home/user/softwares/vtk-itk/SimpleITK-build/PCRE-prefix/src/PCRE/pcrecpp.cc:(.text+0x28b): undefined reference to `operator delete(void*)'
./.libs/libpcrecpp.a(libpcrecpp_la-pcrecpp.o): In function `pcrecpp::RE::~RE()':
/home/user/softwares/vtk-itk/SimpleITK-build/PCRE-prefix/src/PCRE/pcrecpp.cc:(.text+0x2e5): undefined reference to `operator delete(void*)'
/home/user/softwares/vtk-itk/SimpleITK-build/PCRE-prefix/src/PCRE/pcrecpp.cc:(.text+0x2ed): undefined reference to `operator delete(void*)'
./.libs/libpcrecpp.a(libpcrecpp_la-pcrecpp.o):/home/user/softwares/vtk-itk/SimpleITK-build/PCRE-prefix/src/PCRE/pcrecpp.cc:(.text+0x305): more undefined references to `operator delete(void*)' follow

and at the end of error is showing:

reference to `__gxx_personality_v0'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:1510: recipe for target 'pcre_scanner_unittest' failed
make[4]: *** [pcre_scanner_unittest] Error 1
make[4]: *** Waiting for unfinished jobs....
Makefile:1322: recipe for target 'all' failed

Then, whenever I am trying to run the following command

cmake "-DCMAKE_CXX_FLAGS:STRING=-stdlib=libc++" ../SimpleITK-1.2.0/SuperBuild

it seems it cannot link and compile:

CC       libpcre_la-pcre_chartables.lo
  CC       libpcreposix_la-pcreposix.lo
  CXX      libpcrecpp_la-pcrecpp.lo
  CXX      libpcrecpp_la-pcre_scanner.lo
  CXX      libpcrecpp_la-pcre_stringpiece.lo
/home/user/softwares/vtk-itk/SimpleITK-build/PCRE-prefix/src/PCRE/pcrecpp.cc:43:10: fatal error: 
      'string' file not found
#include <string>
         ^~~~~~~~
/home/user/softwares/vtk-itk/SimpleITK-build/PCRE-prefix/src/PCRE/pcre_scanner.cc:36:10: fatal error: 
      'vector' file not found
#include <vector>
         ^~~~~~~~
/home/user/softwares/vtk-itk/SimpleITK-build/PCRE-prefix/src/PCRE/pcre_stringpiece.cc:37:10: fatal error: 
      'iostream' file not found
#include <iostream>
         ^~~~~~~~~~
1 error generated.
Makefile:2255: recipe for target 'libpcrecpp_la-pcrecpp.lo' failed
make[4]: *** [libpcrecpp_la-pcrecpp.lo] Error 1
make[4]: *** Waiting for unfinished jobs....
1 error generated.

Do you know how to resolve this issue? I am struggling for so many days to install SimpleITK and link it to ITK5.0 installed on my system.

Aucun commentaire:

Enregistrer un commentaire