Re: Linking to third-party Frameworks and dylibs from a plug-in
Re: Linking to third-party Frameworks and dylibs from a plug-in
- Subject: Re: Linking to third-party Frameworks and dylibs from a plug-in
- From: Jean-Daniel Dupas <email@hidden>
- Date: Tue, 18 Mar 2008 19:44:39 +0100
You can use install_name_tool to modify the "Intall path" of th third
party library:
install_name_tool -id @loader_path/../what/you/want/third_party.dylib
third_party.dylib
Then all files linked using this library will have the path you choose.
Else, you will have to use lipo to flatten your binary, use
install_name_tool on each arch, and then lipo to recreate an UB, but I
don't think I will choose this way.
Le 18 mars 08 à 18:51, Dan Korn a écrit :
I thought I had a nice solution to this problem. I have a script
like so which runs after my plug-in is built:
echo Modifying dylib and Framework loading paths...
BUILT_OBJ_FULLPATHNAME="${TARGET_BUILD_DIR}/${WRAPPER_NAME}/Contents/
MacOS/${PRODUCT_NAME}"
#echo $BUILT_OBJ_FULLPATHNAME
install_name_tool -change `otool -L "$BUILT_OBJ_FULLPATHNAME" | grep
Xerces | cut -d\ -f1` @loader_path/../Frameworks/Xerces.framework/
Versions/A/Xerces "$BUILT_OBJ_FULLPATHNAME"
# ...a few other install_name_tool commands like the one above...
echo Done!
This seems to work fine, and allows my plug-in to load the third-
party framework at runtime.
However, there's a problem here: install_name_tool only seems to
change the load path FOR THE CURRENT ARCHITECTURE. So, if I build
on an Intel Mac, the plug-in loads on Intel but not on PowerPC, and
vice-versa.
I can take the exact same built executable and run otool -L on it,
and it shows different results on Intel and PowerPC Macs. Or I can
just run otool with the -arch flag and see the differences in the
Intel and PowerPC load tables from the same machine.
But even though the otool utility offers the handy -arch flag, the
install_name_tool doesn't seem to have a per-architecture option.
So, is there any way to get install_name_tool to modify the load
path for both architectures?
I'm trying really hard not to rant about how unbelievably dumb it is
that Xcode wouldn't try to be a little bit helpful and know that, if
you're actually bothering to copy a Framework inside your own
bundle, you might want to actually load it from there, instead of
from the single hard-coded path where the framework itself thinks it
needs to be installed. What I'm trying to do should be very simple
without having to jump through all of these hoops. Okay, sorry, I'm
ranting, but criminy, I'm just trying to put a framework in my
bundle and load it from there! >:(
Thanks,
Dan
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden