• 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: Xcode does not rebuild app when source file updated in dependent static library
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Xcode does not rebuild app when source file updated in dependent static library


  • Subject: Re: Xcode does not rebuild app when source file updated in dependent static library
  • From: Stephan Diederich <email@hidden>
  • Date: Sat, 20 Oct 2012 22:03:29 +0200

On Fri, Oct 19, 2012 at 10:40 PM, Michael Rawdon <email@hidden> wrote:
> On Oct 19, 2012, at 9:13 AM, Jens Alfke <email@hidden> wrote:
>
> On Oct 19, 2012, at 8:54 AM, Russell Finn <email@hidden> wrote:
>
> Now, if I modify the text of the message in the library source file,
> then click the "build and run" button, Xcode correctly rebuilds the
> library, but *fails* to relink the application, so when the
> application runs, the unmodified message text is displayed.
>
>
> I have projects with these kinds of dependencies, and have not seen this
> problem.
> It sounds like Xcode doesn’t realize that the static library it’s linking
> into the app is the product of the library target.
>
>
> It's heartening (if a bit baffling to me) that not everyone using static
> libraries is hitting this, but yes, this is a known bug in Xcode.
>
> The bug isn't specifically due to static libraries (you can probably
> contrive a situation where it would happen for dynamic libraries), but it is
> more serious for more static libraries since of course it's critical that
> static libraries get relinked because that's how your changes make it into
> your app.  For dynamic libraries (which aren't available for iOS developers,
> but are for OS X developers), a large set of possible changes (though
> obviously not all of them) don't need to be detected at the time the app is
> relinked because they won't actually result in a changed app binary; instead
> the changes get picked up dynamically at run time when the dylib is loaded.
>
> The best workaround would be to add a shell script build phase to your app
> target to check whether the static library's modification date is newer than
> that for the app's binary, and if so to remove the app's binary to force it
> to be relinked.

Another 'workaround' I found to be working is to explicitly set the location
of static library to "Relative to Build Products".
Once the Location is changed, Xcode tries to figure out a new path and
end up with some relative path like
"../../../Library/Developer/Xcode/DerivedData/.…/libNAME.a".
Manually editing the pbxproject and changing the path to "libNAME.a"
(as it's relative to Build Products)
seems to fix the issue of Xcode not relinking the binary.
A nice side effect is that the static libraries don't show up in red
in the navigator anymore.

HTH,
Stephan

 _______________________________________________
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: 
 >Xcode does not rebuild app when source file updated in dependent static library (From: Russell Finn <email@hidden>)
 >Re: Xcode does not rebuild app when source file updated in dependent static library (From: Jens Alfke <email@hidden>)
 >Re: Xcode does not rebuild app when source file updated in dependent static library (From: Michael Rawdon <email@hidden>)

  • Prev by Date: Build Settings and Scriptability
  • Next by Date: Scheme disappears
  • Previous by thread: Re: Xcode does not rebuild app when source file updated in dependent static library
  • Next by thread: Re: Xcode does not rebuild app when source file updated in dependent static library
  • Index(es):
    • Date
    • Thread