R on Ubuntu 16.04: rgl won't install proper - r

Trying to install rgl onto R 3.4.4, Ubuntu 16.04, but it's not playing nice:
Warning in install.packages :
installation of package ‘rgl’ had non-zero exit status
I've tried every fix that every post has suggested. Nothing improved.
Am I overlooking something? Any ideas?
Version info:
> version
platform x86_64-pc-linux-gnu
arch x86_64
os linux-gnu
system x86_64, linux-gnu
status
major 3
minor 4.4
year 2018
month 03
day 15
svn rev 74408
language R
version.string R version 3.4.4 (2018-03-15)
nickname Someone to Lean On
Here is the full output:
> install.packages("rgl")
Installing package into ‘/home/brandon/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/rgl_0.99.16.tar.gz'
Content type 'application/x-gzip' length 3058794 bytes (2.9 MB)
==================================================
downloaded 2.9 MB
* installing *source* package ‘rgl’ ...
** package ‘rgl’ successfully unpacked and MD5 sums checked
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 gcc... (cached) gcc -std=gnu99
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc -std=gnu99 accepts -g... (cached) yes
checking for gcc -std=gnu99 option to accept ISO C89... (cached) none needed
checking for libpng-config... yes
configure: using libpng-config
configure: using libpng dynamic linkage
checking for X... libraries , headers
checking GL/gl.h usability... yes
checking GL/gl.h presence... yes
checking for GL/gl.h... yes
checking GL/glu.h usability... yes
checking GL/glu.h presence... yes
checking for GL/glu.h... yes
checking for glEnd in -lGL... yes
checking for gluProject in -lGLU... yes
checking for pkg-config... yes
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
configure: using Freetype and FTGL
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -I/usr/share/R/include -DNDEBUG -DHAVE_PNG_H -I/usr/include/libpng12 -DHAVE_FREETYPE -Iext/ftgl -Iext -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c ABCLineSet.cpp -o ABCLineSet.o
g++ -I/usr/share/R/include -DNDEBUG -DHAVE_PNG_H -I/usr/include/libpng12 -DHAVE_FREETYPE -Iext/ftgl -Iext -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c BBoxDeco.cpp -o BBoxDeco.o
In file included from glgui.h:12:0,
from BBoxDeco.cpp:4:
ext/ftgl/FTGL/ftgl.h:32:22: fatal error: ft2build.h: No such file or directory
compilation terminated.
/usr/lib/R/etc/Makeconf:168: recipe for target 'BBoxDeco.o' failed
make: *** [BBoxDeco.o] Error 1
ERROR: compilation failed for package ‘rgl’
* removing ‘/home/brandon/R/x86_64-pc-linux-gnu-library/3.4/rgl’
Warning in install.packages :
installation of package ‘rgl’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpWrldzM/downloaded_packages’
> # Spinning 3D scatterplot
> # Install and load rgl package
> install.packages("rgl")
Installing package into ‘/home/brandon/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/rgl_0.99.16.tar.gz'
Content type 'application/x-gzip' length 3058794 bytes (2.9 MB)
==================================================
downloaded 2.9 MB
* installing *source* package ‘rgl’ ...
** package ‘rgl’ successfully unpacked and MD5 sums checked
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 gcc... (cached) gcc -std=gnu99
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc -std=gnu99 accepts -g... (cached) yes
checking for gcc -std=gnu99 option to accept ISO C89... (cached) none needed
checking for libpng-config... yes
configure: using libpng-config
configure: using libpng dynamic linkage
checking for X... libraries , headers
checking GL/gl.h usability... yes
checking GL/gl.h presence... yes
checking for GL/gl.h... yes
checking GL/glu.h usability... yes
checking GL/glu.h presence... yes
checking for GL/glu.h... yes
checking for glEnd in -lGL... yes
checking for gluProject in -lGLU... yes
checking for pkg-config... yes
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
configure: using Freetype and FTGL
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -I/usr/share/R/include -DNDEBUG -DHAVE_PNG_H -I/usr/include/libpng12 -DHAVE_FREETYPE -Iext/ftgl -Iext -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c ABCLineSet.cpp -o ABCLineSet.o
g++ -I/usr/share/R/include -DNDEBUG -DHAVE_PNG_H -I/usr/include/libpng12 -DHAVE_FREETYPE -Iext/ftgl -Iext -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c BBoxDeco.cpp -o BBoxDeco.o
In file included from glgui.h:12:0,
from BBoxDeco.cpp:4:
ext/ftgl/FTGL/ftgl.h:32:22: fatal error: ft2build.h: No such file or directory
compilation terminated.
/usr/lib/R/etc/Makeconf:168: recipe for target 'BBoxDeco.o' failed
make: *** [BBoxDeco.o] Error 1
ERROR: compilation failed for package ‘rgl’
* removing ‘/home/brandon/R/x86_64-pc-linux-gnu-library/3.4/rgl’
Warning in install.packages :
installation of package ‘rgl’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpWrldzM/downloaded_packages’
EDIT: After installing libftgl2 I get
install.packages("rgl")
Installing package into ‘/home/brandon/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/rgl_0.99.16.tar.gz'
Content type 'application/x-gzip' length 3058794 bytes (2.9 MB)
==================================================
downloaded 2.9 MB
* installing *source* package ‘rgl’ ...
** package ‘rgl’ successfully unpacked and MD5 sums checked
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 gcc... (cached) gcc -std=gnu99
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc -std=gnu99 accepts -g... (cached) yes
checking for gcc -std=gnu99 option to accept ISO C89... (cached) none needed
checking for libpng-config... yes
configure: using libpng-config
configure: using libpng dynamic linkage
checking for X... libraries , headers
checking GL/gl.h usability... yes
checking GL/gl.h presence... yes
checking for GL/gl.h... yes
checking GL/glu.h usability... yes
checking GL/glu.h presence... yes
checking for GL/glu.h... yes
checking for glEnd in -lGL... yes
checking for gluProject in -lGLU... yes
checking for pkg-config... yes
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
configure: using Freetype and FTGL
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -I/usr/share/R/include -DNDEBUG -DHAVE_PNG_H -I/usr/include/libpng12 -DHAVE_FREETYPE -Iext/ftgl -Iext -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c ABCLineSet.cpp -o ABCLineSet.o
g++ -I/usr/share/R/include -DNDEBUG -DHAVE_PNG_H -I/usr/include/libpng12 -DHAVE_FREETYPE -Iext/ftgl -Iext -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c BBoxDeco.cpp -o BBoxDeco.o
In file included from glgui.h:12:0,
from BBoxDeco.cpp:4:
ext/ftgl/FTGL/ftgl.h:32:22: fatal error: ft2build.h: No such file or directory
compilation terminated.
/usr/lib/R/etc/Makeconf:168: recipe for target 'BBoxDeco.o' failed
make: *** [BBoxDeco.o] Error 1
ERROR: compilation failed for package ‘rgl’
* removing ‘/home/brandon/R/x86_64-pc-linux-gnu-library/3.4/rgl’
Warning in install.packages :
installation of package ‘rgl’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmpv0TEaW/downloaded_packages’
Edit2: After installing the PPA and packages suggested by Rachit Kinger, I'm still not getting a working rgl.
Output:
> install.packages("rgl")
Installing package into ‘/home/brandon/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/rgl_0.99.16.tar.gz'
Content type 'application/x-gzip' length 3058794 bytes (2.9 MB)
==================================================
downloaded 2.9 MB
* installing *source* package ‘rgl’ ...
** package ‘rgl’ successfully unpacked and MD5 sums checked
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 gcc... (cached) gcc -std=gnu99
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc -std=gnu99 accepts -g... (cached) yes
checking for gcc -std=gnu99 option to accept ISO C89... (cached) none needed
checking for libpng-config... yes
configure: using libpng-config
configure: using libpng dynamic linkage
checking for X... libraries , headers
checking GL/gl.h usability... yes
checking GL/gl.h presence... yes
checking for GL/gl.h... yes
checking GL/glu.h usability... yes
checking GL/glu.h presence... yes
checking for GL/glu.h... yes
checking for glEnd in -lGL... yes
checking for gluProject in -lGLU... yes
checking for pkg-config... yes
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
configure: using Freetype and FTGL
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -I/usr/share/R/include -DNDEBUG -DHAVE_PNG_H -I/usr/include/libpng12 -DHAVE_FREETYPE -Iext/ftgl -Iext -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c ABCLineSet.cpp -o ABCLineSet.o
g++ -I/usr/share/R/include -DNDEBUG -DHAVE_PNG_H -I/usr/include/libpng12 -DHAVE_FREETYPE -Iext/ftgl -Iext -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c BBoxDeco.cpp -o BBoxDeco.o
In file included from glgui.h:12:0,
from BBoxDeco.cpp:4:
ext/ftgl/FTGL/ftgl.h:32:22: fatal error: ft2build.h: No such file or directory
compilation terminated.
/usr/lib/R/etc/Makeconf:168: recipe for target 'BBoxDeco.o' failed
make: *** [BBoxDeco.o] Error 1
ERROR: compilation failed for package ‘rgl’
* removing ‘/home/brandon/R/x86_64-pc-linux-gnu-library/3.4/rgl’
Warning in install.packages :
installation of package ‘rgl’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpGobsUA/downloaded_packages’

