Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UnsatisfiedLinkError's



Michael Hall wrote:

>otool -L libplc4.dylib
>libplc4.dylib:
>@executable_path/libplc4.dylib (compatibility version 1.0.0, current
>version 1.0.0)
>@executable_path/libnspr4.dylib (compatibility version 1.0.0, current
>version 1.0.0)
>/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
>88.1.10)
>
>So, itself, the existing and successfully loading libnspr4 and a system lib.
>The past post seemed to have a pretty complex situation. This seems fairly
>simple, why doesn't it work?

As I understand it, the "@executable_path" from the context of the 'java'
command would be "/usr/bin" or
"/System/Library/.../JavaVM.framework/.../java".  It's the pathname of the
main executable.  Either way, the reference for
@executable_path/libnspr4.dylib will be wrong.

I think you'll have to use 'install_name_tool' on the dylib files, and set
it to "@loader_path" instead of "@executable_path".

See 'man dyld' and this page (find "@loader" on it):
  <http://developer.apple.com/releasenotes/DeveloperTools/RN-dyld/index.html>

You'd do a similar thing if you had a ".jnilib" file that referenced a
separate companion ".dylib" file that was assumed to be at some
jnilib-relative location.

I think you can also use a plain relative pathname, e.g. libnspr4.dylib.
See 'man dyld' for how those are resolved (and remember there are security
consequences whenever a path or series of paths is searched).

  -- GG


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.