Hello,
I just upgraded to 1.1.5 and saw this snippet in the jruby shell script.
Figure out the OS and cpu the same as JNA would, so the library path
can be set
case “uname -m
” in
i[34567]86) JNA_CPU=“i386”;;
i86pc) JNA_CPU=“x86”;;
amd64|x86_64) JNA_CPU=amd64;;
esac
JNA_OS="uname -s | tr '[A-Z]' '[a-z]'
"
case “$JNA_OS” in
darwin) JNA_PATH=“darwin”;;
*) JNA_PATH="${OS}-${JNA_CPU}";;
esac
Two things, one easy, one harder.
-
The OS variable is referenced here
*) JNA_PATH="${OS}-${JNA_CPU}";;
but it’s JNA_OS that is set, so JNA_PATH is incorrectly set.
- The script assumes that one is running a 64-bit Java process on a
64-bit box,
which isn’t always the case. Is there an easy way for the script to see
if the
Java process is a 32- or a 64-bit one and then set the JNA_PATH
correctly?
Using java -showversion one can see if it’s a 64-bit Java, but that
sounds
painful and messy matching all the different outputs one could run into.
Reading dlopen()'s manual page, it sounds like we could set
LD_LIBRARY_PATH to
$JRUBY_HOME/lib/native/linux-amd64:$JRUBY_HOME/lib/native/linux-i386
and the process will find the correct 32- or 64-bit .so at runtime.
The function dlopen() loads the dynamic library file named
by the
null-terminated string filename and returns an opaque “handle”
for the
dynamic library. If filename is NULL, then the returned handle
is for
the main program. If filename contains a slash ("/"), then
it is
interpreted as a (relative or absolute) pathname.
Otherwise, the
dynamic linker searches for the library as follows (see
ld.so(8) for
further details):
o If the environment variable LD_LIBRARY_PATH is defined
to con-
tain a colon-separated list of directories, then
these are
searched. (As a security measure this variable is
ignored for
set-UID and set-GID programs.)
Regards,
Blair
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email