Open tedwu-neuro opened 3 years ago
Thanks for your interest @tedwu-neuro. Although calling cmtk directly always seemed like a nice idea, we've hardly used this at all since it did not make much difference for most use cases. What is your use case?
The most likely reason is that you did not build "shared libraries" when you built CMTK. To do this I suggest replacing the
cmake -C ../core/config/gcc-x86_64-sse.cmake ../core/
with:
cmake -C ../core/config/gcc-x86_64-sse.cmake -DBUILD_SHARED_LIBS=ON ../core/
Failing that, your error message looks like this one.
and you might try editing Makevars
to do this
PKG_CXXFLAGS="-fPIC"
or following their suggestions.
re your other points, it is better to have fftw installed as you have done although you could remove the -lfftw3l -lfftw3_threads
if this were really a problem.
Dear Professor Jefferis
Thank you for your quick reply!
I am trying to install cmtkr because I saw it mentioned as a dependency required in one of your tutorials.
I indeed added the -DBUILD_SHARED_LIBS=ON
flag to the cmake command and ran make
and sudo make install
successfully. Then I tried installing the R package and now I get the following:
> devtools::install()
✔ checking for file ‘/home/tedwu/Documents/opt/cmtkr/DESCRIPTION’ ...
─ preparing ‘cmtkr’:
✔ checking DESCRIPTION meta-information
─ cleaning src
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘cmtkr_0.1.tar.gz’
Running /usr/lib/R/bin/R CMD INSTALL /tmp/RtmpyJqb37/cmtkr_0.1.tar.gz \
--install-tests
* installing to library ‘/home/tedwu/R/x86_64-pc-linux-gnu-library/3.6’
* installing *source* package ‘cmtkr’ ...
** using staged installation
** libs
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I. -I/usr/local/include/cmtk/ -I"/home/tedwu/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I. -I/usr/local/include/cmtk/ -I"/home/tedwu/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-jbaK_j/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c streamxform.cpp -o streamxform.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o cmtkr.so RcppExports.o streamxform.o -L/usr/local/lib/cmtk -lcmtkBase -lcmtkSystem -lcmtkIO -lcmtkRegistration -lcmtkNumerics -lcmtkMxml -lNrrdIO -lD4CMTK -lfftw3l -lfftw3_threads -lpcre2-8 -lpcre -llzma -lbz2 -lz -lrt -ldl -lm -licuuc -licui18n -L/usr/lib/R/lib -lR
installing to /home/tedwu/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-cmtkr/00new/cmtkr/libs
** R
** inst
** tests
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘cmtkr’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/tedwu/R/x86_64-pc-linux-gnu-library/3.6/00LOCK-cmtkr/00new/cmtkr/libs/cmtkr.so':
libcmtkBase.so: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/tedwu/R/x86_64-pc-linux-gnu-library/3.6/cmtkr’
Error in (function (command = NULL, args = character(), error_on_status = TRUE, :
System command 'R' failed, exit status: 1, stdout & stderr were printed
Type .Last.error.trace to see where the error occured
It's weird, because I checked and indeed the .so file is available under /usr/local/lib/cmtk/libcmtkBase.so
I think this problem now probably is an easy fix? Thank you very much for your support!
Best, Yifan
This was my cmake command
cmake -D CMAKE_BUILD_TYPE=Release -D BUILD_TESTING=OFF -D BUILD_CONTRIB=ON -D BUILD_CONTRIB_MUNGER=ON -DBUILD_SHARED_LIBS=ON -C ../cmtk-3.3.1/config/gcc-x86_64-sse.cmake ../cmtk-3.3.1
I am trying to install cmtkr because I saw it mentioned as a dependency required in one of your tutorials
Hmm. Which one? The use case is if you need to transform many, many points in the "forward" direction. This is not so typical for us.
Re your install issue, what does:
ls -l /usr/local/lib/cmtk
return?
And maybe
ldd /usr/local/lib/cmtk/libcmtkBase.so
Dear Jefferis lab
I am having an issue installing cmtkr on my Ubuntu 20.04.
I have made sure I installed cmtk properly, by following the instructions in https://www.nitrc.org/forum/message.php?msg_id=30119 I just replaced
core
withcmtk-3.3.1
, as that was the name of the folder created upon uncompressing of the .tar.gz. I also ransudo make install
. after compiling with make The output of the cmake command reported that the FFT feature would be disabled because the libraries are not available. However, I need them to install cmtkr, because othrewise ld complains during installation and it fails. Fortunately, I found a workaround by installing the libfftw3-dev and libfftw3-bin libraries in Ubuntu 20.04. I am now having another issue which I have no idea how to solveDo you know how to solve this problem? Thank you in advance!