Re: Linking with static sqlite 3 library
Re: Linking with static sqlite 3 library
- Subject: Re: Linking with static sqlite 3 library
- From: Eric Albert <email@hidden>
- Date: Thu, 9 Jun 2005 01:19:55 -0700
On Jun 8, 2005, at 5:22 PM, Chris Espinosa wrote:
On Jun 8, 2005, at 12:31 PM, Marco Bambini wrote:
I am using XCode 2.1 and MacOS X 10.4.1, I have a project (C console app) that needs to be linked with a static sqlite3.a library generated by gcc on the same machine.
Before Tiger I have no problem in the link stage and the final build was around 400KB.
After upgrading to Tiger, the final build is about 70KB and I think that is linked to the shared sqlite3 library shipped with the OS.
So my question is, how can I force my project to link to my static sqlite3 library instead of the shared one?
We just saw this yesterday. Turns out that the linker prefers to use a .dylib over a .a when you have both.
So you need to do the following:
- remove the sqlite3.a library from your project
- add an explicit flag in Other Linker flags that reads something like "-l/usr/local/lib/sqlite/libsqlite3.dylib" (replace with the appropriate fully-qualified path to your lib)
There's potentially a second option here: Pass the -search_paths_first argument to ld and ensure that the path to your static library is passed to ld before the path to the system's dylib. See the ld man page for details on -search_paths_first.
-Eric
_______________________________________________
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