From owner-freebsd-java Mon Feb 2 21:55:43 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id VAA28483 for java-outgoing; Mon, 2 Feb 1998 21:55:43 -0800 (PST) (envelope-from owner-freebsd-java@FreeBSD.ORG) Received: from ns.mt.sri.com (sri-gw.MT.net [206.127.105.141]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id VAA28478 for ; Mon, 2 Feb 1998 21:55:42 -0800 (PST) (envelope-from nate@mt.sri.com) Received: from mt.sri.com (rocky.mt.sri.com [206.127.76.100]) by ns.mt.sri.com (8.8.8/8.8.8) with SMTP id WAA20721; Mon, 2 Feb 1998 22:55:41 -0700 (MST) (envelope-from nate@rocky.mt.sri.com) Received: by mt.sri.com (SMI-8.6/SMI-SVR4) id WAA00791; Mon, 2 Feb 1998 22:55:39 -0700 Date: Mon, 2 Feb 1998 22:55:39 -0700 Message-Id: <199802030555.WAA00791@mt.sri.com> From: Nate Williams MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: Ian Grigg Cc: freebsd-java@FreeBSD.ORG Subject: Re: jdk115 JNI requires ELF, gcc makes a.out In-Reply-To: <34D6A37E.29B3C1AE@systemics.com> References: <199802021801.MAA06681@damon.com> <34D6A37E.29B3C1AE@systemics.com> X-Mailer: VM 6.29 under 19.15 XEmacs Lucid Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org X-To-Unsubscribe: mail to majordomo@FreeBSD.org "unsubscribe java" > 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