new problem: libjava.dylib: image not found -- but it is there
John.Rose at Sun.COM
Mon Jan 25 18:51:44 PST 2010
I asked around at the office, and here's a possible root of the problem:
The launcher (java.c in the jdk repo) used to re-exec itself with LD_LIBRARY_PATH bindings, so the libjvm and libjava DLLs could find each other. This trick was always awkward, and has been removed.
Now the various DLLs have their pathnames baked into them at compile time, as *relative* paths. Perhaps this logic needs extra porting, or maybe there is a difference in behavior w.r.t. relative DLL paths on Mac OS. The error message (which comes from libjvm code) suggests that the launcher finds libjvm OK, and libjvm can find libjava OK, but when libjvm tries to open libjava, the reverse references from libjava to libjvm don't resolve properly, and the dlopen fails.
On Jan 19, 2010, at 7:38 AM, Stephen Bannasch wrote:
>> I built JDK7 today based on these instructions http://wikis.sun.com/display/OpenJDK/Darwin9Build
>> I'm experiencing the same problem.
> One possible clue is that the libjava.dylib files itself doesn't appear to be the problem.
> This is the latest build I have that doesn't work:
> [local]$ java-1.7.0-internal-2010_01_18/bin/java -version
> Error occurred during initialization of VM
> Unable to load native library: dlopen(/usr/local/java-1.7.0-internal-2010_01_18/jre/lib/i386/libjava.dylib, 1): Library not loaded: libjvm.dylib
> Referenced from: /usr/local/java-1.7.0-internal-2010_01_18/jre/lib/i386/libjava.dylib
> Reason: image not found
> Here's a build from Dec 26 that does work:
> [local]$ java-1.7.0-internal-2009_12_26/bin/java -version
> openjdk version "1.7.0-internal"
> OpenJDK Runtime Environment (build 1.7.0-internal-stephen_2009_12_26_16_00-b00)
> OpenJDK Server VM (build 17.0-b05, mixed mode)
> libjava.dylib is identical:
> [local]$ diff java-1.7.0-internal-2010_01_18/jre/lib/i386/libjava.dylib java-1.7.0-internal-2009_12_26/jre/lib/i386/libjava.dylib
> However the bin/java files differ.
More information about the bsd-port-dev