Re: linking in static libraries under xcode?
Re: linking in static libraries under xcode?
- Subject: Re: linking in static libraries under xcode?
- From: Chris Ridd <email@hidden>
- Date: Fri, 06 Feb 2004 14:20:59 +0000
On 6/2/04 12:01 pm, Bill Northcott <email@hidden> wrote:
>> On Thursday, February 5, 2004, at 04:33 PM, Bill Northcott wrote:
>>
>>> On 06/02/2004, at 3:11 AM, Shantonu Sen wrote:
>>>> What?!?!?!!?
>>>>
>>>> No, Xcode can use static archives just fine.
>>>> 1) For your tool target "reader", add a "Frameworks and Libraries"
>>>> phase if it doesn't have one already. Project > New Build Phase > New
>>>> Frameworks and Libraries Phase
>>>> 2) Add the library. Projects > Add Frameworks... Navigate to your
>>>> static archive. Add it to the appropriate targets via checkboxes
>>>> 3) If you later need to add it to other targets, drag the reference
>>>> in your project hierarchy to the appropriate "Frameworks and
>>>> Libraries" phase
>>>
>>> I don't think you are contradicting what I said, just helpfully
>>> expanding it. Was I wrong to say that you cannot use use '-lfoo' on
>>> an ld command line if libfoo.a is a conventional archive? I certainly
>>> tried test cases on this and ld spat the dummy every time.
>>
>> Not to derail the Xcode discussion, but you are certainly wrong that
>> '-lfoo' fails to work with libfoo.a, using gcc/ld. I use this without
>> problem (but I have yet to convince Xcode to work with my project, a
>> separate issue).
>>
>>
> What do you mean by gcc/ld? How was libfoo.a created?
>
> If I try something like
> ld -o someexecutable grog.o bar.o -lfoo
> where libfoo.a is an archive made with
> ar -cru -o libfoo.a yuch.o grok.o blob.o
> ranlib -s libfoo.a
> I will get
> libfoo.a is not a valid object file
> and it wil break.
>
> Are you saying this is different for you?
It is certainly different for me, as ar fails to run.
ar: illegal option combination for -r
usage: ar -d [-TLsv] archive file ...
ar -m [-TLsv] archive file ...
ar -m [-abiTLsv] position archive file ...
ar -p [-TLsv] archive [file ...]
ar -q [-cTLsv] archive file ...
ar -r [-cuTLsv] archive file ...
ar -r [-abciuTLsv] position archive file ...
ar -t [-TLsv] archive [file ...]
ar -x [-ouTLsv] archive [file ...]
Try just 'ar r libfoo.a yuch.o grok.o blob.o' and 'ranlib libfoo.a'. Works
for me!
[titanium:~] cjr% what `which ar`
/usr/bin/ar
PROGRAM:ar PROJECT:cctools-498 DEVELOPER:root BUILT:Tue Nov 4
15:56:50 PST 2003
[titanium:~] cjr% what `which ranlib`
/usr/bin/ranlib
PROGRAM:cctools_misc PROJECT:cctools-498 DEVELOPER:root BUILT:Tue
Nov 4 15:52:54 PST 2003
Cheers,
Chris
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.