bbrister / SIFT3D

Analogue of the scale-invariant feature transform (SIFT) for three-dimensional images. Includes an image processing and linear algebra library with feature matching and RANSAC regression. Also includes IO functions supporting a variety of image formats.
MIT License
134 stars 47 forks source link

about matlab #26

Closed cs123951 closed 3 years ago

cs123951 commented 3 years ago

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.

bbrister commented 3 years ago

Hi,

Where did you get libofstd.a? Is that from DCMTK? You need to get a version compiled with position independent code. One way is to build DCMTK as shared libraries. You can enable that in their Cmake configuration.

Thanks, Blaine


From: Joy Lu notifications@github.com Sent: Monday, December 21, 2020 12:30 AM To: bbrister/SIFT3D SIFT3D@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [bbrister/SIFT3D] about matlab (#26)

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.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/bbrister/SIFT3D/issues/26, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACEYPASWZUXP3UOO5BCCJMLSV4BTDANCNFSM4VD4N2EQ.

cs123951 commented 3 years ago

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.

bbrister commented 3 years ago

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

cs123951 commented 3 years ago

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.

bbrister commented 3 years ago

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.)

cs123951 commented 3 years ago

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!