DYLD_FALLBACK_LIBRARY_PATH changed in OpenJDK (was Re: How to load dylib on Mac?)
Weijun.Wang at Sun.COM
Fri Jul 24 01:52:56 PDT 2009
I've found something new.
It seems the dlopen() function in Mac is quite normal, but there are
some problem inside OpenJDK.
I'm calling dlopen("libkrb5.dylib", RTLD_NOW) inside OpenJDK now and it
returns NULL. However, if I manually set DYLD_LIBRARY_PATH or
DYLD_FALLBACK_LIBRARY_PATH to /usr/lib, then it works.
So I printf the DYLD_FALLBACK_LIBRARY_PATH value, it is changed to
something like jre/lib/i386:jre/lib:jre/../lib/i386. According to Apple
doc, the default value of it should ~/lib:/usr/lib:/usr/local/lib. If
OpenJDK wants to change it to something else, shouldn't it append the
new value onto the old one?
So I suggest making these changes:
@@ -443,6 +443,9 @@
runpath = getenv(LD_LIBRARY_PATH);
+ if (!runpath) runpath = "/usr/local/lib:/usr/lib";
#endif /* __solaris__ */
#if defined(__linux__) || defined(_ALLBSD_SOURCE)
Yes, the default runpath should also include "~/lib", omitted here for
Max (Weijun) Wang wrote:
> Hi All
> I'm totally new to C programming on Mac.
> On other systems I can call dlopen("libkrb5.so", RTLD_NOW) to return a
> non-NULL pointer to the library. However, on Mac,
> dlopen("libkrb5.dylib", RTLD_NOW) returns NULL even if I can see the /
> usr/lib/libkrb5.dylib is right there. What's wrong here?
> Also, is there a way to write a cross-platform call? Say,
I've found the JNI_LIB_NAME() macro. Nice.
More information about the bsd-port-dev