Solution:
RGL package for R compile error
Freetype is optional. Disabling it is the least hassles solution.
install.packages("rgl", repo="http://cran.r-project.org", configure.args="--disable-ftgl")

On Linux Mint MATE 19.1 (and previously in 19 and 18.3!)
I did
sudo apt-get install libftgl2
then tried
sudo apt-get install libfreetype6
which was already installed and didn't fix it.
This suggested line:
sudo add-apt-repository ppa:glasen/freetype2
gave the following error:
Cannot add PPA: 'Expecting value: line 1 column 1 (char 0)'.
The thing which did fix it was:
Download and unzip the latest FreeType2 from https://sourceforge.net/projects/freetype/files/ to your Downloads folder. Then from this folder:
sudo make
sudo make install
Re-open R and install.packages("rgl") should work.

The problem is not with R. It looks like some essential packages are missing from Ubuntu for this installation.
Try installing libftgl2 package from the terminal. You can use this code:
sudo apt-get install libftgl2
You can also try install Freetype2 directly, if you are okay to add another PPA. Try this code:
sudo add-apt-repository ppa:glasen/freetype2
Then this:
sudo apt update && sudo apt install freetype2-demos
Then restart your R session and try install rgl again.
If this doesn't solve the problem you can uninstall the PPA you just installed by this command:
sudo apt install ppa-purge && sudo ppa-purge ppa:glasen/freetype2

