Bug 109324

Summary: Make WebCore Derived Sources work with SDK identifiers too
Product: WebKit Reporter: David Farler <dfarler>
Component: Tools / TestsAssignee: David Farler <dfarler>
Status: RESOLVED FIXED    
Severity: Normal CC: ddkilzer, mrowe, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Macintosh   
OS: All   
Attachments:
Description Flags
Patch none

Description David Farler 2013-02-08 14:02:14 PST
Source/WebCore/DerivedSources.make invokes CC with -isysroot $(SDKROOT), which won't work if you use an SDK identifier instead of an absolute path. Where necessary, we should use xcrun to find the absolute path to the SDK. This works for either:

xcrun --sdk <SDK identifier> --show-sdk-path
xcrun --sdk /Full/Path/To/The/SDK --show-sdkpath

Both return /Full/Path/To/The/SDK.
Comment 1 Mark Rowe (bdash) 2013-02-08 14:44:52 PST
I'm a little bit surprised that Xcode isn't expanding SDKROOT out to the path to the SDK.
Comment 2 David Kilzer (:ddkilzer) 2013-02-08 14:51:51 PST
(In reply to comment #1)
> I'm a little bit surprised that Xcode isn't expanding SDKROOT out to the path to the SDK.

Is it clang that doesn't know what to do with "-isysroot <SDK identifier>"?
Comment 3 David Farler 2013-02-08 14:53:18 PST
(In reply to comment #2)
> (In reply to comment #1)
> > I'm a little bit surprised that Xcode isn't expanding SDKROOT out to the path to the SDK.

Actually, it turns out that it does expand it, but we have a derived sources shell script phase and it isn't passing SDKROOT=${SDKROOT} to the make invocation, so maybe adding that is all we need.

> 
> Is it clang that doesn't know what to do with "-isysroot <SDK identifier>"?

Yeah, it looks that it has to be an absolute path because it prepends it to other path options.
Comment 4 David Farler 2013-02-08 15:05:48 PST
Created attachment 187371 [details]
Patch

Yep, looks like we just need to pass SDKROOT to the make invocation for Derived Sources. Confirmed this on all platforms.
Comment 5 Mark Rowe (bdash) 2013-02-08 15:09:30 PST
Comment on attachment 187371 [details]
Patch

That's a little surprising. Where is make currently getting the value of SDKROOT from if not the environment?
Comment 6 David Farler 2013-02-08 15:24:48 PST
(In reply to comment #5)
> (From update of attachment 187371 [details])
> That's a little surprising. Where is make currently getting the value of SDKROOT from if not the environment?

I think it is getting it from the environment fine but when Xcode expands it it doesn't update the environment when calling out to shell scripts in build phases. That would seem to match the behavior I was seeing, where building with SDKROOT=my.sdk is passed through to the environment in `make -f DerivedSources.make`.
Comment 7 WebKit Review Bot 2013-02-11 16:34:02 PST
Comment on attachment 187371 [details]
Patch

Clearing flags on attachment: 187371

Committed r142546: <http://trac.webkit.org/changeset/142546>
Comment 8 WebKit Review Bot 2013-02-11 16:34:05 PST
All reviewed patches have been landed.  Closing bug.