[solved] Re: Resolve library conflict
[solved] Re: Resolve library conflict
- Subject: [solved] Re: Resolve library conflict
- From: John Velman <email@hidden>
- Date: Wed, 7 Oct 2009 14:32:53 -0700
- Mail-followup-to: John Velman <email@hidden>, Xcode Users List <email@hidden>
On Wed, Oct 07, 2009 at 12:24:56PM -0700, Chris Espinosa wrote:
>
> On Oct 7, 2009, at 11:34 AM, John Velman wrote:
>
>> I want to use a .o file produced by Haskell using the Haskell to C Foreign
>> Function interface within an Xcode project. The Haskell .o file depends
>> on
>> a bunch of Haskell libraries, which are all in
>> /Library/Frameworks/Versions/Current/usr/lib or one of its subdirectories.
>>
>> Adding these to the project, everything seems to link, _except_, one
>> required library is the Haskell version of libgmp.a
>>
>> When I don't add libgmp.a, I get undefined symbols that are all defined
>> int
>> the Haskell libgmp.a.
>>
>> When I do add libgmp.a, I get the message (here edited to multilines for
>> readability:
>> ----
>> ld warning: in /Developer/SDKs/MacOSX10.5.sdk/usr/local/lib/libgmp.dylib,
>> file is not of required architecture
>>
>> ----
>>
>> Apparently, the fact that there is a libgmp.dylib in "the usual place" is
>> preventing Xcode from looking in the library I specifically add. This is
>> the case even when I try copying the Haskell library into my project
>> folder, or when the target linked library info shows path for this library
>> as
>>
>>
>> /Library/Frameworks/GHC.framework/Versions/610/usr/lib/ghc-6.10.4/libgmp.a
>>
>> I'm out of my depth here. I've tried to find a way around this in Ch 21
>> (and elsewhere) in Fritz Anderson's "XCode 3 Unleashed", but can't find
>> it.
>>
>> I'm still with Xcode 3.1.3, on OS X 10.5.8, 2.4GHz Intel Core 2 Duo.
>
> 1) You can remove the .a file from your project and instead link to it with
> a specific linker directive by adding
> "-l/Library/Frameworks/GHC.framework/Versions/610/usr/lib/ghc-6.10.4/libgmp.a'
> to the Other Linker Flags build setting.
>
> 2) You can defeat the "helpful" access through the 10.5 SDK to
> /usr/local/lib by deleting the symlink at
> /Developer/SDKs/MacOSX10.5.sdk/usr/local/lib
>
> Chris
Unfortunately, I couldn't make (1) work. ld told me that /Library...
wasn't a library file, and the man seems to say that -lx looks for
(1)libx.dylib first, then (2)libx.a along the search path(s) in the order
given by the defaults and the -L's.
Also, when I looked at removing the sym links, in light of the search path
stuff, and the fact that there were a bunch of libgmp.dylib and libgmp.a on
places that could have been in the search path, and in light of possibly
wanting to use some code that uses the default library some time, I didn't
try 2.
The symlink suggestion did, however, give me a wonderful idea for a simple
solution that actually worked:
I created a sym link ln -s libgmp.a lib-h-gmp.a in the Haskell library
folder. Then added lib-h-gmp.a to my project.
My sample problem then built and ran! Wow, am I happy now.
Best, and thanks,
John Velman
_______________________________________________
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