Closed Weiming-Hu closed 7 years ago
You need to download rohan-shah/Rcpp and build that using CMake. As part of building that package, a file RcppConfig.cmake is generated. You can then refer to that when building mpMap2 using -DRcpp_DIR=\<RcppBinaryDir>.
I have added these instructions to Readme.md .
Regarding boost, is it possible you don't have the graph or regex components built? Or that your installed version is older than 1.50.0? It's not required in any case, you can disable it with -DUSE_BOOST=OFF. I have updated the default state of this option to OFF.
Thank you. I'll check my Boost
components. As for FindRcpp.cmake
, I've installed in R
using command install.packages()
. If I install your version, will it be conflict with mine? Why don't you put the FindRcpp
file in this repo and speechify the MODULE_PATH
?
OK. I got it working through manually R CMD install
and R CMD build
, but not cmake
and make
. It first complains about
Warning message:
package ‘roxygen_devtest’ is not available (for R version 3.4.0)
After searching, I made some changes in you CMakeLists.txt
per suggestions here. On CMakeLists.txt
line 61, I changed roxygen2::roxygenise()
to devtools::document()
, and it seems like passing. But again, it fails later complaining:
* installing *source* package ‘mpMap2’ ...
ERROR: a 'NAMESPACE' file is required
But you definitely have the NAMESPACE
file under in the project. Any ideas?
Another random ask is that, since R CMD
build system works and CMake
doesn't, does this mean that as a R pakcage developer, we should not bypass the R CMD
build system?
Thank you!
The problem is with the current version of roxygen
. So don't change the line 61. Just use an older version of the package.
devtools::install_version(package = 'roxygen2',version = '5.0.1', repos = c(CRAN = "https://cran.rstudio.com"))
There appears to be a bug in the newest roxygen2 which was not present previously. You'll have to wait for a fix from haddley.
The custom Rcpp you downloaded compiles to a static library. It is not an R package, so there is no conflict.
I don't know what that NAMESPACE error is about. Did you follow the instructions under "Package Compilation" of Readme.md, using an out-of-source build?
Yes, the CMake build system does work, but you must be doing something I have not tested. And no, you should not use this system unless you have a good reason to. If you want it fixed, you need to send me a minimal reproducible example.
OK. I have compiled Rcpp
at ~/tmp/Rcpp
, and I have a libRcpp.a
and RcppConfig.cmake
under ~/tmp/Rcpp/build
directory. For mpMap2
, I'm doing an out-of-tree build in~/tmp/mpMap2/build
directory. I have run cmake -DRcpp_DIR=$HOME/tmp/Rcpp/build ..
and make && make install
. Everything is working until the last step of linking the library.
Undefined symbols for architecture x86_64:
"_ATTRIB", referenced from:
Rcpp::AttributeProxyPolicy<Rcpp::RObject_Impl<Rcpp::PreserveStorage> >::hasAttribute(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) const in checkHets.cpp.o
"_CAR", referenced from:
get_last_call() in alleleDataErrors.cpp.o
get_last_call() in combineGenotypes.cpp.o
get_last_call() in estimateRF.cpp.o
get_last_call() in fourParentPedigreeRandomFunnels.cpp.o
get_last_call() in generateGenotypes.cpp.o
get_last_call() in intercrossingAndSelfingGenerations.cpp.o
get_last_call() in matrixChunks.cpp.o
...
"_CDDR", referenced from:
Rcpp::Rcpp_eval(SEXPREC*, SEXPREC*) in alleleDataErrors.cpp.o
Rcpp::Rcpp_eval(SEXPREC*, SEXPREC*) in checkHets.cpp.o
Rcpp::Rcpp_eval(SEXPREC*, SEXPREC*) in combineGenotypes.cpp.o
Rcpp::Rcpp_eval(SEXPREC*, SEXPREC*) in estimateRF.cpp.o
Rcpp::Rcpp_topLevelExec(SEXPREC*, SEXPREC*) in estimateRF.cpp.o
Rcpp::Rcpp_eval(SEXPREC*, SEXPREC*) in estimateRFCheckFunnels.cpp.o
Rcpp::Rcpp_eval(SEXPREC*, SEXPREC*) in estimateRFSpecificDesign.cpp.o
...
"_VECTOR_ELT", referenced from:
Rcpp::internal::generic_proxy<19>::get() const in alleleDataErrors.cpp.o
Rcpp::internal::generic_proxy<19>::get() const in checkHets.cpp.o
Rcpp::internal::generic_proxy<19>::get() const in combineGenotypes.cpp.o
Rcpp::internal::generic_proxy<19>::get() const in estimateRF.cpp.o
Rcpp::internal::generic_proxy<19>::get() const in estimateRFCheckFunnels.cpp.o
Rcpp::internal::generic_proxy<19>::get() const in estimateRFSpecificDesign.cpp.o
Rcpp::internal::generic_proxy<19>::get() const in intercrossingAndSelfingGenerations.cpp.o
...
"_unif_rand", referenced from:
createGamete(Rcpp::Vector<14, Rcpp::PreserveStorage>&, Rcpp::Vector<13, Rcpp::PreserveStorage>&, int*) in generateGenotypes.cpp.o
Rcpp::stats::UnifGenerator::operator()() const in generateGenotypes.cpp.o
arsa(arsaArgs&) in arsa.cpp.o
getPairForSwap(long, long&, long&) in arsa.cpp.o
getPairForMove(long, long&, long&, int) in arsa.cpp.o
arsaRaw(arsaRawArgs&) in arsaRaw.cpp.o
getPairForSwap(long, long&, long&) in arsaRaw.cpp.o
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/mpMap2.dylib] Error 1
make[1]: *** [src/CMakeFiles/mpMap2.dir/all] Error 2
make: *** [all] Error 2
It looks like it is complaining about Rcpp
linking. Any ideas? Thank you
Yeah, that's failure to link to libR.so. Can I please get a copy of the link command?
Please check that libR.so is present in one of the directories passed with -L. Also, did you compile R yourself? I have never tested with a version of R compiled without --enable-R-shlib.
I installed R
using brew
, and below is the configuration info:
users$ brew info R
homebrew/science/r: stable 3.4.0 (bottled), HEAD
Software environment for statistical computing
https://www.r-project.org/
/usr/local/Cellar/r/3.4.0_1 (2,247 files, 59MB) *
Poured from bottle on 2017-05-05 at 15:26:14
From: https://github.com/Homebrew/homebrew-science/blob/master/r.rb
==> Dependencies
Build: pkg-config ✔, texinfo ✘
Required: readline ✔, gettext ✔, libtiff ✔, pcre ✔, jpeg ✔, libpng ✔, xz ✔, cairo ✔
Optional: openblas ✘, pango ✘, valgrind ✘
==> Requirements
Required: fortran ✔
Optional: x11 ✔
==> Options
--with-librmath-only
Only build standalone libRmath library
--with-openblas
Build with openblas support
--with-pango
Build with pango support
--with-valgrind
Build with valgrind support
--with-x11
Build with x11 support
--without-accelerate
Build without the Accelerate framework (use Rblas)
--without-tcltk
Build without Tcl/Tk
--without-test
Skip build-time tests (not recommended)
--HEAD
Install HEAD version
==> Caveats
To enable rJava support, run the following command:
R CMD javareconf JAVA_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
If you've installed a version of Java other than the default, you might need to instead use:
R CMD javareconf JAVA_CPPFLAGS="-I/System/Library/Frameworks/JavaVM.framework/Headers -I/Library/Java/JavaVirtualMachines/jdk<version>.jdk/"
(where <version> can be found by running `java -version`, `/usr/libexec/java_home`, or `locate jni.h`), or:
R CMD javareconf JAVA_CPPFLAGS="-I/System/Library/Frameworks/JavaVM.framework/Headers -I$(/usr/libexec/java_home | grep -o '.*jdk')"
There is no --enable-R-shlib
. What does this do? Thank you.
Oh, you're on a mac. I don't own one, so it's not well tested there. I'll borrow one next time I get a chance, and fix the link commands.
Sure. Thanks.
Hi. Is it true that when install the pakage using R CMD
system, Boost
library is not used?
Yes, that's correct. Getting boost to work with Makefiles is just too unpleasant.
I haven't forgotten about testing on a mac.
Thank you. I encountered the same awkwardness when trying to include Boost
library into my R package. At last, I decided to transfer entirely to autotools
and configure
, which has more support from Rcpp
....
I'm looking at the linking problem right now. I have tried to link to the Rcpp
compiled using your code, and the Rcpp
installed by R. But the problem is still there.
Compilation may be fixed on osX. Tested on a whole one system.
The roxygen2 bug remains, but not much I can do about that immediately.
I'm going to go ahead and close this soon, unless there's anything else.....
When I'm doing an out-of-tree build under
mpMap2/build
, I got the following error message:I have used
find_package(Boost ...)
function in my own CMakeLists.txt, and there is no error. Wierd....And I don't find
FindRcpp.cmake
in your project.Thank you.