BIC-MNI / minc-toolkit-v2

Version 2 of the minc-toolkit, uses tools based on ITK version 4.x
GNU General Public License v3.0
48 stars 21 forks source link

Build failure at ABC_MINC stage #43

Open DrFranco42 opened 7 years ago

DrFranco42 commented 7 years ago

I have made it through issues several of the issues reported previously, but I can't figure out how to address an issue at the stage of the ABC_MINC build. I'm building on a CentOS 6.6 machine. The error I get is:

/home/fhaist/bin/minc2-build/ITKv4-build/lib/libITKIOGE-4.11.so.1: undefined reference to `vtable for itk::IPLFileSortInfo' collect2: ld returned 1 exit status make[5]: [StandAloneCLI/ABC_MINC] Error 1 make[4]: [StandAloneCLI/CMakeFiles/ABC_MINC.dir/all] Error 2 make[3]: [all] Error 2 make[2]: [ABC-prefix/src/ABC-stamp/ABC-build] Error 2 make[1]: [CMakeFiles/ABC.dir/all] Error 2 make: [all] Error 2

This looks very similar to issue that was raised previously. I'm building off the master. It was suggested previously to build off the developer rather than master. I tried that and got fundamental errors in cmake. Examples of those errors are:

CMake Error at CMakeLists.txt:312 (ADD_SUBDIRECTORY): The source directory /home/fhaist/bin/minc-toolkit-v2-develop/libminc does not contain a CMakeLists.txt file CMake Error at CMakeLists.txt:333 (ADD_DEPENDENCIES): Cannot add target-level dependencies to non-existent target "minc2".

Not sure if there are files I'm missing from the download or which flags to set for the developer build. The setting I had for both the master and developer builds were the same. I've tried multiple iterations with GLUT on and off, including -fPIC on the FLAGS options, but nothing gets past the above error. Those settings were:

BUILD_TESTING ON
CCACHE_FOUND CCACHE_FOUND-NOTFOUND
CMAKE_BUILD_TYPE Release
CMAKE_INSTALL_PREFIX /opt/minc2
GLUT_X11_LIBRARY /usr/lib64/libX11.so
GLUT_Xi_LIBRARY /usr/lib64/libXi.so
GLUT_Xmu_LIBRARY /usr/lib64/libXmu.so
MT_BUILD_ABC ON
MT_BUILD_ANTS ON
MT_BUILD_C3D ON
MT_BUILD_ELASTIX ON
MT_BUILD_IM OFF
MT_BUILD_ITK_TOOLS ON
MT_BUILD_LITE OFF
MT_BUILD_OPENBLAS ON
MT_BUILD_QUIET OFF (I haven't seen QUIET as a build option previously)
MT_BUILD_SHARED_LIBS ON
MT_BUILD_VISUAL_TOOLS ON
MT_USE_OPENMP ON
USE_SYSTEM_FFTW3D OFF
USE_SYSTEM_FFTW3F OFF
USE_SYSTEM_GLUT OFF (also tried with GLUT ON)
USE_SYSTEM_GSL OFF
USE_SYSTEM_HDF5 OFF
USE_SYSTEM_ITK OFF
USE_SYSTEM_NETCDF OFF
USE_SYSTEM_PCRE OFF
USE_SYSTEM_ZLIB OFF
CMAKE_CXX_FLAGS -fkeep-inline-functions -mcmodel=large (also tried -fPIC)
CMAKE_C_FLAGS -fkeep-inline-functions -mcmodel=large (ditto above)

What am I doing wrong here? I didn't have similar issues with the 1.9 builds previously. Any help greatly appreciated.

---Frank

vfonov commented 7 years ago

I had trouble compiling ITK 4.11 with old version of gcc ( CentOS 6.6 has a very old one). The only solution is to upgrade to newer version of CentOS or newer version of gcc

DrFranco42 commented 7 years ago

Thanks. I upgraded gcc 4.8.2-15 (the latest available through devtoolset-2). It got to the same point with a slightly different error. Still refers to a undefined reference to vtable.

../../../../lib/libITKCommon-4.11.so.1: undefined reference to `vtable for __gnu_cxx::recursive_init_error' collect2: error: ld returned 1 exit status make[5]: [bin/itkTestDriver] Error 1 make[4]: [Modules/Core/TestKernel/src/CMakeFiles/itkTestDriver.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 7 years ago

I managed to compile on CentOS 6.6 with gcc 4.8.2 without any additional flags.

Did you start cmake from the scratch (so it points to the right compiler) ?

DrFranco42 commented 7 years ago

Yes, started from scratch. Here are the settings:

