Skip to content

Problems loading Java libraries in R 2.2.1 OS X 10.4.5, Java 1.5.0 rev 3

3 messages · Marc Saric, Simon Urbanek

#
Hi list,

I have a PowerMac G5 running OS X 10.4.5 and Java 1.5.0 rev_3 together
with the precompiled R Version 2.2.1  (2005-12-20 r36812) from CRAN.

I tried to install a Bioconductor package called RMAGEML which depends
on an external Java-tool for data parsing and loading.

Compilation went fine after some configuration issues but the program
crashes with a "Bus error" while parsing testdata with the Java-module,
see below.

Debugging gave the following error message:

snip-------------------------------------------

dragonfish-g5:~/data/R/testing_RMAGEML saric$ R -d gdb
GNU gdb 6.1-20040303 (Apple version gdb-384) (Mon Mar 21 00:05:26 GMT 2005)
[...]
(gdb) run
Starting program:
/Library/Frameworks/R.framework/Versions/2.2/Resources/bin/exec/R
Reading symbols for shared libraries ..........+ done

R : Copyright 2005, The R Foundation for Statistical Computing
Version 2.2.1  (2005-12-20 r36812)
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

Reading symbols for shared libraries
.............................................................. done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Loading required package: marray
Loading required package: limma
Loading required package: limma
Loading required package: Biobase
Loading required package: tools
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done

Welcome to Bioconductor

        Vignettes contain introductory material.
        To view, simply type 'openVignette()' or start with
'help(Biobase)'.
        For details on reading vignettes, see the openVignette help page.

Reading symbols for shared libraries .. done
+ arrayID = "A-MEXP-14", DED = "DED:707", QTD = "QTD:707",
+ name.Rf = "QT:F635 Mean", name.Rb = "QT:B635 Median", name.Gf =
"QT:F532 Mean",
+ name.Gb = "QT:B532 Median")
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
- Java Virtual Machine is running -
parsing MAGEML files

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
0x94bfafa0 in JNI_GetDefaultJavaVMInitArgs_Impl ()
(gdb) info program
macosx_debug_inferior_status: current status:
              inferior task: 0x313
                [SIGNAL THREAD]
macosx_debug_inferior_status: information on debugger task:
macosx_debug_inferior_status: information on inferior task:
macosx_debug_inferior_status: information on debugger threads:
  thread: 0x117
  thread: 0x1003
  thread: 0x1303
macosx_debug_inferior_status: information on inferior threads:
  thread: 0xf03
  thread: 0x1603
  thread: 0x1743
  thread: 0x1803
  thread: 0x1903
  thread: 0x1a03
  thread: 0x1b03
  thread: 0x1c03
Program stopped at 0x94bfafa0.
It stopped with signal EXC_BAD_ACCESS, Could not access memory.
(gdb) info symbol 0x94bfafa0
JNI_GetDefaultJavaVMInitArgs_Impl + 5084 in section
LC_SEGMENT.__TEXT.__text of
/System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Libraries/libhotspot.dylib
(gdb)

snip-------------------------------------------

To me this looks like it uses the wrong library (1.3.1 instead of
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Libraries/libhotspot.dylib)
but I have no clue how to change that.

I have set the preferences for Java apps to 1.4.2>1.5.0, so it should
not use 1.3.1 at all I think.

Software had to be compiled with gcc 3 via

dragonfish-g5:~ saric$ sudo gcc_select 3.3
Password:
Default compiler has been set to:
gcc version 3.3 20030304 (Apple Computer, Inc. build 1809)

Any idea?

Thanks in advance.
#
Marc,

I have no idea about RMAGEML, but in general the Java version is  
determined by the compiler flags used. If the configure script is  
reasonable, it should be using -framework JavaVM to link to JNI in  
which case the used version is determined solely by the
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
softlink.
Quick check shows that RMAGEML is one of the few BioC packages that  
fails to build on OS X, because its configure script is nether  
checking nor detecting Java. I'd recommend you to talk to the  
maintainer. Java detection is now part of several packages (e.g.  
rJava on CRAN) and also R itself, so it should not be hard to fix it.  
Of course, chances are that compiler flags are just one part of the  
problem, and the segfault is caused by something else, but better  
start fixing things from the bottom ;).

Cheers,
Simon
On Apr 5, 2006, at 12:02 PM, Marc Saric wrote:

            
#
Simon Urbanek wrote:

            
That's exactly what I thought after my initial try to compile the
package did not work (except that it was not clear to me wether the
"CurrentJDK" link was the only place where things could go wrong).

So I did check my setup:

lrwxr-xr-x    1 root  wheel    3 Nov  8 10:47 CurrentJDK -> 1.5

which in turn points to 1.5.0, so this should be correct.
You are right here, the package does not check for the correct Java
automatically, but has to be forced to do it correctly. I managed to
compile it by unpacking the tar.gz and hand-editing

RMAGEML/src/Makevars (and Makevars.perm and Makevars.in) so that it
looks like this

# for macosx of 3/05
#
PKG_CPPFLAGS=-I/System/Library/Frameworks/JavaVM.framework/Headers
PKG_LIBS=-framework JavaVM

after that it compiled (actually this code was in the Makevars script
allready and just had to be uncommented -a more clever Makevars should
fix this).

At least the PKG_CPPFLAGS points to

lrwxr-xr-x    1 root  wheel   24 Apr  5 14:56 Headers ->
Versions/Current/Headers

which should be ok (see above).

Will have a closer look at the CPPFLAGS and LIBS settings and try to
find out some more stuff about Java on Mac and try again.

P.S. Got mail from the original author, he mentions that no one tried to
compile it on Mac so far -might become interresting. :-)