Date: Mon, 2 Feb 1998 22:55:39 -0700 From: Nate Williams <nate@mt.sri.com> To: Ian Grigg <iang@systemics.com> Cc: freebsd-java@FreeBSD.ORG Subject: Re: jdk115 JNI requires ELF, gcc makes a.out Message-ID: <199802030555.WAA00791@mt.sri.com> In-Reply-To: <34D6A37E.29B3C1AE@systemics.com> References: <199802021801.MAA06681@damon.com> <34D6A37E.29B3C1AE@systemics.com>
next in thread | previous in thread | raw e-mail | index | archive | help
> will soon rival the JDK :-). I'm now seeing useful debugging, and I get > this: > > cannot stat > "/usr/local/apps/java/java/bin/../lib/i386/green_threads//home/iang/src/helplets/current/native/build/x86-freebsd/libBlowfish.so" > : No such file or directory > (/home/iang/src/helplets/current/native/build/x86-freebsd/libBlowfish.so) > java.lang.UnsatisfiedLinkError: > /home/iang/src/helplets/current/native/build/x86-freebsd/libBlowfish.so > ... Hmm, I have an idea what might be causing this, but my *very simple* test code appears to work fine loading libraries: public class Lib { public static void main(String args[]) { new Lib(); } static { try { System.load("/usr/lib/libz.so.2.0"); System.out.println("Library loaded..."); } catch (Exception e) { System.err.println("Error:" + e); } } } > System.load("/home/iang/src/helplets/current/native/build/x86-freebsd/libBlowfish.so"); > > (sorry about the long names...). No problem. > It is insisting on turning the absolute pathname into one relative to > /usr/local/apps/java/java/bin/../lib/i386/green_threads/ I have an idea what might be causing that, but I wouldn't think it would be doing that in the Java code. > Now, I can fix this by setting LD_LIBRARYPATH to the current dir and > using a relative path: > > $ LD_LIBRARY_PATH=$PWD java Blowfish.BlowfishNative > build/x86-freebsd/libBlowfish.so > > BlowNat: load: build/x86-freebsd/libBlowfish.so > BlowNat: lib loaded successfully. > BlowNat: Loaded. > BlowNat: FAILED: java.lang.UnsatisfiedLinkError: getLibMajorVersion > > Which gets us nicely up to (my) next bug. I'm assuming the UnsatisfiedLinkErro is yours and not ours, right? > However, that is the relative > case, not the absolute case, the absolute still fails: As above, right. > Perhaps I'd better throw some questions in: > > * is "complete" synonymous with absolute? Totally qualified, and not relative. (Absolute works too.) > * is this a bug, or a misinterpretation? Possibly the former. > * should I be using System.loadLibrary? No. > * can I use absolute, relative, or what? Absolute (according to the docs.) > Note that at this stage I can survive, as a relative solution is fine. > But I'd like to know what the end verdict is, for the doco. However, I *believe* that it will pull things out of the LD_LIBRARY_PATH if you don't specify the entire path. So, using my above if I set the LD_LIBRARY_PATH to /usr/lib, I can do: System.load("libz.so.2.0"); And it will work. (If I don't set the LD_LIBRARY_PATH, by default it is set to /usr/local/jdk1.1.5/lib/i386/green_threads). But, if you give it the absolute path, it *should* work. Any chance of having you simplifying your test program into less than 100 lines? *grin* Nate
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199802030555.WAA00791>