cmake "Could not find R" error
bettycatherine opened this issue · 10 comments
Hello, I am trying to install dropest on a cluster, and I did everything in the manual, and the step cmake always turn out the same error:
-- Boost version: 1.69.0
-- Found the following Boost libraries:
-- filesystem
-- iostreams
-- log
-- system
-- thread
-- unit_test_framework
-- ** Boost Include: /usr/local/include
-- ** Boost Libraries: /usr/local/lib
-- ** Boost Link-Libs: /usr/local/lib/libboost_filesystem.so;/usr/local/lib/libboost_iostreams.so;/usr/local/lib/libboost_log.so;/usr/local/lib/libboost_system.so;/usr/local/lib/libboost_thread.so;/usr/local/lib/libboost_unit_test_framework.so
-- Could not find libR shared library.
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:108 (message):
Could NOT find R (missing: R_LIBRARIES)
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:315 (_FPHSA_FAILURE_MESSAGE)
CMake/FindR.cmake:136 (find_package_handle_standard_args)
CMake/deps.cmake:34 (find_package)
CMakeLists.txt:18 (include)
-- Configuring incomplete, errors occurred!
See also "/gpfs/home/lvxue/softwares/dropEst/CMakeFiles/CMakeOutput.log".
See also "/gpfs/home/lvxue/softwares/dropEst/CMakeFiles/CMakeError.log".
Because I am on a cluster, so I do not have root authorities, and the R on the machine is as follows:
$ which R
/gpfs/software/R-3.6.0/bin/R
$ R --slave --no-save -e "cat(R.home('lib'))"
/gpfs/software/R-3.6.0/lib64/R/lib
$ ls -la R --slave --no-save -e "cat(R.home('lib'))"
/libR*
-rwxr-xr-x 1 root root 444192 Jun 13 2019 /gpfs/software/R-3.6.0/lib64/R/lib/libRblas.so
-rwxr-xr-x 1 root root 5262784 Jun 13 2019 /gpfs/software/R-3.6.0/lib64/R/lib/libRlapack.so
And I also tried to install R myself and add to the library path and still did not work.
So can anyone have some advice on how can I make the next step? Thank you very much!
Xue
The error you are running into is here: https://github.com/hms-dbmi/dropEst/blob/master/CMake/FindR.cmake#L68-L76
I'm guessing the problem could be that you haven't set R_ROOT
and R_PACKAGES
, i.e.
https://github.com/hms-dbmi/dropEst/blob/master/CMake/FindR.cmake#L1-L16
You can set R_ROOT and R_PACKAGES to specify R paths
We might need to make this more clear for users.
Another possibility if that you should make sure that your R was configured and built with --enable-R-shlib
e.g.
./configure --prefix=/opt/R/3.2.3 --enable-R-shlib
make
make install
You don't need sudo privileges to do this.
Hi @evanbiederstedt ,
Thank you for your reply. I maybe changed some code, and the message seemed like that cmake already found R_ROOT, however, it still could not find R.
CMake variable R_ROOT is set to:
/gpfs/software/R-3.6.0/lib64/R
For compatibility, CMake is ignoring the variable.
Call Stack (most recent call first):
CMakeLists.txt:18 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
-- Could not find libR shared library.
CMake Error at /gpfs/home/lvxue/softwares/cmake-3.18.0-Linux-x86_64/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
Could NOT find R (missing: R_LIBRARIES)
Call Stack (most recent call first):
/gpfs/home/lvxue/softwares/cmake-3.18.0-Linux-x86_64/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
CMake/FindR.cmake:136 (find_package_handle_standard_args)
CMake/deps.cmake:34 (find_package)
CMakeLists.txt:18 (include)
-- Configuring incomplete, errors occurred!
So how to set those path? I have checked the codes you applied, and don't find a place to set. Would you please give me more hint? Thank you !
Best,
Xue
So, you need to set the variables R_ROOT
and R_PACKAGES
. Within your R session, try the following commands
> .libPaths()
## [1] "/Library/Frameworks/R.framework/Versions/4.0/Resources/library"
> R.home()
## [1] "/Library/Frameworks/R.framework/Resources"
The first path .libPaths()
should be the path for the variable R_PACKAGES
, and the second should be R_ROOT
. (Naturally, if these paths don't point to the version of R you wish, they should provide the pattern you need as described in the Cmake file.)
Set these variables as follows:
R_ROOT=/Library/Frameworks/R.framework/Resources
R_PACKAGES=/Library/Frameworks/R.framework/Versions/4.0/Resources/library
Hope that helps
Hi @evanbiederstedt ,
Thank you for your reply. I tried what you applied, in R,
.libPaths()
[1] "/gpfs/home/lvxue/R/x86_64-pc-linux-gnu-library/3.6"
[2] "/gpfs/software/R-3.6.0/lib64/R/library"
R.home()
[1] "/gpfs/software/R-3.6.0/lib64/R"
And then I modified the CMakeList.txt (from the troubleshooting):
cmake_minimum_required(VERSION 2.8)
project(dropEst)
set(R_ROOT /gpfs/software/R-3.6.0/lib64/R)
set(R_PACKAGES /gpfs/software/R-3.6.0/lib64/R/library)
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMake")
(with or without quotation on the path).
And I also tried add the path when cmaking (also with or without the quotation marks):
cmake3 .. -DR_ROOT="/gpfs/software/R-3.6.0/lib64/R" -DR_PACKAGES="/gpfs/software/R-3.6.0/lib64/R/library"
And it turned out the same error:
-- Could not find libR shared library.
CMake Error at /gpfs/home/lvxue/softwares/cmake-3.18.0-Linux-x86_64/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
Could NOT find R (missing: R_LIBRARIES)
Call Stack (most recent call first):
/gpfs/home/lvxue/softwares/cmake-3.18.0-Linux-x86_64/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:458 (_FPHSA_FAILURE_MESSAGE)
CMake/FindR.cmake:136 (find_package_handle_standard_args)
CMake/deps.cmake:34 (find_package)
CMakeLists.txt:19 (include)
-- Configuring incomplete, errors occurred!
I begin to wonder if there is something wrong with my R.
Do you have more ideas?
Another ideas is that the shared library libR.so
cannot be found. Please make sure that your R was configured and built with --enable-R-shlib
First check to see whether libR.so
currently exists. Wherever your R_ROOT
path is (that is, R.home()
), there should be a /lib
subdirectory. I guess for you, it's possibly /gpfs/software/R-3.6.0/lib64/R/lib
. Check if libR.so
exists. If not, you will need to install R from scratch with the flag above. That is,
make clean
./configure --prefix=/opt/R/3.2.3 --enable-R-shlib
make
make install
Thank you so much! I really do not have this libR.so, so I reinstalled R and modified the path in FindR.cmake and it finally worked!
Best,
xue
Glad it worked!
@evanbiederstedt Thank you for following up all this time! However, I have encountered another error when running droptag:
/gpfs/home/softwares/dropEst/droptag: error while loading shared libraries: libboost_filesystem.so.1.69.0: cannot open shared object file: No such file or directory
I installed boost 1.60.0 when I install dropest, and now I reinstalled boost 1.69.0 in my own directory, there are only four libs for boost:
lrwxrwxrwx 1 28 Aug 5 09:21 libboost_iostreams.so -> libboost_iostreams.so.1.69.0
-rwxr-xr-x 1 165664 Aug 5 09:21 libboost_iostreams.so.1.69.0
lrwxrwxrwx 1 22 Aug 5 09:21 libboost_log.so -> libboost_log.so.1.69.0
-rwxr-xr-x 1 2659248 Aug 5 09:21 libboost_log.so.1.69.0
There is nothing called libboost_filesystem.
I googled and also cannot find libboost_filesystem.so.1.69.0, I only find one libboost_filesystem.so.1.72.0 in boost-libs 1.72.0-2 on a website, and I did not know if it works. I put this file in the lib directory of my own path and it didnot work. I think it resquires the specific 1.69.0 version of libboost_filesystem file.
So is there something wrong when I install boost? I tried several times and the results are the same.
I'm not sure what linux distribution you're using, but you will probably want to install libboost-all-dev
or some variation of libboost-dev
.
I'm guessing the shared libraries will be found in /usr/lib/
, i.e. /usr/lib/libboost_filesystem.so
, but I'm not sure where this is on your system.
Thanks, Evan
Hi Evan @evanbiederstedt,
The reason is that I may not install boost coorectly, and should give the prefix at bootstrap stage. Now I fixed it and thank you for coming alone all the time. I will close this issue.
Xue