bbrister/SIFT3D

about matlab

cs123951 opened this issue · 6 comments

hi, I work on linux.
When cmake, I met the following warning:
CMake Warning at imutil/CMakeLists.txt:244 (add_library):

Cannot generate a safe runtime search path for target meximutil because
files in some directories may conflict with libraries in implicit
directories:

runtime library [libtiff.so.5] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /usr/local/MATLAB/R2014b/bin/glnxa64
runtime library [libpng12.so.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /usr/local/MATLAB/R2014b/bin/glnxa64
runtime library [libssl.so.1.0.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /usr/local/MATLAB/R2014b/bin/glnxa64
runtime library [libcrypto.so.1.0.0] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /usr/local/MATLAB/R2014b/bin/glnxa64
runtime library [libicuuc.so.52] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /usr/local/MATLAB/R2014b/bin/glnxa64
runtime library [libicudata.so.52] in /usr/lib/x86_64-linux-gnu may be hidden by files in:
  /usr/local/MATLAB/R2014b/bin/glnxa64

Some of these libraries may not be found correctly.
-- Generating done

It seems that it is related to matlab.

When make, error happened:

[ 2%] Building C object imutil/CMakeFiles/meximutil.dir/imutil.c.o
[ 4%] Building C object imutil/CMakeFiles/meximutil.dir/nifti.c.o
[ 6%] Building CXX object imutil/CMakeFiles/meximutil.dir/dicom.cpp.o
[ 9%] Linking CXX shared library ../lib/wrappers/matlab/libmeximutil.so
/usr/bin/ld: /usr/local/lib/libofstd.a(offile.cc.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libofstd.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [lib/wrappers/matlab/libmeximutil.so] Error 1
make[1]: *** [imutil/CMakeFiles/meximutil.dir/all] Error 2
make: *** [all] Error 2

How to solve this problem?
Thank you very much.

Hi,
I got libofstd.a in /usr/lib/libofstd.a and /usr/local/lib/libofstd.a. I have installed DCMTK 3.6.2, the latest version, but I do not know how to build it as shared libraries.

Thanks again for your kindly reply.

Try setting the variable BUILD_SHARED_LIBS=ON in your Cmake configuration for DCMTK. That should compile .so files instead of .a

Thank you! I recompiled DCMTK by setting BUILD_SHARED_LIBS=ON and it succeeded!
However, another error happened when I call regSift3D.

ljy@user:~/Projects/SIFT3D-master/build/bin$ regSift3D --help
regSift3D: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by /usr/local/lib/sift3d/libsift3D.so)

My OS is Ubuntu 14.04. I attempted to install glibc_2.27, but it seems that glibc_2.27 can only run in Ubuntu 18 or higher version.
Can you help me?
Thanks a lot.

Glad to hear we are making progress.

I have seen that error before when the C++ compiler for SIFT3D does not match the version used for libm. Have you installed a newer version of GCC than the one that comes with Ubuntu 14.04? One way to fix this is to downgrade to the default GCC. You can also upgrade your Ubuntu to 18.

This error probably won't occur in Matlab since it comes with its own versions of those core libraries. (But the same issue can result if Matlab doesn't support the GCC used for SIFT3D.)

Hi,

Yes, the cause of the problem is the version of GCC. The following is my solution of this problem.
The version of my gcc is 5.5. So I downgrade it to 4.9.
I installed gcc-4.9 by the following commands:

sudo apt-get install gcc-4.9 
sudo apt-get install g++-4.9 

The installed gcc is in /usr/bin/, then I changed the setting before cmaking CMakeLists.txt:

export CC=/usr/bin/gcc-4.9
export CXX=/usr/bin/g++-4.9

Currently, I do not need to use Matlab. So I do know what will happen if I use Matlab.

All in all, thank you very much for your kind reply!