Related

how to install nloptr on Linux

I have a box with antiX, which is a Debian clone. I compiled and installed nlopt and still:
> install.packages("nloptr")
Installing package into ‘/home/stephen/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://utstat.toronto.edu/cran/src/contrib/nloptr_1.2.2.2.tar.gz'
Content type 'application/x-gzip' length 2450931 bytes (2.3 MB)
==================================================
downloaded 2.3 MB
* installing *source* package ‘nloptr’ ...
** package ‘nloptr’ successfully unpacked and MD5 sums checked
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... /usr/bin/grep
checking for egrep... /usr/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... yes
checking nlopt.h presence... yes
checking for nlopt.h... yes
configure: Now testing for NLopt version 2.4.0 or greater.
configure: Suitable NLopt library found.
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating R/PkgFlags.R
** libs
g++ -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c dummy.cpp -o dummy.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init_nloptr.c -o init_nloptr.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/local/include -fpic -g -O2 -fdebug-prefix-map=/build/r-base-3.5.2=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c nloptr.c -o nloptr.o
g++ -shared -L/usr/lib/R/lib -Wl,-z,relro -o nloptr.so dummy.o init_nloptr.o nloptr.o -L/usr/local/lib -lnlopt -L/usr/lib/R/lib -lR
installing to /home/stephen/R/x86_64-pc-linux-gnu-library/3.5/nloptr/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘nloptr’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/stephen/R/x86_64-pc-linux-gnu-library/3.5/nloptr/libs/nloptr.so':
libnlopt.so.0: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/stephen/R/x86_64-pc-linux-gnu-library/3.5/nloptr’
The downloaded source packages are in
‘/tmp/RtmpEtHKlT/downloaded_packages’
Warning message:
In install.packages("nloptr") :
installation of package ‘nloptr’ had non-zero exit status
I went into the nloptr folder and ran ./configure and the compile statements that I see in the output and I have nloptr.so in the src folder. Is there a way to continue the install manually and copy what needs to be copied? or can I check that .so if it works?
$ ldd nloptr.so
linux-vdso.so.1 (0x00007ffdb6dc1000)
libnlopt.so.0 => not found
libR.so => /lib/libR.so (0x00007f0e9e6b4000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f0e9e530000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0e9e3ad000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f0e9e393000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0e9e1d2000)
libblas.so.3 => /lib/x86_64-linux-gnu/libblas.so.3 (0x00007f0e9e163000)
libgfortran.so.5 => /lib/x86_64-linux-gnu/libgfortran.so.5 (0x00007f0e9def5000)
libquadmath.so.0 => /lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007f0e9deb3000)
libreadline.so.7 => /lib/x86_64-linux-gnu/libreadline.so.7 (0x00007f0e9dc66000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f0e9dbf2000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f0e9dbca000)
libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f0e9dbb5000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f0e9d997000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f0e9d98d000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0e9d988000)
libicuuc.so.63 => /lib/x86_64-linux-gnu/libicuuc.so.63 (0x00007f0e9d7b9000)
libicui18n.so.63 => /lib/x86_64-linux-gnu/libicui18n.so.63 (0x00007f0e9d4de000)
libgomp.so.1 => /lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f0e9d4ab000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0e9d48a000)
/lib64/ld-linux-x86-64.so.2 (0x00007f0e9eb5b000)
libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f0e9d45c000)
libicudata.so.63 => /lib/x86_64-linux-gnu/libicudata.so.63 (0x00007f0e9ba6c000)
$ ls /usr/local/lib/libnl*
/usr/local/lib/libnlopt.so /usr/local/lib/libnlopt.so.0 /usr/local/lib/libnlopt.so.0.10.0
Cheers
Stephen
As discussed in comments above the issue here was a 'unconventional' (and hence not-working) 'installation' of the nlopt library: one cannot just untar it somewhere as the dynamic linker needs to know about it, update its cache etc.
So in short the recommended answer is to, where available as a suitable version, install the -dev package from the distro. Here the command is
sudo apt install libnlopt-dev
after which configure in the R package sees, and also gets to use it as the corresponding shared library itself gets installed from the libnlopt0 package. (And we answered a few times why the -dev package is always needed for building as opposed to merely running via the shared library package).
The previous solution did not worked on my machine (Ubuntu 18.04, R 4.2.0). In installed nlopt library from github using
git clone https://github.com/stevengj/nlopt.git
cd nlopt
mkdir build
cd build
cmake ..
make
sudo make install
Then install.packages("nloptr") worked with no issues

