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

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


-----BEGIN PGP SIGNED MESSAGE-----
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)
[snip]

Digging through the source (external.c to slib.h), Kaffe is
essentially calling
  KaffeLib_Load("/tmp/jbigi1093996935672lib.tmp")

which, in turn, calls
  lt_dlopenext("/tmp/jbigi1093996935672lib.tmp")

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
"/tmp/jbigi1093996935672lib.tmp.so"

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

> 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.

=jr

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.1

iQA/AwUBQTUaghpxS9rYd+OGEQJO/QCgwsKwbLHjyhcLxpqRBkDOjIJm8RgAnjWQ
59eQv61wJ70aYlgBaI5EAPKb
=ool7
-----END PGP SIGNATURE-----





More information about the kaffe mailing list