Date: Sun, 18 Apr 2010 13:05:30 +0530
From: Parimal Das<email@hidden>
Subject: Problem with setting dylib paths to ship them in my app
bundle (@executable_path/../Frameworks )
To: email@hidden
Message-ID:
<email@hidden>
Content-Type: text/plain; charset="iso-8859-1"
Hello
I am using a third-party library, which has 2 dylibs in it.
Now i want to ship these dylibs, with my app.
For that i have changed the dylib paths as @executable_path/../Frameworks
One of these dylibs is internally calling other, i am not able to set that
path accordingly. :(
Here is what i am trying to do.
Say, libABC.dylib and libXYZ.dylib
On doing a
$ otool -L libABC.dylib
libABC.dylib:
libABC.dylib (compatibility version 1.0.0, current version 1.0.0)
libXYZ.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
111.1.5)
$ otool -L libXYZ.dylib
libXYZ.dylib:
libXYZ.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
111.1.5)
Now i want to ship these dylibs, with my app.
For that i have changed the dylib paths as
$ install_name_tool -id @executable_path/../
Frameworks/libABC.dylib libABC.dylib
$ install_name_tool -id @executable_path/../Frameworks/libXYZ.dylib
libXYZ.dylib
This changes the inside dylib paths as
$ otool -L libABC.dylib
libABC.dylib:
@executable_path/../Frameworks/libABC.dylib (compatibility version
1.0.0, current version 1.0.0)
libXYZ.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
111.1.5)
$ otool -L libXYZ.dylib
libXYZ.dylib:
@executable_path/../Frameworks/libXYZ.dylib (compatibility version
0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version
111.1.5)
The problem here is:
libABC is internally calling libXYZ,
i am unable to change this path, to a path relative to my mach-o binary
(inside my app bundle)
So my app is failing to load.
Dyld Error Message:
Library not loaded: libXYZ.dylib
Referenced from:
/Users/pd/Desktop/MyTool.app/Contents/MacOS/../Frameworks/libABC.dylib
Reason: image not found
Please suggest some direction.
The third party library is only creating dylibs, no static libs
And i am more comfortable with XCode then CMake.
I also tried setting XCode options to get dylibs from "@executable_path" but
it didnt work.
Or i should load my dylibs through code?
Please suggest. I am clueless here.
Advance Thanks :)