[R] rjava on FreeBSD

Rainer Hurling rhurlin at gwdg.de
Wed Jan 11 23:22:01 CET 2012


On 11.01.2012 22:51 (UTC+1), Hasan Diwan wrote:
> Trying to install Rjava on FreeBSD 9 and am getting the following error:
>> install.packages('rJava')
> trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/rJava_0.9-3.tar.gz'
> Content type 'application/x-gzip' length 537153 bytes (524 Kb)
> opened URL
> ==================================================
> downloaded 524 Kb
>
> * installing *source* package 'rJava' ...
> ** package 'rJava' successfully unpacked and MD5 sums checked
> checking for gcc... gcc46 -std=gnu99
> 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 gcc46 -std=gnu99 accepts -g... yes
> checking for gcc46 -std=gnu99 option to accept ISO C89... none needed
> checking how to run the C preprocessor... gcc46 -std=gnu99 -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 gcc46 -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/local/bin/java'
> archiver    : '/usr/local/bin/jar'
> compiler    : '/usr/local/bin/javac'
> header prep.: '/usr/local/bin/javah'
> cpp flags   : '-I/usr/local/jdk1.6.0/jre/../include
> -I/usr/local/jdk1.6.0/jre/../include/freebsd'
> java libs   : '-L/usr/local/jdk1.6.0/jre/lib/i386/server
> -L/usr/local/jdk1.6.0/jre/lib/i386
> -L/usr/local/jdk1.6.0/jre/../lib/i386 -L -L/usr/java/packages/lib/i386
> -L/lib -L/usr/lib -L/usr/local/lib -ljvm'
> checking whether JNI programs can be compiled... yes
> checking JNI data types... configure: error: One or more JNI types
> differ from the corresponding native type. You may need to use
> non-standard compiler flags or a different compiler in order to fix
> this.
> ERROR: configuration failed for package 'rJava'
> * removing '/usr/local/lib/R/library/rJava'
> * removing '/usr/local/lib/R/library/rJava'
>
> The downloaded packages are in
>          '/tmp/RtmpWtRfKe/downloaded_packages'
> Updating HTML index of packages in '.Library'
> Warning messages:
> 1: In install.packages("rJava") :
>    installation of package 'rJava' had non-zero exit status
> 2: In file.create(f.tg) :
>    cannot create file '/usr/local/share/doc/R/html/packages.html',
> reason 'Permission denied'
> 3: In make.packages.html(.Library) : cannot update HTML package index
>>
>
> Ok, so I tried doing so as root, because it would solve the
> 'Permissions denied' issue and was rewarded with:
>> install.packages('rJava')
> trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/rJava_0.9-3.tar.gz'
> Content type 'application/x-gzip' length 537153 bytes (524 Kb)
> opened URL
> ==================================================
> downloaded 524 Kb
>
> * installing *source* package 'rJava' ...
> ** package 'rJava' successfully unpacked and MD5 sums checked
> checking for gcc... gcc46 -std=gnu99
> 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 gcc46 -std=gnu99 accepts -g... yes
> checking for gcc46 -std=gnu99 option to accept ISO C89... none needed
> checking how to run the C preprocessor... gcc46 -std=gnu99 -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 gcc46 -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/local/bin/java'
> archiver    : '/usr/local/bin/jar'
> compiler    : '/usr/local/bin/javac'
> header prep.: '/usr/local/bin/javah'
> cpp flags   : '-I/usr/local/jdk1.6.0/jre/../include
> -I/usr/local/jdk1.6.0/jre/../include/freebsd'
> java libs   : '-L/usr/local/jdk1.6.0/jre/lib/i386/server
> -L/usr/local/jdk1.6.0/jre/lib/i386
> -L/usr/local/jdk1.6.0/jre/../lib/i386 -L -L/usr/java/packages/lib/i386
> -L/lib -L/usr/lib -L/usr/local/lib -ljvm'
> checking whether JNI programs can be compiled... yes
> checking JNI data types... ok
> checking whether JRI should be compiled (autodetect)... yes
> checking whether debugging output should be enabled... no
> checking whether memory profiling is desired... no
> checking whether threads support is requested... no
> checking whether callbacks support is requested... no
> checking whether JNI cache support is requested... no
> checking whether JRI is requested... yes
> configure: creating ./config.status
> config.status: creating src/Makevars
> config.status: creating R/zzz.R
> config.status: creating src/config.h
> === configuring in jri (/tmp/RtmpiB6MRQ/R.INSTALL7b063a/rJava/jri)
> configure: running /bin/sh ./configure '--prefix=/usr/local'
> --cache-file=/dev/null --srcdir=.
> checking build system type... i386-unknown-freebsd9.0
> checking host system type... i386-unknown-freebsd9.0
> checking for gcc... gcc46 -std=gnu99
> 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 gcc46 -std=gnu99 accepts -g... yes
> checking for gcc46 -std=gnu99 option to accept ISO C89... none needed
> checking how to run the C preprocessor... cpp
> 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 whether Java interpreter works... checking whether JNI
> programs can be compiled... yes
> checking whether JNI programs can be run... yes
> checking JNI data types... ok
> checking whether Rinterface.h exports R_CStackXXX variables... yes
> checking whether Rinterface.h exports R_SignalHandlers... yes
> configure: creating ./config.status
> config.status: creating src/Makefile
> config.status: creating Makefile
> config.status: creating run
> config.status: creating src/config.h
> ** libs
> gcc46 -std=gnu99 -I/usr/local/lib/R/include -I.
> -I/usr/local/jdk1.6.0/jre/../include
> -I/usr/local/jdk1.6.0/jre/../include/freebsd     -fpic  -O2 -pipe
> -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing -c Rglue.c -o
> Rglue.o
> gcc46 -std=gnu99 -I/usr/local/lib/R/include -I.
> -I/usr/local/jdk1.6.0/jre/../include
> -I/usr/local/jdk1.6.0/jre/../include/freebsd     -fpic  -O2 -pipe
> -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing -c arrayc.c -o
> arrayc.o
> gcc46 -std=gnu99 -I/usr/local/lib/R/include -I.
> -I/usr/local/jdk1.6.0/jre/../include
> -I/usr/local/jdk1.6.0/jre/../include/freebsd     -fpic  -O2 -pipe
> -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing -c callJNI.c -o
> callJNI.o
> gcc46 -std=gnu99 -I/usr/local/lib/R/include -I.
> -I/usr/local/jdk1.6.0/jre/../include
> -I/usr/local/jdk1.6.0/jre/../include/freebsd     -fpic  -O2 -pipe
> -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing -c callback.c -o
> callback.o
> gcc46 -std=gnu99 -I/usr/local/lib/R/include -I.
> -I/usr/local/jdk1.6.0/jre/../include
> -I/usr/local/jdk1.6.0/jre/../include/freebsd     -fpic  -O2 -pipe
> -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing -c fields.c -o
> fields.o
> gcc46 -std=gnu99 -I/usr/local/lib/R/include -I.
> -I/usr/local/jdk1.6.0/jre/../include
> -I/usr/local/jdk1.6.0/jre/../include/freebsd     -fpic  -O2 -pipe
> -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing -c init.c -o
> init.o
> gcc46 -std=gnu99 -I/usr/local/lib/R/include -I.
> -I/usr/local/jdk1.6.0/jre/../include
> -I/usr/local/jdk1.6.0/jre/../include/freebsd     -fpic  -O2 -pipe
> -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing -c jri_glue.c -o
> jri_glue.o
> jri_glue.c: In function 'PushToREXP':
> jri_glue.c:24:15: warning: cast from pointer to integer of different
> size [-Wpointer-to-int-cast]
> jri_glue.c: In function 'RReleaseREXP':
> jri_glue.c:52:11: warning: cast to pointer from integer of different
> size [-Wint-to-pointer-cast]
> gcc46 -std=gnu99 -I/usr/local/lib/R/include -I.
> -I/usr/local/jdk1.6.0/jre/../include
> -I/usr/local/jdk1.6.0/jre/../include/freebsd     -fpic  -O2 -pipe
> -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing -c loader.c -o
> loader.o
> gcc46 -std=gnu99 -I/usr/local/lib/R/include -I.
> -I/usr/local/jdk1.6.0/jre/../include
> -I/usr/local/jdk1.6.0/jre/../include/freebsd     -fpic  -O2 -pipe
> -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing -c otables.c -o
> otables.o
> gcc46 -std=gnu99 -I/usr/local/lib/R/include -I.
> -I/usr/local/jdk1.6.0/jre/../include
> -I/usr/local/jdk1.6.0/jre/../include/freebsd     -fpic  -O2 -pipe
> -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing -c rJava.c -o
> rJava.o
> gcc46 -std=gnu99 -I/usr/local/lib/R/include -I.
> -I/usr/local/jdk1.6.0/jre/../include
> -I/usr/local/jdk1.6.0/jre/../include/freebsd     -fpic  -O2 -pipe
> -Wl,-rpath=/usr/local/lib/gcc46 -fno-strict-aliasing -c tools.c -o
> tools.o
> gcc46 -std=gnu99 -fpic -shared -Wl,-rpath=/usr/local/lib/gcc46 -o
> rJava.so Rglue.o arrayc.o callJNI.o callback.o fields.o init.o
> jri_glue.o loader.o otables.o rJava.o tools.o
> -L/usr/local/jdk1.6.0/jre/lib/i386/server
> -L/usr/local/jdk1.6.0/jre/lib/i386
> -L/usr/local/jdk1.6.0/jre/../lib/i386 -L -L/usr/java/packages/lib/i386
> -L/lib -L/usr/lib -L/usr/local/lib -ljvm -L/usr/local/lib/R/lib -lR
> (cd ../jri&&  make)
> make -C src JRI.jar
> /usr/local/bin/javac -target 1.4 -source 1.4 -d .
> realpath: : No such file or directory
> javac: no source files
> Usage: javac<options>  <source files>
> use -help for a list of possible options
> *** Error code 2
>
> Stop in /tmp/RtmpiB6MRQ/R.INSTALL7b063a/rJava/jri/src.
> *** Error code 1
>
> Stop in /tmp/RtmpiB6MRQ/R.INSTALL7b063a/rJava/jri.
> *** Error code 1
>
> Stop in /tmp/RtmpiB6MRQ/R.INSTALL7b063a/rJava/src.
> ERROR: compilation failed for package 'rJava'
> * removing '/usr/local/lib/R/library/rJava'
>
> The downloaded packages are in
>          '/tmp/Rtmp5Eg6iF/downloaded_packages'
> Updating HTML index of packages in '.Library'
> Making packages.html  ... done
> Warning message:
> In install.packages("rJava") :
>    installation of package 'rJava' had non-zero exit status
>>
>
> ... and I'm now at a loss... Any ideas? Many thanks!
>

Hi Hasan,

because FreeBSD uses BSD make instead of GNU make (gmake) like Linux you 
have to build packages like rJava at the shell (command prompt).

I personally prefer to write a small script for packages like this. So I 
am able to repeat the build and install, if needed. For rJava this could 
be for example:

--script begins--
#!/bin/sh
export MAKE=gmake
R CMD INSTALL rJava_0.9-3.tar.gz
--script ends--


Please be aware of the math/R OPTION 'LIBR', which builds and installs a 
shared library version of R. If not, JRI has to be disabled and for that 
your rJava script has to be customized like this:

R CMD INSTALL --configure-args='--enable-jri=no' rJava_0.9-3.tar.gz

Hope this helps,
Rainer



More information about the R-help mailing list