[kaffe] libtool problem loading native libs w/ nonstandard names?

jrandom jrandom at i2p.net
Tue Aug 31 17:43:30 PDT 2004

Hash: SHA1

Ok, I'm doing some funky stuff with some native libraries, but the
short story is I've got a standard shared library stored in a jar
file that I load by writing it out to disk and calling
System.load(filename).  Since I'm working with a few different OSes,
I simply use a randomly generated filename (per
File.createTempFile), but it seems that libtool is barfing when
trying to load a shared library that doesn't end in .so

java.lang.UnsatisfiedLinkError: jbigi1093996935672lib.tmp: not found.
Cannot open "/tmp/jbigi1093996935672lib.tmp.so"
   at java.lang.NativeLibrary.linkLibrary (NativeLibrary.java)
   at java.lang.NativeLibrary.<init> (NativeLibrary.java:44)
   at java.lang.Runtime.load (Runtime.java:184)
   at java.lang.System.load (System.java:115)

Digging through the source (external.c to slib.h), Kaffe is
essentially calling

which, in turn, calls

Now, I dont know libtool from a hole in the wall, but the docs I've
found tell me that lt_dlopenext will *first* check the file
explicitly mentioned, then add the .la, or the .so, before failing.

I patched external.c's loadNativeLibrary2 to print out the path
given, and it is sending in "/tmp/jbigi1093996935672lib.tmp", not

However, I know the file exists and is valid:
> ls -ld /tmp/jbigi1093996935672lib.tmp
 -rw-------  1 jrandom  wheel  58572 Aug 31 17:02

> file /tmp/jbigi1093996935672lib.tmp
 /tmp/jbigi1093996935672lib.tmp: ELF 32-bit LSB shared object, Intel
 80386, version 1 (FreeBSD), stripped

I also know Kaffe can deal with that library, since copying the file
to ./libjbigi.so and using -Djava.library.path loads it just fine
(we try loadLibrary first before checking for the resource in a jar)

As far as I can tell, Kaffe is doing everything 'right' here - it
seems libtool is the one b0rking up.  Is this a known issue, or am
I missing something?  For now, I can work around it by hardcoding
the appropriate suffix on the temporary files, but I thought I'd
report it as sun's JVM operates differently.

Oh, and this is all CVS HEAD as of this evening, FreeBSD 4.8, x86.


Version: PGP 8.1


More information about the kaffe mailing list