I'm trying to install the python library rpy2 in OS X (El Capitan) with R 3.4.
I did follow many posts on web and I end up replacing clang from xcode to one manually installed (after following http://thecoatlessprofessor.com/programming/openmp-in-r-on-os-x/#clang-before-3-4-0):
clang version 4.0.0 (tags/RELEASE_400/final)
Target: x86_64-apple-darwin15.5.0
Thread model: posix
InstalledDir: /usr/bin
Still, when I tried to install rpy2 (sudo pip3 install rpy2):
clang -bundle -undefined dynamic_lookup build/temp.macosx-10.11-x86_64-3.6/./rpy/rinterface/_rinterface.o -L/usr/local/lib -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib -Lbuild/temp.macosx-10.11-x86_64-3.6 -L/usr/local/lib -lpcre -llzma -lbz2 -lz -licucore -lm -liconv -lr_utils -o build/lib.macosx-10.11-x86_64-3.6/rpy2/rinterface/_rinterface.cpython-36m-darwin.so -fopenmp -F/Library/Frameworks/R.framework/.. -framework R
ld: library not found for -lomp
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
What's lomp? I'm not sure what I can do now.
UPDATE:
I try to reinstall llvm through brew:
brew reinstall --with-clang --with-lld --with-python --HEAD llvm
now installing rpy2 I got:
clang -bundle -undefined dynamic_lookup build/temp.macosx-10.11-x86_64-3.6/./rpy/rinterface/_rinterface.o -L/usr/local/lib -L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/sqlite/lib -Lbuild/temp.macosx-10.11-x86_64-3.6 -L/usr/local/lib -lpcre -llzma -lbz2 -lz -licucore -lm -liconv -lr_utils -o build/lib.macosx-10.11-x86_64-3.6/rpy2/rinterface/_rinterface.cpython-36m-darwin.so -fopenmp -F/Library/Frameworks/R.framework/.. -framework R
ld: library not found for -lomp
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1
Although from the llvm installation I got the advice:
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/llvm/lib
CPPFLAGS: -I/usr/local/opt/llvm/include
do you know how to set it? It may be the reason it fails
This was discussed on the rpy2 issue tracker: https://bitbucket.org/rpy2/rpy2/issues/403/cannot-pip-install-rpy2-with-latest-r-340
Note that the issue was resolved and a precompiled binary wheel for rpy2-2.9.3 is now available on pypi.
Related
This is likely an error installing PCRE2 (which I did using "sudo port install pcre2"), but when I "make" sample code for RInside, I get:
$ make rinside_sample0
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include -I/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RInside/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include rinside_sample0.cpp -L/usr/local/lib -F/Library/Frameworks/R.framework/.. -framework R -L/usr/local/lib -lpcre2-8 -llzma -lbz2 -lz -licucore -ldl -lm -liconv -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/Library/Frameworks/R.framework/Resources/lib -lRlapack /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RInside/lib/libRInside.a -o rinside_sample0
In file included from rinside_sample0.cpp:10:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RInside/include/RInside.h:26:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RInside/include/RInsideCommon.h:38:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp.h:57:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/DataFrame.h:136:18: warning: unused variable 'data'
[-Wunused-variable]
SEXP data = Parent::get__();
^
1 warning generated.
ld: library not found for -lpcre2-8
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [rinside_sample0] Error 1
$
Thank you for the comment, Dirk. You got me pointed in the correct direction. I had two old versions of code: pcre2 and Rcpp.
I followed the directions for installing the latest version of "pcre2" here: https://izziswift.com/how-to-install-pcre-development-headers-on-mac-osx/.
I downloaded "pcre" version 10.39, cd'd to that directory, ran:
./configure
make
make install
After that, the examples in RInside compiled, but I got a runtime error:
$ ./rinside_sample0
Error: function 'Rcpp_precious_remove' not provided by package 'Rcpp'
Execution halted
$
Some searching showed that error arose from running an older version (1.0.6) of "Rcpp". I went into RStudio, typed "install.packages("Rcpp")" to update to version 1.0.7 and now everything runs!
Hopefully going through these steps will help anyone else who encounters these problems.
I’m running into issues while trying to install the rJava package on my Mac. I have tried the solutions proposed online, including running R CMD javareconf, but without success (output is below). Any advice on how to fix this issue would be much appreciated.
Among the things I tried is the solution proposed here: rJava installation fails on macOS 10.14
open macOS_SDK_headers_for_macOS_10.14.pkg```
This had worked for me with my previous Mac, but not this time.
Output of:
```sudo R CMD javareconf```
Java interpreter : /usr/bin/java
Java version : 12.0.2
Java home path : /Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
trying to compile and link a JNI program
detected JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
/usr/local/Cellar/gcc/9.1.0/bin/gcc-9 -I"/usr/local/Cellar/r/3.6.1/lib/R/include" -DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/include/darwin -I/usr/local/opt/gettext/include -I/usr/local/opt/readline/include -I/usr/local/include -fPIC -g -O2 -c conftest.c -o conftest.o
/usr/local/Cellar/gcc/9.1.0/bin/gcc-9 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/Cellar/r/3.6.1/lib/R/lib -L/usr/local/Cellar/gcc/9.1.0/lib -o conftest.so conftest.o -L/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/lib/server -ljvm -L/usr/local/Cellar/r/3.6.1/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
ld: library not found for -lintl
collect2: error: ld returned 1 exit status
make: *** [conftest.so] Error 1
Unable to compile a JNI program
JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home
Java library path:
JNI cpp flags :
JNI linker flags :
Updating Java configuration in /usr/local/Cellar/r/3.6.1/lib/R
Done.
I'm trying to install BASiCS in R 3.4.2 on macOS High Sierra. I've installed R via homebrew. I've also installed gfortran as part of gcc via brew install gcc.
Still, I get the error below. Does anyone have a clue how to resolve this?
Thanks,
ERROR MESSAGE IN R
Downloading GitHub repo catavallejos/BASiCS#master
from URL https://api.github.com/repos/catavallejos/BASiCS/zipball/master
Installing BASiCS
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ \
--no-save --no-restore --quiet CMD INSTALL \
'/private/var/folders/xk/dfj20kgd56xg8796xh874tjr0000gn/T/RtmpW243tu/devtools3375bbc3c81/catavallejos-BASiCS-407caff' \
--library='/Library/Frameworks/R.framework/Versions/3.4/Resources/library' \
--install-tests
* installing *source* package ‘BASiCS’ ...
** libs
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RcppArmadillo/include" -I/usr/local/include -fPIC -Wall -g -O2 -c BASiCS_CPPcode.cpp -o BASiCS_CPPcode.o
In file included from BASiCS_CPPcode.cpp:12:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/RcppArmadillo/include/RcppArmadillo.h:31:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:26:
In file included from /Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include/RcppCommon.h:122:
/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include/Rcpp/exceptions.h:103:53: warning: all paths through this function will call itself
[-Winfinite-recursion]
inline void warning(const std::string& message) { // #nocov start
^
1 warning generated.
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RcppArmadillo/include" -I/usr/local/include -fPIC -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o BASiCS.so BASiCS_CPPcode.o RcppExports.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [BASiCS.so] Error 1
ERROR: compilation failed for package ‘BASiCS’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/BASiCS’
Installation failed: Command failed (1)
It seems you need to install gfortran from CRAN, rather than via homebrew.
I had the same problem and solved it with this github recommendation.
I am having problems installing the Package packfor form source in Mac OS X Yosemite in the R software. I know that the package depends on fortran compiler, so I installed the gfortran available in CRAN but it does not affect anything. Bellow I am reproducing the error log.
please if anyone has any advice on this would be much appreciated.
Thanks in advance
install.packages("~/Downloads/packfor_0.0-8.tar", repos =
NULL,type="source")
installing source package ‘packfor’ ...
** libs clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -fPIC -Wall -mtune=core2 -g -O2 -c forward.c -o forward.o forward.c:411:3: warning: implicit declaration of function 'dgesvd_' is invalid in C99 [-Wimplicit-function-declaration]
F77_CALL(dgesvd)(&jobu, &jobvt,&size, &size,A, &size,
D,U,&size,V,&size,&work1, &lwork,&error); ^
/Library/Frameworks/R.framework/Resources/include/R_ext/RS.h:82:22:
note: expanded from macro 'F77_CALL'
define F77_CALL(x) x ## _
^ :8:1: note: expanded from here dgesvd_ ^ forward.c:421:43: warning: data argument not used by
format string [-Wformat-extra-args]
fprintf(stderr, "error in dinvG: ", error);
~~~~~~~~~~~~~~~~~~ ^
/Library/Frameworks/R.framework/Resources/include/R_ext/Error.h:51:15:
note: expanded from macro 'error'
define error Rf_error
^ 2 warnings generated. clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o packfor.so forward.o -L/Library/Frameworks/R.framework/Resources/lib
-lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation Warning message: In install.packages("~/Downloads/packfor_0.0-8.tar", repos = NULL, :
installation of package ‘/Users/rafael/Downloads/packfor_0.0-8.tar’
had non-zero exit status ld: warning: directory not found for option
'-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2' ld: library not
found for -lquadmath clang: error: linker command failed with exit
code 1 (use -v to see invocation) make: *** [packfor.so] Error 1
ERROR: compilation failed for package ‘packfor’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/packfor’
>
I recently "upgraded" to XCode 5.2 and now a number of R packages will not work. I have a 15" MBP running OSX Mavericks 10.9.1 and am running R 3.0.2.
First, the mcmc function in the package diversitree broke and gave the following error:
Error in .External(list(name = "CppMethod__invoke_notvoid", address = <pointer: 0x0>, :
NULL value passed as symbol address
Furthermore, I cannot compile the package "geomorph" from source, and I get the following error:
clang: error: no such file or directory: 'SHLIB_LIBADD'
clang: error: no such file or directory: '='
make: *** [geomorph.so] Error 1
ERROR: compilation failed for package ‘geomorph’
So I believe the error is somewhere in the compilers. I tested this idea with:
> require(Rcpp)
> evalCpp("1+1")
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I"/Users/Chris/Library/R/3.0/library/Rcpp/include" -fPIC "-mtune=native -g -O2 -Wall -pedantic -Wconversion" -c file177c642d0b53.cpp -o file177c642d0b53.o clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -L/usr/local/lib -o sourceCpp_1783.so file177c642d0b53.o /Users/Chris/Library/R/3.0/library/Rcpp/lib/libRcpp.a SHLIB_LIBADD = -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
Error in sourceCpp(code = code, env = env, rebuild = rebuild, showOutput = showOutput, :
Error 1 occurred building shared library.
WARNING: The tools required to build C++ code for R were not found.
Please install Command Line Tools for XCode (or equivalent).
clang: error: no such file or directory: 'SHLIB_LIBADD'
clang: error: no such file or directory: '='
make: *** [sourceCpp_1783.so] Error 1
Also this:
has_devel()
'/Library/Frameworks/R.framework/Resources/bin/R' --vanilla \
CMD SHLIB foo.c
clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fPIC "-mtune=native -g -O2 -Wall -pedantic -Wconversion" -c foo.c -o foo.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -L/usr/local/lib -o foo.so foo.o SHLIB_LIBADD = -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
clang: error: no such file or directory: 'SHLIB_LIBADD'
Error: Command failed (1)
clang: error: no such file or directory: '='
make: *** [foo.so] Error 1
I tried reinstalling Rcpp from source and that fails too:
clang: error: no such file or directory: 'SHLIB_LIBADD'
clang: error: no such file or directory: '='
make: *** [Rcpp.so] Error 1
I've spent hours now trying to troubleshoot this and I've run across numerous mentions of editing the Makeconf file to add clang. I have done this but still cannot get things that use C in R to work. I would greatly appreciate any help.
Are you using a CRAN-provided binary of R, or your own compiled version of R? Did you compile R with your new XCode compilers or the old ones?
My experience is that CRAN-R will work fine with a specific compiler toolchain, as long as you use the same toolchain for all the packages you compile. If you, for example, try to link a new-XCode compiled package to an old-XCode compiled Rcpp, you will have problems.
Your SHLIB_LIBADD error, as far as I can guess, says you did something weird in your Makevars or Makeconf and now things are going wrong in parsing the files. I'd be curious to see if you can reproduce this with a fresh, CRAN-provided R.
Can you reproduce the problem if you try to re-install R + all your packages? You should try re-installing R with a fresh library directory, and then re-installing these problematic packages, and going from there.