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: Fwd: [jna-users] Java 5 dependency on OSX



Michael Hall wrote:

--- Timothy Wall <email@hidden> wrote:

I fiddled about with the makefile to try and get
it to link to:



/System/Library/Frameworks/JavaVM.framework/Libraries/libjawt.dylib

Which I figured would be valid on any machine, but
this is a
symlink that resolves to Java 5 (on my dev
machine) so I wind up
with a library with the same problem. I confess to
knowing next to
nothing about linking dynamic libraries on OS X so


It would seem to me that a dynamic load should search on a symbol and not be tied to a specific absolute path library but I could be wrong. Not that familiar with that stuff. Where are the make and ant build files? I just did a little quick looking around and didn't see them. The JWS version of the dispatch library seemed a little more immediately accessible to see what it's dependcies were

 otool -L libjnidispatch.jnilib
libjnidispatch.jnilib:

/Users/twall/Development/ws/jna/build/native/libjnidispatch.jnilib
(compatibility version 0.0.0, current version 0.0.0)

/System/Library/Frameworks/JavaVM.framework/Versions/A/JavaVM
(compatibility version 1.0.0, current version 87.0.0)

/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/ Libraries/libjawt.dylib
(compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility
version 1.0.0, current version 88.3.3)

I don't think the lib is being linked right. I have a JNI lib that uses JAWT successfully, and it does not have a direct dependency on libjawt.dylib (as reported by otool -L), only a dependency on the JavaVM framework proper. The source code only names a call to JAWT_GetAWT -- all other JAWT calls are indirect via a function table filled in by GetAWT, and need not be made known to the linker. JAWT- GetAWT is in the JavaVM framework. Looking at libjawt.dylib I only see functions that are defined in the function table, so it need not be included in the link. Getting addresses of the functions to be placed in the function table becomes the JVM's responsibility at runtime. I don't see a dependency from the framework to libjawt.dylib, so it must either be statically linked, or using some funky mechanism that is not apparent to the causal observer.


FYI my makefile places no -l terms in the link statement, only - framework terms:

/usr/bin/gcc-3.3 -arch ppc -pipe -fmessage-length=0 -L/Developer/ SDKs/MacOSX10.3.9.sdk/usr/lib/gcc/darwin/ -F/Developer/SDKs/ MacOSX10.3.9.sdk/System/Library/Frameworks -framework JavaVM - framework ApplicationServices -framework Foundation -dynamiclib -Wl,- single_module -compatibility_version 1 -current_version 1 -mmacosx- version-min=10.2 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.3.9.sdk ppc/xxx.o -lstdc++ -install_name libxxx.jnilib -o ppc/libxxx.jnilib

/usr/bin/gcc-4.0 -arch i386 -pipe -fmessage-length=0 -L/Developer/ SDKs/MacOSX10.4u.sdk/usr/lib/gcc/darwin/ -F/Developer/SDKs/ MacOSX10.4u.sdk/System/Library/Frameworks -framework JavaVM - framework ApplicationServices -framework Foundation -dynamiclib -Wl,- single_module -compatibility_version 1 -current_version 1 -mmacosx- version-min=10.4 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk x86/ xxx.o -lstdc++ -install_name libxxx.jnilib -o x86/libxxx.jnilib

We have different SDK requirements for PPC and x86 jnilibs, hence the architecture-specific builds with different tool sets (one for ppc w/ GCC 3 and one for x86 w/GCC 4).
_______________________________________________
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.