[ITK] Compilation errors
Matt McCormick
matt.mccormick at kitware.com
Wed Aug 9 17:23:07 EDT 2017
Hi Apoorva,
This can be addressed by adding
-fPIC
to CMAKE_C_FLAGS and CMAKE_CXX_FLAGS
Or, by enabling
CMAKE_POSITION_INDEPENDENT_CODE
which has the same effect.
Hope this helps,
Matt
On Wed, Aug 9, 2017 at 5:18 PM, Apoorva Ajay
<Apoorva.Ajay at utsouthwestern.edu> wrote:
> Hi Matt,
>
> I followed same instructions when building ITK. Initially "BUILD_SHARED_LIBS" was not enabled. I tried enabling this in ccmake and tried rebuilding. I get a build error that says:
>
> /usr/bin/ld: CMakeFiles/ITKIOHDF5.dir/itkHDF5ImageIO.cxx.o: relocation R_X86_64_PC32 against undefined symbol `H5::DataType::fromClass() const' can not be used when making a shared object; recompile with -fPIC
>
> Kindly let me know how to resolve this.
>
> Thanks and Regards,
> Apoorva.D.A
> ________________________________________
> From: Matt McCormick <matt.mccormick at kitware.com>
> Sent: Wednesday, August 9, 2017 12:55 PM
> To: Apoorva Ajay
> Cc: community at itk.org
> Subject: Re: [ITK] Compilation errors
>
> Hello Apoorva,
>
> Welcome to ITK!
>
>
> These messages indicate possible issues with the CMake configuration.
>
>
> For more information, see the "Configuring and Building ITK" section
> of the ITK Software Guide:
>
> https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch2.html#x22-130002
>
> and find a downloadable HelloWorld example that includes the CMake
> configuration here:
>
> https://itk.org/ITKExamples/src/Core/Common/BuildAHelloWorldProgram/Documentation.html
>
>
> Hope this helps,
> Matt
>
> On Wed, Aug 9, 2017 at 1:32 PM, Apoorva Ajay
> <Apoorva.Ajay at utsouthwestern.edu> wrote:
>> Hi,
>>
>>
>> I come across this error when I try executing a HelloWorld example program
>> on linux. Kindly help me resolve it.
>>
>>
>> Linking CXX executable HelloWorld
>> /ITK-sandbox/ITK-build/bin/lib/libITKCommon-4.12.a(itkDynamicLoader.cxx.o):
>> In function `itk::DynamicLoader::GetSymbolAddress(void*, char const*)':
>> itkDynamicLoader.cxx:(.text+0xfa): undefined reference to
>> `itksys::DynamicLoader::GetSymbolAddress(void*, std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> > const&)'
>> /ITK-sandbox/ITK-build/bin/lib/libITKCommon-4.12.a(itkDynamicLoader.cxx.o):
>> In function `itk::DynamicLoader::OpenLibrary(char const*)':
>> itkDynamicLoader.cxx:(.text+0x18e): undefined reference to
>> `itksys::DynamicLoader::OpenLibrary(std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> > const&)'
>> /ITK-sandbox/ITK-build/bin/lib/libITKCommon-4.12.a(itkDynamicLoader.cxx.o):
>> In function `itk::DynamicLoader::LastError()':
>> itkDynamicLoader.cxx:(.text+0x51): undefined reference to
>> `itksys::DynamicLoader::LastError()'
>> /ITK-sandbox/ITK-build/bin/lib/libITKCommon-4.12.a(itkDynamicLoader.cxx.o):
>> In function `itk::DynamicLoader::CloseLibrary(void*)':
>> itkDynamicLoader.cxx:(.text+0x61): undefined reference to
>> `itksys::DynamicLoader::CloseLibrary(void*)'
>> /ITK-sandbox/ITK-build/bin/lib/libITKCommon-4.12.a(itkMultiThreader.cxx.o):
>> In function `global constructors keyed to itkMultiThreader.cxx':
>> itkMultiThreader.cxx:(.text+0x122): undefined reference to
>> `itksys::SystemToolsManager::SystemToolsManager()'
>> itkMultiThreader.cxx:(.text+0x129): undefined reference to
>> `itksys::SystemToolsManager::~SystemToolsManager()'
>> /ITK-sandbox/ITK-build/bin/lib/libITKCommon-4.12.a(itkMultiThreader.cxx.o):
>> In function `itk::MultiThreader::GetGlobalDefaultUseThreadPool()':
>> itkMultiThreader.cxx:(.text+0x3b5): undefined reference to
>> `itksys::SystemTools::GetEnv(char const*, std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> >&)'
>> itkMultiThreader.cxx:(.text+0x3c4): undefined reference to
>> `itksys::SystemTools::UpperCase(std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> > const&)'
>> /ITK-sandbox/ITK-build/bin/lib/libITKCommon-4.12.a(itkMultiThreader.cxx.o):
>> In function `itk::MultiThreader::GetGlobalDefaultNumberOfThreads()':
>> itkMultiThreader.cxx:(.text+0x6bd): undefined reference to
>> `itksys::SystemTools::GetEnv(char const*, std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> >&)'
>> itkMultiThreader.cxx:(.text+0xa45): undefined reference to
>> `itksys::SystemTools::GetEnv(char const*, std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> >&)'
>> /ITK-sandbox/ITK-build/bin/lib/libITKCommon-4.12.a(itkDirectory.cxx.o): In
>> function `itk::Directory::~Directory()':
>> itkDirectory.cxx:(.text+0x7c): undefined reference to
>> `itksys::Directory::~Directory()'
>> /ITK-sandbox/ITK-build/bin/lib/libITKCommon-4.12.a(itkDirectory.cxx.o): In
>> function `itk::Directory::Directory()':
>> itkDirectory.cxx:(.text+0x11a): undefined reference to
>> `itksys::Directory::Directory()'
>>
>> /ITK-sandbox/ITK-build/bin/lib/libITKCommon-4.12.a(itkDirectory.cxx.o): In
>> function `itk::Directory::Load(char const*)':
>> itkDirectory.cxx:(.text+0x18b): undefined reference to
>> `itksys::Directory::Load(std::basic_string<char, std::char_traits<char>,
>> std::allocator<char> > const&)'
>> /ITK-sandbox/ITK-build/bin/lib/libITKCommon-4.12.a(itkDirectory.cxx.o): In
>> function `itk::Directory::PrintSelf(std::basic_ostream<char,
>> std::char_traits<char> >&, itk::Indent) const':
>> itkDirectory.cxx:(.text+0x227): undefined reference to
>> `itksys::Directory::GetPath() const'
>> itkDirectory.cxx:(.text+0x2b3): undefined reference to
>> `itksys::Directory::GetNumberOfFiles() const'
>> itkDirectory.cxx:(.text+0x30d): undefined reference to
>> `itksys::Directory::GetFile(unsigned long) const'
>> /ITK-sandbox/ITK-build/bin/lib/libITKCommon-4.12.a(itkDirectory.cxx.o): In
>> function `itk::Directory::GetFile(unsigned int)':
>> itkDirectory.cxx:(.text+0x37): undefined reference to
>> `itksys::Directory::GetFile(unsigned long) const'
>> /ITK-sandbox/ITK-build/bin/lib/libITKCommon-4.12.a(itkDirectory.cxx.o): In
>> function `itk::Directory::GetNumberOfFiles()':
>> itkDirectory.cxx:(.text+0x45): undefined reference to
>> `itksys::Directory::GetNumberOfFiles() const'
>> collect2: ld returned 1 exit status
>> make[2]: *** [HelloWorld] Error 1
>> make[1]: *** [CMakeFiles/HelloWorld.dir/all] Error 2
>> make: *** [all] Error 2
>>
>> Thanks and Regards,
>>
>> Apoorva.D.A
>>
>>
>>
>> ________________________________
>>
>> UT Southwestern
>>
>> Medical Center
>>
>>
>> The future of medicine, today.
>>
>>
>> _______________________________________________
>> Community mailing list
>> Community at itk.org
>> http://public.kitware.com/mailman/listinfo/community
>>
>
More information about the Community
mailing list