• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: conditionally linking to a static lib?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: conditionally linking to a static lib?


  • Subject: Re: conditionally linking to a static lib?
  • From: John Mikros <email@hidden>
  • Date: Sun, 11 Oct 2009 17:19:11 -0700

Thanks for this tip.  It worked great!

-john

On Oct 9, 2009, at 10:06 AM, Rush Manbert wrote:


On Oct 8, 2009, at 1:37 PM, John Mikros wrote:

Hello all,

In our project, we have a bunch of targets that build static libs, and then we link those libs into a final executable. The targets for the static libs are dependencies of the target for the final exe.

One of those targets needs to be built only for x86 and not for ppc. We would like to not wrap each of the source files with #ifdef __i386__, so we set the architectures build setting for that one target to "i386" instead of "i386 ppc".

But, we get link warnings when the ppc executable gets linked with "file is not of required architecture".

So, I took that library out of the "Linked Libraries" for the executable, and added -lmystaticlib to "Other Linker Flags" for just i386. This gets rid of the warnings.

But, this has the side effect that the dependency checking doesn't work such that if the lib gets rebuilt, it doesn't cause the executable be relinked.

One way to hack that is to have your library build touch a file using a script build phase. If I remember correctly, it can even be an empty file, or it can have a static void nothing(void){} function in it. Make the file be part of the executable build. Crude but effective.


- Rush


_______________________________________________ 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
References: 
 >conditionally linking to a static lib? (From: John Mikros <email@hidden>)
 >Re: conditionally linking to a static lib? (From: Rush Manbert <email@hidden>)

  • Prev by Date: Re: Cannot remove undocumented and useless "Page" item from project window toolbar
  • Next by Date: Remote Debugging Under 10.6.1/3.2 With 10.5.8/2.5 Host
  • Previous by thread: Re: conditionally linking to a static lib?
  • Next by thread: Re: conditionally linking to a static lib?
  • Index(es):
    • Date
    • Thread