Non Zero excess status when installing RQuantLib

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

Unable to install RPostgreSQL package in R Studio on CentOS 7

I installed PostgreSQL 9.6 with PostGIS 2.3 using one click installer of Enterprise DB available here on my CentOS 7 (x64) Linux based machine. Now I am trying to connect R Studio to Postgres. To do so, I tried to install RPostgreSQL package in R Studio but I am getting following error:
> install.packages("RPostgreSQL")
Installing package into ‘/home/jk/R/x86_64-redhat-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/RPostgreSQL_0.4-1.tar.gz'
Content type 'unknown' length 476204 bytes (465 KB)
==================================================
downloaded 465 KB
* installing *source* package ‘RPostgreSQL’ ...
** package ‘RPostgreSQL’ 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 ISO C89... none needed
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for pg_config... no
configure: checking for PostgreSQL header files
configure: Checking include /usr/include.
configure: Checking include /usr/include/pgsql.
configure: Checking include /usr/include/postgresql.
configure: Checking include /usr/local/include.
configure: Checking include /usr/local/include/pgsql.
configure: Checking include /usr/local/include/postgresql.
configure: Checking include /usr/local/pgsql/include.
configure: Checking include /usr/local/postgresql/include.
configure: Checking include /opt/include.
configure: Checking include /opt/include/pgsql.
configure: Checking include /opt/include/postgresql.
configure: Checking include /opt/local/include.
configure: Checking include /opt/local/include/postgresql.
configure: Checking include /opt/local/include/postgresql84.
configure: Checking include /sw/opt/postgresql-8.4/include.
configure: Checking include /Library/PostgresPlus/8.4SS/include.
configure: Checking include /sw/include/postgresql.
configure: Checking lib /usr/lib.
configure: Checking lib /usr/lib/pgsql.
configure: Checking lib /usr/lib/postgresql.
configure: Checking lib /usr/local/lib.
configure: Checking lib /usr/local/lib/pgsql.
configure: Checking lib /usr/local/lib/postgresql.
configure: Checking lib /usr/local/pgsql/lib.
configure: Checking lib /usr/local/postgresql/lib.
configure: Checking lib /opt/lib.
configure: Checking lib /opt/lib/pgsql.
configure: Checking lib /opt/lib/postgresql.
configure: Checking lib /opt/local/lib.
configure: Checking lib /opt/local/lib/postgresql.
configure: Checking lib /opt/local/lib/postgresql84.
configure: Checking lib /sw/opt/postgresql-8.4/lib.
configure: Checking lib /Library/PostgresPlus/8.4SS/lib.
configure: Checking lib /sw/lib.
checking for "/libpq-fe.h"... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-DBI.c -o RS-DBI.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-PQescape.c -o RS-PQescape.o
In file included from RS-PQescape.c:7:0:
RS-PostgreSQL.h:23:26: fatal error: libpq-fe.h: No such file or directory
# include "libpq-fe.h"
^
compilation terminated.
make: *** [RS-PQescape.o] Error 1
ERROR: compilation failed for package ‘RPostgreSQL’
* removing ‘/home/jk/R/x86_64-redhat-linux-gnu-library/3.3/RPostgreSQL’
Warning in install.packages :
installation of package ‘RPostgreSQL’ had non-zero exit status
The installation directory of PostgreSQL 9.6 is /opt/PostgreSQL/9.6/bin which doesn't seem to be in the error above. Could someone help me to resolve this error?
EDIT 1:
Thanks to the suggestion of #lavajumper, I got rid of above error. But now getting this error which shows some missing html links.
> install.packages("RPostgreSQL")
Installing package into ‘/home/jk/R/x86_64-redhat-linux-gnu-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/RPostgreSQL_0.4-1.tar.gz'
Content type 'unknown' length 476204 bytes (465 KB)
==================================================
downloaded 465 KB
* installing *source* package ‘RPostgreSQL’ ...
** package ‘RPostgreSQL’ 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 ISO C89... none needed
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for pg_config... no
configure: checking for PostgreSQL header files
configure: Checking include /usr/include.
configure: Checking lib /usr/lib.
configure: Checking lib /usr/lib/pgsql.
configure: Checking lib /usr/lib/postgresql.
configure: Checking lib /usr/local/lib.
configure: Checking lib /usr/local/lib/pgsql.
configure: Checking lib /usr/local/lib/postgresql.
configure: Checking lib /usr/local/pgsql/lib.
configure: Checking lib /usr/local/postgresql/lib.
configure: Checking lib /opt/lib.
configure: Checking lib /opt/lib/pgsql.
configure: Checking lib /opt/lib/postgresql.
configure: Checking lib /opt/local/lib.
configure: Checking lib /opt/local/lib/postgresql.
configure: Checking lib /opt/local/lib/postgresql84.
configure: Checking lib /sw/opt/postgresql-8.4/lib.
configure: Checking lib /Library/PostgresPlus/8.4SS/lib.
configure: Checking lib /sw/lib.
checking for "/usr/include/libpq-fe.h"... yes
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-DBI.c -o RS-DBI.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-PQescape.c -o RS-PQescape.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-PostgreSQL.c -o RS-PostgreSQL.o
RS-PostgreSQL.c: In function ‘RS_PostgreSQL_createDataMappings’:
RS-PostgreSQL.c:446:5: warning: passing argument 1 of ‘Rf_protect’ from incompatible pointer type [enabled by default]
PROTECT(flds = RS_DBI_allocFields(num_fields));
^
In file included from /usr/include/R/Rdefines.h:36:0,
from S4R.h:64,
from RS-DBI.h:29,
from RS-PostgreSQL.h:25,
from RS-PostgreSQL.c:17:
/usr/include/R/Rinternals.h:1348:6: note: expected ‘SEXP’ but
argument is of type ‘struct RS_DBI_fields *’
SEXP Rf_protect(SEXP);
^
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-pgsql-copy.c -o RS-pgsql-copy.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-pgsql-getResult.c -o RS-pgsql-getResult.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-pgsql-pqexec.c -o RS-pgsql-pqexec.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c RS-pgsql-pqexecparams.c -o RS-pgsql-pqexecparams.o
gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -Wl,-z,relro -o RPostgreSQL.so RS-DBI.o RS-PQescape.o RS-PostgreSQL.o RS-pgsql-copy.o RS-pgsql-getResult.o RS-pgsql-pqexec.o RS-pgsql-pqexecparams.o -L -lpq -L/usr/lib64/R/lib -lR
installing to /home/jk/R/x86_64-redhat-linux-gnu-library/3.3/RPostgreSQL/libs
** R
** inst
** preparing package for lazy loading
Creating a generic function for ‘format’ from package ‘base’ in package ‘RPostgreSQL’
Creating a generic function for ‘print’ from package ‘base’ in package ‘RPostgreSQL’
Creating a generic function for ‘summary’ from package ‘base’ in package ‘RPostgreSQL’
** help
*** installing help indices
converting help for package ‘RPostgreSQL’
finding HTML links ... done
PostgreSQL html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL /man/PostgreSQL.Rd:26: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQL.Rd:76: missing file link ‘dbUnloadDriver’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQL.Rd:84: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQL.Rd:89: missing file link ‘dbCommit’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQL.Rd:90: missing file link ‘dbRollback’
PostgreSQLConnection-class html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQLConnection-class.Rd:20: missing file link ‘dbCommit’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQLConnection-class.Rd:32: missing file link ‘dbRollback’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQLConnection-class.Rd:34: missing file link ‘dbWriteTable’
PostgreSQLDriver-class html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQLDriver-class.Rd:25: missing file link ‘dbUnloadDriver’
PostgreSQLObject-class html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQLObject-class.Rd:20: missing file link ‘isSQLKeyword’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQLObject-class.Rd:22: missing file link ‘SQLKeywords’
PostgreSQLResult-class html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQLResult-class.Rd:31: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/PostgreSQLResult-class.Rd:32: missing file link ‘fetch’
S4R html
dbApply-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbApply-methods.Rd:27: missing file link ‘fetch’
dbApply html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbApply.Rd:37: missing file link ‘fetch’
dbCallProc-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbCallProc-methods.Rd:31: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbCallProc-methods.Rd:32: missing file link ‘dbCommit’
dbCommit-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbCommit-methods.Rd:36: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbCommit-methods.Rd:37: missing file link ‘dbCommit’
dbConnect-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbConnect-methods.Rd:58: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbConnect-methods.Rd:59: missing file link ‘dbCommit’
dbDataType-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbDataType-methods.Rd:33: missing file link ‘isSQLKeyword’
dbDriver-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbDriver-methods.Rd:26: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbDriver-methods.Rd:44: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbDriver-methods.Rd:45: missing file link ‘dbCommit’
dbGetInfo-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbGetInfo-methods.Rd:47: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbGetInfo-methods.Rd:48: missing file link ‘dbCommit’
dbListTables-methods html
dbObjectId-class html
dbReadTable-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbReadTable-methods.Rd:119: missing file link ‘isSQLKeyword’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbReadTable-methods.Rd:124: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbReadTable-methods.Rd:125: missing file link ‘dbCommit’
dbSendQuery-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbSendQuery-methods.Rd:40: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbSendQuery-methods.Rd:41: missing file link ‘dbCommit’
dbSetDataMappings-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/dbSetDataMappings-methods.Rd:33: missing file link ‘fetch’
fetch-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/fetch-methods.Rd:46: missing file link ‘dbCommit’
isPostgresqlIdCurrent html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/isPostgresqlIdCurrent.Rd:34: missing file link ‘fetch’
make.db.names-methods html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/make.db.names-methods.Rd:69: missing file link ‘dbWriteTable’
postgresqlBuildTableDefinition html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/postgresqlBuildTableDefinition.Rd:41: missing file link ‘fetch’
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/postgresqlBuildTableDefinition.Rd:42: missing file link ‘dbCommit’
postgresqlDBApply html
Rd warning: /tmp/Rtmp15353Q/R.INSTALL161911b14876/RPostgreSQL/man/postgresqlDBApply.Rd:75: missing file link ‘fetch’
postgresqlSupport html
summary-methods html
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/home/jk/R/x86_64-redhat-linux-gnu-library /3.3/RPostgreSQL/libs/RPostgreSQL.so':
/home/jk/R/x86_64-redhat-linux-gnu-library/3.3/RPostgreSQL/libs/RPostgreSQL.so: undefined symbol: PQfmod
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/jk/R/x86_64-redhat-linux-gnu-library/3.3/RPostgreSQL’
Warning in install.packages :
installation of package ‘RPostgreSQL’ had non-zero exit status
Okay, I figured out the problem by myself. Answer given by #Manoj at this link helped me to resolve the second error. According to the mentioned link, RPostgreSQL checks for libraries in these directories only:
/usr/lib
/usr/lib/pgsql
/usr/lib/postgresql
/usr/local/lib
/usr/local/lib/pgsql
/usr/local/lib/postgresql
/usr/local/pgsql/lib
/usr/local/postgresql/lib
/opt/lib
/opt/lib/pgsql
/opt/lib/postgresql
/opt/local/lib
/opt/local/lib/postgresql
/opt/local/lib/postgresql84
/sw/opt/postgresql-8.4/lib
/Library/PostgresPlus/8.4SS/lib
/sw/lib
So as a superuser I copied library files from Postgres installation directory to /usr/lib and run the command again like this in R Studio:
install.packages('RPostgreSQL', dependencies=TRUE, repos='http://cran.rstudio.com/')
and it worked! :)
I had a similar issue (but with RPostgres, you may consider switching to that package) building a container through docker for API use : RPostgres was installed but the library couldn't load libpq.so.5, "unable to load shared object '/usr/local/lib/R/site-library/RPostgres/libs/RPostgres.so':\n libpq.so.5: cannot open shared object file: No such file or directory". Since I had already installed Postgres on my machine, I figure the problem was worked around therefore I had no such message on local ; but here's how I solved this in my dockerfile (thanks to this post), 100% verified on a machine with nothing related to R installed (Centos, server) :
RUN apt-get update && apt-get install libpq5 -y before installing any package.
So executing apt-get update && apt-get install libpq5 -y on your terminal should do the trick. Light and efficient.
This error also happens on Mac sometimes, and on that platform, one option is to NOT install this from source and instead pull a binary.
You can do this via specifying a type in the install.packages command.
install.packages("RPostgreSQL", type="mac.binary")
here you can find a list of other type vals
Possible values of type are (currently) "source", "mac.binary", "mac.binary.el-capitan" and "win.binary": the appropriate binary type where supported can also be selected as "binary".

Installing nloptr on Linux - fatal error: nlopt.h: No such file or directory

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.

Error while installing RMySQL (MySQL 5.6.14 in Ubuntu 13.04)

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:~$

Resources