[MINC-users] undefined reference to `jpeg_mem_src'

Steffen Bollmann stebollmann at gmail.com
Fri Jun 9 21:42:48 EDT 2017


Dear Robert,

Thank you for your help. The problem was indeed the libjpeg version, but I
had some trouble updating it, because I tried compiling minc on our cluster
running on 2.6.32-573.18.1.el6.x86_64 and the most recent version of
libjpeg from the module system was still too old.

In case anyone else has that problem, here is how I solved it: (I had to do
a few more things, since the installed cmake on the cluster was not
compiled with https support and it failed downloading many of the minc
packages, also NASM wasn't available)

Fix curl

git clone https://github.com/curl/curl.git

cd curl

./buildconf

./configure --prefix=/RDS/Q0306/sw/curl

make -j4

make install


add /RDS/Q0306/sw/curl/bin to PATH



Fix cmake

wget https://cmake.org/files/v3.9/cmake-3.9.0-rc1.tar.gz

tar -xf cmake-3.9.0-rc1.tar.gz

cd  cmake-3.9.0-rc1

./bootstrap --system-curl --prefix=/RDS/Q0306/sw/cmake

make -j4

make install



add /RDS/Q0306/sw/cmake/bin to PATH





Fix NASM

git clone https://github.com/letolabs/nasm

cd nasm

./autogen.sh

sh configure --prefix=/RDS/Q0306/sw/nasm

make -j4

make install



add /Q0306/sw/nasm/bin to PATH





Compile MINC-toolkit-v2

git clone -b develop --recursive
https://github.com/BIC-MNI/minc-toolkit-v2.git minc-toolkit-v2-2017-05-25/



cd minc-toolkit-v2-2017-05-25/



mkdir build && cd build





Fix Libjpeg:

git clone https://github.com/libjpeg-turbo/libjpeg-turbo

autoreconf -fiv

sh configure --prefix=/RDS/Q0306/sw/libjpeg-turbo

make install



TO MAKE IT USE THE LIBJPEG REPLACE THE PATHS IN
minc-toolkit-v2-2017-05-25/minctools/conversion/CMakeLists.txt



TARGET_LINK_LIBRARIES(/RDS/Q0306/sw/libjpeg-turbo/lib/libjpeg.so)

INCLUDE_DIRECTORIES(/RDS/Q0306/sw/libjpeg-turbo/include)

TARGET_LINK_LIBRARIES(dcm2mnc /RDS/Q0306/sw/libjpeg-turbo/lib/libjpeg.so)



cmake .. \
-DCMAKE_BUILD_TYPE:STRING=Release   \
-DCMAKE_INSTALL_PREFIX:PATH=/RDS/Q0306/sw/minc-itk4-2017-06-10-flashlite-el6/
\
-DMT_BUILD_ABC:BOOL=ON   \
-DMT_BUILD_ANTS:BOOL=ON   \
-DMT_BUILD_C3D:BOOL=ON   \
-DMT_BUILD_ELASTIX:BOOL=ON   \
-DMT_BUILD_IM:BOOL=OFF   \
-DMT_BUILD_ITK_TOOLS:BOOL=ON   \
-DMT_BUILD_LITE:BOOL=OFF   \
-DMT_BUILD_SHARED_LIBS:BOOL=ON   \
-DMT_BUILD_VISUAL_TOOLS:BOOL=ON \
-DMT_USE_OPENMP:BOOL=ON   \
-DUSE_SYSTEM_FFTW3D:BOOL=OFF   \
-DUSE_SYSTEM_FFTW3F:BOOL=OFF   \
-DUSE_SYSTEM_GLUT:BOOL=OFF   \
-DUSE_SYSTEM_GSL:BOOL=OFF   \
-DUSE_SYSTEM_HDF5:BOOL=OFF   \
-DUSE_SYSTEM_ITK:BOOL=OFF   \
-DUSE_SYSTEM_NETCDF:BOOL=OFF   \
-DUSE_SYSTEM_NIFTI:BOOL=OFF   \
-DUSE_SYSTEM_PCRE:BOOL=OFF   \
-DUSE_SYSTEM_ZLIB:BOOL=OFF



make -j4



make install



I also had this problem on the way as soon as I tried to use a recent
version of GCC:

[ 85%] Built target ITKIOGIPL-all

/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.11.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


I could not figure out where to set -fPIC, so I solved it badly by using an
old version of gcc (4.4.7).


Now it all seems to work. Is there anything I could have done better in
solving this issue - I am still learning and input in how to do things
better are very much appreciated. Maybe it helps in making compiling minc
more straight forward and you can change things in the makefiles to account
for these problems and get more people to use it - it is a wonderful
toolkit - just hard to get it working (at least for me).


Thanks for you help

Steffen



2017-05-24 20:16 GMT+10:00 Robert D. Vincent <bert at phalarope.com>:

> You probably need to install a different version of libjpeg-dev
>
> I've been successfully building with libjpeg8-dev installed on a Ubuntu
> 16.04 system.
>
>    -bert
>
> On Wed, May 24, 2017 at 3:28 AM, Steffen Bollmann <stebollmann at gmail.com>
> wrote:
>
> > Hi all,
> >
> > I am trying to compile minc-toolkit-v2 develop and I get this error:
> >
> > [ 44%] Linking C executable dcm2mnc
> > CMakeFiles/dcm2mnc.dir/dcm2mnc/dicom_read.c.o: In function
> > `dicom_jpeg_decompress':
> > dicom_read.c:(.text+0x4a4): undefined reference to `jpeg_mem_src'
> > collect2: 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
> >
> > How can I find out what is causing that error? Is it a missing library on
> > the system where I build it? Could it be that libjpeg-dev is the culprit
> > (guessing from 'jpeg_mem_src')?
> >
> > Thank you for any hints
> > Steffen
> > _______________________________________________
> > MINC-users at bic.mni.mcgill.ca
> > http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
> >
> _______________________________________________
> MINC-users at bic.mni.mcgill.ca
> http://www.bic.mni.mcgill.ca/mailman/listinfo/minc-users
>


More information about the MINC-users mailing list