Re: Building framework with another framework
Re: Building framework with another framework
- Subject: Re: Building framework with another framework
- From: Steve Mills <email@hidden>
- Date: Wed, 9 Jan 2008 13:15:11 -0600
On Jan 9, 2008, at 10:30:04, Ryan Homer wrote:
When you use @executable_path/Frameworks, this puts you at a certain
directory within your application bundle; this is where you are
expected to put all your frameworks. Let's take a look at what you
have:
Frameworks
CCILib.framework
CCILib (link)
PkgInfo
Resources (link)
Versions
A
CCILib
Frameworks
MAAEL.framework (everything in here looks correct)
Resources
Current (link)
I added the "Frameworks" directory that I'm assuming is the parent
directory.
Ok, so when you specify @executable_path/../Frameworks/
CCILib.framework, that path exists according to the above scenario.
However, for the framework embedded in the other framework, that no
longer holds true.
To get to the MAAEL.framework, the right path is now
@executable_path/../Frameworks/CCILib.framework/Versions/A//
Frameworks/MAAEL.framework.
Therefore, for any dylib located in the CCILib.framework, you need
@executable_path/../Frameworks/CCILib.framework/..
For any dylib located in the MAAEL.framework, you need
@executable_path/../Frameworks/CCILib.framework/Versions/A//
Frameworks/MAAEL.framework/..
If you use otool -L <your dylib name here>, you can see the embedded
paths. For example:
$ otool -L /usr/local/lib/libmimic.dylib
/usr/local/lib/libmimic.dylib:
/usr/local/lib/libmimic.0.dylib (compatibility version 1.0.0,
current version 1.1.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current
version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 111.0.0)
Notice that the first entry is /usr/local/lib/libmimic.0.dylib,
which refers to the dylib itself. To change this, you'd do this:
$ install_name_tool -id @executable_path/../Frameworks/
libmimic.framework/Versions/Current/libmimic.0.dylib libmimic.dylib
Notice I keep the exact name libmimic.0.dylib. If you do this, you
must also make sure that this softlink exists in the same directory.
I guess you can use the real name of the dylib to avoid having to
create the softlink.
I've manually created the symlink in CCILib.framework/ named
Frameworks and pointed it to CCILib.framework/Versions/Current/
Frameworks/. I then used install_name_tool to change the CCILib
executable so it points to the MAAEL executable located inside its own
framework:
Screamer:~$ otool -L /depot/8.0.x/creatortech/desktop/mac/MAAEL/build/
Debug/CCILib.framework/Versions/A/CCILib
/depot/8.0.x/creatortech/desktop/mac/MAAEL/build/Debug/
CCILib.framework/Versions/A/CCILib:
@executable_path/../Frameworks/CCILib.framework/Versions/A/CCILib
(compatibility version 1.0.0, current version 1.0.0)
@executable_path/../Frameworks/CCILib.framework/Versions/Current/
Frameworks/MAAEL.framework/MAAEL (compatibility version 1.0.0, current
version 1.0.0)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon
(compatibility version 2.0.0, current version 128.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/
CoreFoundation (compatibility version 150.0.0, current version 368.28.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current
version 7.4.0)
/usr/lib/libgcc_s.1.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.9)
I'm still getting the link errors, so I've obviously incorrectly
understood. Does the above look right or wrong? Do I also need to run
install_name_tool on MAAEL, or can it continue to have its entry as
"@executable_path/../Frameworks/MAAEL.framework/Versions/A/MAAEL"?
I also hope I can do all of this in one of the targets as part of a
shell script action - assumedly the CCILib framework target, right?
Steve Mills
Drummer, Mac geek
http://sjmills5.home.mchsi.com/
_______________________________________________
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