BIC-MNI / minc-toolkit

Metaproject uniting all the available minc tools
GNU General Public License v3.0
37 stars 15 forks source link

minc-toolkit 1.9.06 build fails with linker error on itkHDF5ImageIO.cxx.o #18

Closed gdevenyi closed 5 years ago

gdevenyi commented 10 years ago

Maybe related to #16 ?

Linking CXX shared library ../../../../lib/libITKIOHDF5-4.6.so
/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
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make[5]: *** [lib/libITKIOHDF5-4.6.so.1] Error 1
make[4]: *** [Modules/IO/HDF5/src/CMakeFiles/ITKIOHDF5.dir/all] Error 2
make[3]: *** [all] Error 2
make[2]: *** [ITKv4-prefix/src/ITKv4-stamp/ITKv4-build] Error 2
make[1]: *** [CMakeFiles/ITKv4.dir/all] Error 2
make: *** [all] Error 2
vfonov commented 10 years ago

I saw it recently on Debian 6 too, was able to fix it with -fkeep-inline-functions while compiling ITK

gdevenyi commented 10 years ago

Okay, I can try that, where exactly would I make that change though?

vfonov commented 10 years ago

Right now I manually added -fkeep-inline-functions to CMAKE_CXX_FLAGS for building ITKv4

vfonov commented 10 years ago

just change directory to ITKv4-build in your build location, then run cmake . -DCMAKE_CXX_FLAGS:STRING=-fkeep-inline-functions or use ccmake .

gdevenyi commented 10 years ago

-fkeep-inline-functions did fix my build

vfonov commented 10 years ago

I just made a clean build of minc-toolkit version 1.0.04 ( http://packages.bic.mni.mcgill.ca/minc-toolkit/Debian/minc-toolkit-1.0.04-20140826-Debian_6.0.4-x86_64.deb ) on my virtual machine running Debian 6.0.4 - it build fine with the following options:

    cmake . \
              -DCMAKE_INSTALL_PREFIX:PATH=/opt/minc \
              -DCMAKE_BUILD_TYPE:STRING=Release \
              -DMT_BUILD_ITK_TOOLS:BOOL=ON \
              -DMT_BUILD_ITK_TOOLS:BOOL=ON \
              -DMT_BUILD_LITE:BOOL=OFF \
              -DMT_BUILD_MINC_ANTS:BOOL=ON \
              -DMT_BUILD_SHARED_LIBS:BOOL=ON \
              -DMT_BUILD_VISUAL_TOOLS:BOOL=ON \
              -DMT_USE_OPENMP:BOOL=ON \
              -DMT_BUILD_C3D:BOOL=ON \
              -DCPACK_BINARY_DEB:BOOL=ON \
              -DCPACK_BINARY_NSIS:BOOL=OFF \
              -DCPACK_BINARY_RPM:BOOL=OFF \
              -DCPACK_BINARY_STGZ:BOOL=OFF \
              -DCPACK_BINARY_TBZ2:BOOL=OFF \
              -DCPACK_BINARY_TGZ:BOOL=OFF \
              -DCPACK_BINARY_TZ:BOOL=OFF \
              -DCPACK_SOURCE_TBZ2:BOOL=OFF \
              -DCPACK_SOURCE_TGZ:BOOL=OFF \
              -DCPACK_SOURCE_TZ:BOOL=OFF \
              -DCPACK_SOURCE_ZIP:BOOL=OFF 
vfonov commented 10 years ago

was your system set up by Sylvain Milot ?

gdevenyi commented 10 years ago

Yes it was

vfonov commented 10 years ago

I observed this error on BIC machine also installed and maintained by Sylvain, but it doesn't happen on my vanilla Debian running inside of the virtual machine. Perhaps there is a different version of gnu compiler or binutils ?

gdevenyi commented 10 years ago

The install is a bit aged, I'm planning to migrate the compute nodes to ubuntu-lts, but it's a lot of nodes to reinstall.

In the meantime, here's the versions reported: gcc (Debian 4.4.5-8) 4.4.5 GNU ld (GNU Binutils for Debian) 2.20.1-system.20100303

vfonov commented 10 years ago

Mine are the same...

vfonov commented 10 years ago

I noticed that versions of linux-libc-dev is different: stock: 2.6.32-41squeeze2 BIC: 3.13.6-1+grml.1

gdevenyi commented 10 years ago

For me I have: linux-libc-dev 2.6.32-48squeeze4

vfonov commented 10 years ago

I run apt-get dist-upgrade on my VM , that updated linux-libc-dev to 2.6.32-48squeeze6 and OS release to 6.0.10 , then i rebult minc-toolkit again from the scratch - it still builds without problems.

hazedine commented 9 years ago

I had a similar issue, I added the following lines to the main CMakeLists.txt:

SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
SET(CMAKE_C_FLAGS   "${CMAKE_C_FLAGS}   -fPIC -fkeep-inline-functions")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fkeep-inline-functions")