CMAKE_AR /opt/rh/devtoolset-2/root/usr/bin/ar
CMAKE_BUILD_TYPE Release
CMAKE_COLOR_MAKEFILE ON
CMAKE_CXX_COMPILER /opt/rh/devtoolset-2/root/usr/bin/c++
CMAKE_CXX_FLAGS -fkeep-inline-functions -mcmodel=large
CMAKE_CXX_FLAGS_DEBUG -g
CMAKE_CXX_FLAGS_MINSIZEREL -Os -DNDEBUG
CMAKE_CXX_FLAGS_RELEASE -O3 -DNDEBUG
CMAKE_CXX_FLAGS_RELWITHDEBINFO -O2 -g -DNDEBUG
CMAKE_C_COMPILER /opt/rh/devtoolset-2/root/usr/bin/cc
CMAKE_C_FLAGS -fkeep-inline-functions -mcmodel=large
CMAKE_C_FLAGS_DEBUG -g
CMAKE_C_FLAGS_MINSIZEREL -Os -DNDEBUG
CMAKE_C_FLAGS_RELEASE -O3 -DNDEBUG
CMAKE_C_FLAGS_RELWITHDEBINFO -O2 -g -DNDEBUG
CMAKE_EXE_LINKER_FLAGS
CMAKE_EXE_LINKER_FLAGS_DEBUG
CMAKE_EXE_LINKER_FLAGS_MINSIZE
CMAKE_EXE_LINKER_FLAGS_RELEASE
CMAKE_EXE_LINKER_FLAGS_RELWITH
CMAKE_EXPORT_COMPILE_COMMANDS OFF

vfonov commented 7 years ago

try removing CMAKE_C_FLAGS and CMAKE_CXX_FLAGS

DrFranco42 commented 7 years ago

Thank you for all the very timely replies. Removing the flags moved this a long way toward completion. All the major tools (ITK, ABC, ANTs, etc.) built successfully. The build now crashes on the dcm2mnc dicom_read portion. From the error messages (a sample provided below), it appears there are issues related to jpeg libraries or headers ("opj"). I have openjpeg and openjpeg2 installed (openjpeg, openjpeg-libs, openjpeg-devel = v1.3; openjpeg2 and openjpeg2-devel = v2.1.0). The build calls seem correct: JPEG_INCLUDE_DIR /usr/include
JPEG_LIBRARY /usr/lib64/libjpeg.so

I also tried changing those settings to /usr/include/openjpeg-2.1 and /usr/lib64/libopenjpeg.so but came up with the same errors. Any help here is greatly appreciated.

minc-toolkit-v2-master/minctools/conversion/dcm2mnc/dicom_read.c:2482:1: error: unknown type name opj_dinfo_t static opj_dinfo_t OPJ_CALLCONV (_opj_create_decompress)(OPJ_CODEC_FORMAT); ^ minc-toolkit-v2-master/minctools/conversion/dcm2mnc/dicom_read.c:2483:48: error: unknown type name opj_dinfo_t static void OPJ_CALLCONV (_opj_setup_decoder)(opj_dinfo_t , opj_dparameters_t *);

minc-toolkit-v2-master/minctools/conversion/dcm2mnc/dicom_read.c:2484:64: error: unknown type name opj_cio_t static opj_image_t OPJ_CALLCONV (_opj_decode)(opj_dinfo_t , opj_cio_t ); ^ minc-toolkit-v2-master/minctools/conversion/dcm2mnc/dicom_read.c:2485:1: error: unknown type name opj_cio_t static opj_cio_t OPJ_CALLCONV (_opj_cio_open)(opj_common_ptr, unsigned char *, int);

vfonov commented 7 years ago

OK, there is version compatibility issue. Try removing referenced to openjpeg and use newer version of libjpeg or libturbojpeg

DrFranco42 commented 7 years ago

I think it's a basic incompatibility with my system. I've installed the latest libjpeg and libjpeg-turbo (and devel and static packages). I get a different error now, but it's in the same place. Happy to try any new suggestion, but It seems at this point I'll fallback to minc-toolkit 1.9, which builds fine on this machine. In any case, these are the errors that are thrown up using libjpeg-turbo

CMakeFiles/dcm2mnc.dir/dcm2mnc/dicom_read.c.o: In function dicom_jpeg_decompress': dicom_read.c:(.text+0x46d6): undefined reference tojpeg_std_error' dicom_read.c:(.text+0x46f5): undefined reference to jpeg_CreateDecompress' dicom_read.c:(.text+0x4709): undefined reference tojpeg_mem_src' dicom_read.c:(.text+0x471b): undefined reference to jpeg_read_header' dicom_read.c:(.text+0x4731): undefined reference tojpeg_start_decompress' dicom_read.c:(.text+0x479b): undefined reference to jpeg_read_scanlines' dicom_read.c:(.text+0x47c6): undefined reference tojpeg_finish_decompress' dicom_read.c:(.text+0x47d3): undefined reference to `jpeg_destroy_decompress' collect2: error: ld returned 1 exit status make[2]: [minctools/conversion/dcm2mnc] Error 1 make[1]: [minctools/conversion/CMakeFiles/dcm2mnc.dir/all] Error 2 make: *** [all] Error 2 [