As per much of the advice on SE about getting Mac OS Sierra 10.12.4 to play with rJava nicely, the advice suggests installing from source.
However, when I try and run install.packages("rJava", type = "source") I get an output like so:
> install.packages("rJava", type = "source")
trying URL 'https://cran.rstudio.com/src/contrib/rJava_0.9-8.tar.gz'
Content type 'application/x-gzip' length 656615 bytes (641 KB)
==================================================
downloaded 641 KB
* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
checking for gcc... /usr/local/opt/llvm/bin/clang -fopenmp
checking whether the C compiler works... no
configure: error: in `/private/var/folders/lj/4s8lnxmj4_q8h65zk705k6dr0000gn/T/Rtmp4BrRQs/R.INSTALLd1278e3aab0/rJava':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘rJava’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rJava’
Warning in install.packages :
installation of package ‘rJava’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/lj/4s8lnxmj4_q8h65zk705k6dr0000gn/T/RtmpFhnj89/downloaded_packages’
I've tried updating gcc and gfortran using brew, and also modified my makeconf as specified in answers here and have install xcode.
Update: I believe I have openmp installed via clang, which installed via llvm.
Upate 2: as per hrbrmstrs comment, his file at ~/.R/Makevars differed significantly from mine. Mine was I assume a default:
CC=/usr/local/opt/llvm/bin/clang -fopenmp
CXX=/usr/local/opt/llvm/bin/clang++
LDFLAGS=-L/usr/local/opt/gettext/lib -L/usr/local/opt/llvm/lib
CPPFLAGS=-I/usr/local/opt/gettext/include -I/usr/local/opt/llvm/include
And theirs was:
# shell
sudo ln -f -s $(/usr/libexec/java_home)/jre/lib/server/libjvm.dylib /usr/local/lib
# ~/.R/Makevars
F77 = /usr/local/gfortran/bin/gfortran
FC = /usr/local/gfortran/bin/gfortran
FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin15/6.1.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
CC=ccache /usr/local/opt/gcc/bin/gcc-6 -Wunused-argument
CXX=ccache /usr/local/opt/gcc/bin/g++-6 -Wunused-argument
CXX1X=ccache /usr/local/opt/gcc/bin/g++-6
SHLIB_CXXLD=ccache /usr/local/opt/gcc/bin/g++-6
CCACHE_CPP=yes
CCACHE_CPP2=yes
MAKE=make -j8
Available as a gist too
Output of install.packages("rJava, type = "source") is now
> install.packages("rJava", type = "source")
trying URL 'https://cran.rstudio.com/src/contrib/rJava_0.9-8.tar.gz'
Content type 'application/x-gzip' length 656615 bytes (641 KB)
==================================================
downloaded 641 KB
* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
/Users/davidparr/.R/Makevars:10: *** missing separator. Stop.
/Users/davidparr/.R/Makevars:10: *** missing separator. Stop.
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R...
/Users/davidparr/.R/Makevars:10: *** missing separator. Stop.
configure: error: absent
R was configured without Java support. Please run
R CMD javareconf
as root to add Java support to R.
If you do not have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.
ERROR: configuration failed for package ‘rJava’
* removing ‘/Library/Frameworks/R.framework/Versions/3.3/Resources/library/rJava’
Warning in install.packages :
installation of package ‘rJava’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/lj/4s8lnxmj4_q8h65zk705k6dr0000gn/T/Rtmp7beCd4/downloaded_packages’
Now, when I try to run R CMD javareconf -e as suggested (I am not in root user), I get the following in the terminal.
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
ccache /usr/local/opt/gcc/bin/gcc-6 -Wunused-argument -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/../include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/../include/darwin -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -fPIC -Wall -mtune=core2 -g -O2 -c conftest.c -o conftest.o
make: ccache: No such file or directory
make: *** [conftest.o] Error 1
Unable to compile a JNI program
I definately have a file gcc-6 in the location specified. Why is the line CXX=ccache /usr/local/opt/gcc/bin/g++-6 -Wunused-argument not CXX=/usr/local/opt/gcc/bin/g++-6?
Running sudo R CMD javareconf with and without -e is more optimistic, though I still don't understand the significance of -e:
Java interpreter : /usr/bin/java
Java version : 1.8.0_131
Java home path : /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
Non-system Java on macOS
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/opt/gcc/bin/gcc-6 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/../include -I/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/../include/darwin -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -fPIC -Wall -mtune=core2 -g -O2 -c conftest.c -o conftest.o
/usr/local/opt/gcc/bin/gcc-6 -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 conftest.so conftest.o -L/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre/lib/server -ljvm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home/jre
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/darwin
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /Library/Frameworks/R.framework/Resources
Done.
FWIW, I recently encountered this problem on Mac trying to upgrade from 3.4.x to 3.5.1.
My 3.4.x install had come from https://cran.r-project.org/ but I had used brew install r to upgrade.
install.packages('rJava') was refusing to work with the same error message as here:
configure: error: C compiler cannot create executables
I came here and was skeptical of changing anything in my Makevars because I already had rJava up and running on my machine for about a year on 3.4.x; in fact my .R folder was empty.
I finally concluded that the brew install was the source of my issues (or at least, that some unresolved & hidden mix-up was happening behind the scenes between my old & new installs) & installed from the CRAN website's .pkg file & this issue went away immediately.
Hopefully this experience can be helpful to some others as well.
Related
I am trying to install some packages (mailR) to be able to communicate errors and messages to my users by mail, and connecting to HIVE server via rJdbc but installing rJava dependency is getting convoluted more and more as steps are accomplished.
First error is asking for rJava package, so I tried installing rJava:
install.packages("rJava")
Installing package into ‘/home/joe/R/x86_64-pc-linux-gnu-library/3.6’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/rJava_0.9-11.tar.gz'
Content type 'application/x-gzip' length 675188 bytes (659 KB)
==================================================
downloaded 659 KB
* installing *source* package ‘rJava’ ...
** package ‘rJava’ successfully unpacked and MD5 sums checked
** using staged installation
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -std=gnu99 supports static inline...
yes
checking whether setjmp.h is POSIX.1 compatible... yes
checking whether sigsetjmp is declared... yes
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/lib/jvm/default-java/bin/java'
archiver : '/usr/bin/jar'
compiler : '/usr/bin/javac'
header prep.: '/usr/bin/javah'
cpp flags : ''
java libs : ''
configure: error: One or more Java configuration variables are not set.
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.
If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.
ERROR: configuration failed for package ‘rJava’
* removing ‘/home/jmvo/R/x86_64-pc-linux-gnu-library/3.6/rJava’
Warning in install.packages :
installation of package ‘rJava’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpkTvmz8/downloaded_packages’
So I followed the instructions as root and:
sudo R CMD javareconf
Java interpreter : /usr/lib/jvm/default-java/bin/java
Java version : 11.0.3
Java home path : /usr/lib/jvm/default-java
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 :
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-VAQCff/r-base-3.6.0=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c conftest.c -o conftest.o
conftest.c:1:10: fatal error: jni.h: No such file or directory
#include <jni.h>
^~~~~~~
compilation terminated.
/usr/lib/R/etc/Makeconf:167: recipe for target 'conftest.o' failed
make: *** [conftest.o] Error 1
Unable to compile a JNI program
JAVA_HOME : /usr/lib/jvm/default-java
Java library path:
JNI cpp flags :
JNI linker flags :
Updating Java configuration in /usr/lib/R
Done.
I´ve checked if I have Open JDK installed because many SO answers seems to be related with absence of JDK.
java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-0ubuntu1.18.04.1-b03)
OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)
to be sure, tried installing again JDK with
sudo apt-get install openjdk-8-jdk
Reading package lists... Done
Building dependency tree
Reading state information... Done
openjdk-8-jdk is already the newest version (8u212-b03-0ubuntu1.18.04.1).
0 upgraded, 0 newly installed, 0 to remove and 74 not upgraded.
Some other SO answers suggest installing rJava via apt-get this way
sudo apt-get install r-cran-rjava
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
r-cran-rjava : Depends: r-api-3.4
E: Unable to correct problems, you have held broken packages.o
But i`m using R 3.6, so going back is not an option.
Changing to Oracle java is not an option. Many working apps are OpenJDK dependant.
No success so far. This is a never ending process. Tried many SO answers on the matter to no avail.
I need rJava not only for mail but for many other processes like connecting to Hive , and so on... from R.
Thanks
I am trying to install RQuantLib on a Mac OSX 10.13. I have the latest version of R: Version 3.4.3.
I have done the following pre requisites using homebrew
brew install boost
brew install quantlib
However, when I try
install.packages("RQuantLib", configure.args="--with-boost include=/usr/local/include/ --with-boost-lib=/usr/local/lib/")
R returns
* installing *source* package ‘RQuantLib’ ...
** package ‘RQuantLib’ successfully unpacked and MD5 sums checked
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking for R... yes
checking for quantlib-config... yes
checking for Boost development files... yes
checking for minimal Boost version... yes
configure: creating ./config.status
config.status: creating src/Makevars
Completed configuration and ready to build.
** libs
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG
-I"/Users/rorymcstay/Library/R/3.4/library/Rcpp/include" -
I/usr/local/include -Wall -g -O2 -
I/usr/local/Cellar/quantlib/1.12/include -I/usr/local/include/ -
I../inst/include -I. -fopenmp -DRCPP_NEW_DATE_DATETIME_VECTORS -fPIC -
Wall -g -O2 -c RcppExports.cpp -o RcppExports.o
clang: error: unsupported option '-fopenmp'
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘RQuantLib’
* removing ‘/Users/rorymcstay/Library/R/3.4/library/RQuantLib’
Warning in install.packages :
installation of package ‘RQuantLib’ had non-zero exit status
The downloaded source packages are in
‘/private/var/folders/mf/7p4rjjq53zg5_3bdqznb9p2h0000gn/T/RtmpsowkET/do wnloaded_packages’
Can anyone see what is going wrong?
Thanks
Rory
Another cry for help with installing nloptr package on Linux (Ubuntu 14.04.4 LTS). I looked through many questions but did not manage to find a solution for this.
I am unable to install lme4 package in R (version 3.3.1/Rstudio Version 0.99.902) as the installation of nloptr has non-zero exit status. When I try
install.package("nloptr")
I get the following:
Installing package into ‘/home/rd14/R/x86_64-pc-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/nloptr_1.0.4.tar.gz'
Content type 'unknown' length 353942 bytes (345 KB)
==================================================
downloaded 345 KB
* installing *source* package ‘nloptr’ ...
** package ‘nloptr’ successfully unpacked and MD5 sums checked
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking for pkg-config... yes
configure: Now testing for NLopt header file.
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking nlopt.h usability... no
checking nlopt.h presence... no
checking for nlopt.h... no
configure: Need to download and build NLopt
trying URL 'http://ab-initio.mit.edu/nlopt/nlopt-2.4.2.tar.gz'
Content type 'application/x-gzip' length 2361992 bytes (2.3 MB)
==================================================
downloaded 2.3 MB
configure: Starting to install library to /tmp/Rtmp7A1ldT/R.INSTALL66fffc391ed/nloptr/nlopt-2.4.2
configure: Done installing library to /tmp/Rtmp7A1ldT/R.INSTALL66fffc391ed/nloptr/nlopt-2.4.2
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c dummy.cpp -o dummy.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/tmp/Rtmp7A1ldT/R.INSTALL66fffc391ed/nloptr/nlopt-2.4.2/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c nloptr.c -o nloptr.o
nloptr.c:42:19: fatal error: nlopt.h: No such file or directory
#include "nlopt.h"
^
compilation terminated.
make: *** [nloptr.o] Error 1
ERROR: compilation failed for package ‘nloptr’
* removing ‘/home/rd14/R/x86_64-pc-linux-gnu-library/3.3/nloptr’
Warning in install.packages :
installation of package ‘nloptr’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmp4Y3TXJ/downloaded_packages’
Your help will be much appreciated!
Thank you.
When Jelmer and I built this setup it just worked on my Ubuntu machines, and continues to do so--either with the download and build of nlopt, or via the system library.
As you are on Ubuntu, the easiest fix for you is probably to just install the system nlopt library, which the nloptr package will detect and use. So do
sudo apt-get install libnlopt-dev
and then try installing nlopt again.
Similarly, you should be able to get lme4 as r-cran-lme4 from the appropriate PPAs by Michael Rutter as described in the README for Ubuntu at CRAN.
Every time I try installing RMySQL I get the following error:
Installing package into ‘/home/ehsan/R/x86_64-pc-linux-gnu-library/3.0’
(as ‘lib’ is unspecified)
* installing *source* package ‘RMySQL’ ...
** package ‘RMySQL’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for compress in -lz... yes
checking for getopt_long in -lc... yes
checking for mysql_init in -lmysqlclient... yes
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking mysql.h usability... no
checking mysql.h presence... no
checking for mysql.h... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql/mysql.h -fpic -O3 -pipe -g -c RS-DBI.c -o RS-DBI.o
cc1: warning: /usr/include/mysql/mysql.h: not a directory [enabled by default]
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/mysql/mysql.h -fpic -O3 -pipe -g -c RS-MySQL.c -o RS-MySQL.o
cc1: warning: /usr/include/mysql/mysql.h: not a directory [enabled by default]
In file included from RS-MySQL.c:22:0:
RS-MySQL.h:32:19: fatal error: mysql.h: No such file or directory
#include <mysql.h>
^
compilation terminated.
make: *** [RS-MySQL.o] Error 1
ERROR: compilation failed for package ‘RMySQL’
* removing ‘/home/ehsan/R/x86_64-pc-linux-gnu-library/3.0/RMySQL’
The downloaded source packages are in
‘/tmp/RtmpTRRPqg/downloaded_packages’
Warning message:
In install.packages("RMySQL") :
installation of package ‘RMySQL’ had non-zero exit status**
Seemingly, it cannot find mysql.h and I searched and changed the path to
export PKG_CPPFLAGS="-I/usr/R/include/mysql/mysql.h"
but it was not successful. There're many people who have had the same issue but non of their solutions (if existed) worked for me. I'd appreciate any comment or help.
#Update: Issue Resolved#
The following command seemed to solve the issue:
sudo apt-get install r-cran-rmysql
As said, the following command worked for me:
sudo apt-get install r-cran-rmysql
My this issue was resolved by executing the following command:
sudo apt-get install libmysql++-dev
since #ehsanmo hasn't posted his answer as an answer, then I will, and confirm that his solution works for me too:
sudo apt-get install r-cran-rmysql
(I'm on mint 12)
Well, there are two types of install/make problems. Missing .h files and/or missing .so/.a libs. As you can see from your log, you have a missing .h
The reason for these are multiple:
1.- the package that delivers these is not installed. This means that those files cannot be found anywhere in the /usr tree. The solution is to install right package, make sure the files are there
2.- The includes are not found by the install configurator. This means some environment variable or install option is not properly set. Which variable to set is usually specified in the documentation; in some cases you need to install something outside of R and again, that's usually specified in the documentation.
3.- the libs are not in the LD_LIBRARY_PATH, and hopefully the solution to that is self-explanatory.
4.- There is a deeper compile/link error, meaning the package is not compatible with the rest of the sw, or has not been properly ported.
Setp :1
find / -name mysql.h
If not found headers file is missing
Setp :1
Then install or reinstall mysql-devel or mysql-client
sudo yum (re)install mysql-devel
sudo yum (re)install mysql-client
sudo yum (re)install mysql-community-devel
sudo yum (re)install mysql-community-client
I'm trying to install RMySQL in Ubuntu 13.04 when using MySQL v5.6.14. Ubuntu does not have apt-get support for MySQL 5.6.14, so I had to install it manually. Now when I try to install RMySQL I get the following:
(It looks like the package files are not created? But I'm not sure why or how to debug it.)
elad#elad-ThinkPad-T430s:~/tmp$ sudo R CMD INSTALL --configure-args='--with-mysql-inc=/opt/mysql/server-5.6/include --with-mysql-lib=/opt/mysql/server-5.6/lib' RMySQL_0.9-3.tar.gz
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘RMySQL’ ...
** package ‘RMySQL’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for compress in -lz... yes
checking for getopt_long in -lc... yes
checking for mysql_init in -lmysqlclient... no
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking mysql.h usability... no
checking mysql.h presence... no
checking for mysql.h... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/opt/mysql/server-5.6/include -fpic -O2 -pipe -g -c RS-DBI.c -o RS-DBI.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/opt/mysql/server-5.6/include -fpic -O2 -pipe -g -c RS-MySQL.c -o RS-MySQL.o
gcc -std=gnu99 -shared -o RMySQL.so RS-DBI.o RS-MySQL.o -L/opt/mysql/server-5.6/lib -lmysqlclient -lz -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/RMySQL/libs
** R
** inst
** preparing package for lazy loading
Creating a generic function for ‘format’ from package ‘base’ in package ‘RMySQL’
Creating a generic function for ‘print’ from package ‘base’ in package ‘RMySQL’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error : .onLoad failed in loadNamespace() for 'RMySQL', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/usr/local/lib/R/site-library/RMySQL/libs/RMySQL.so':
libmysqlclient.so.18: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/site-library/RMySQL’
* restoring previous ‘/usr/local/lib/R/site-library/RMySQL’
Update:
This ended up being a LD_LIBRARY_PATH issue. Adding the following to /usr/bin/R solved it:
LD_LIBRARY_PATH=$LD_LIBRARY_PATH/opt/mysql/server-5.6/lib
export LD_LIBRARY_PATH
Did you run ldconfig after installing the library locally?
Does ldconfig -p return something regarding mysql?
On my box, with default MySQL libraries from Ubuntu [lines wrapped by hand]
edd#max:~$ ldconfig -p | grep mysql
libmysqlclient.so.18 (libc6,x86-64) => \
/usr/lib/x86_64-linux-gnu/libmysqlclient.so.18
libmysqlclient.so (libc6,x86-64) => \
/usr/lib/x86_64-linux-gnu/libmysqlclient.so
edd#max:~$