yujiahui / gyp

Automatically exported from code.google.com/p/gyp
0 stars 0 forks source link

ninja/xcode_emulation _GetSdkVersionInfoItem doesn’t work with the 10.6 SDK that Xcode doesn’t know about #370

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Xcode 5.0 installed.
2. building official Chrome build
3. mac_sdk_path GYP variable set to /SDKs/MacOSX10.6.sdk
4. using ninja generator
5. run gclient runhooks

What is the expected output? What do you see instead?
Expect: gclient runhooks to work.
Observe:
gyp: Error 64 running xcodebuild
Using overrides found in /Users/mark/.gyp/include.gypi
Error: Command /usr/bin/python src/build/gyp_chromium returned non-zero exit 
status 1 in /chrome/trunk

Further debugging to make xcode_emulation.py spit out the entire command 
instead of just command[0] showed

gyp: Error 64 running xcodebuild -version -sdk /SDKs/MacOSX10.6.sdk 
ProductBuildVersion

This command is run by _GetSdkVersionInfoItem to get ProductBuildVersion for 
GetExtraPlistItems to set DTSDKBuild. This was added in r1734 
https://codereview.chromium.org/23781011. It is not uncommon for Xcode to deal 
perfectly well with an SDK that it didn’t ship with, but to not really get 
any of its information right for versioning purposes.

This may block official builds.

Original issue reported on code.google.com by mark@chromium.org on 23 Sep 2013 at 8:43

GoogleCodeExporter commented 9 years ago
I forgot to say:

mark@cougar bash$ xcodebuild -version -sdk /SDKs/MacOSX10.6.sdk 
ProductBuildVersion
xcodebuild: error: SDK "/SDKs/MacOSX10.6.sdk" cannot be located.
mark@cougar bash$ ls -l /SDKs/MacOSX10.6.sdk
total 8
drwxr-xr-x  4 root  wheel   136 Jul 26  2011 Developer
drwxr-xr-x  3 root  wheel   102 Dec  5  2011 Library
-rw-r--r--  1 root  wheel  1291 May 29  2012 SDKSettings.plist
drwxr-xr-x  3 root  wheel   102 Aug 24  2011 System
drwxr-xr-x  9 root  wheel   306 May 29  2012 usr

Original comment by mark@chromium.org on 23 Sep 2013 at 8:45

GoogleCodeExporter commented 9 years ago
Hm, isn't this more that the sdk is set to a path? Does `xcodebuild -version 
-sdk macosx10.6 ProductBuildVersion` work?

Original comment by thakis@chromium.org on 23 Sep 2013 at 9:23

GoogleCodeExporter commented 9 years ago
mark@cougar bash$ xcodebuild -version -sdk macosx10.6 ProductBuildVersion
xcodebuild: error: SDK "macosx10.6" cannot be located.

The official bots set the SDK by path as I recall because Xcode doesn’t know 
about it by any symbolic name. That’s the whole reason we have mac_sdk_path 
support in common.gypi.

Paths should work as arguments to -sdk:

mark@cougar bash$ xcodebuild -version -sdk /SDKs/MacOSX10.8.sdk 
ProductBuildVersion
12D75

Original comment by mark@chromium.org on 24 Sep 2013 at 4:06

GoogleCodeExporter commented 9 years ago
What does the Xcode-written Info.plist contain as value for the DTSDKBuild key?

Original comment by thakis@chromium.org on 24 Sep 2013 at 4:29

GoogleCodeExporter commented 9 years ago
Using this .gyp file:

{
  'targets': [
    {
      'target_name': 'test',
      'type': 'executable',
      'mac_bundle': 1,
      'sources': [
        'test.c',
      ],
      'xcode_settings': {
        'INFOPLIST_FILE': 'Info.plist',
        'SDKROOT': '/SDKs/MacOSX10.6.sdk',
      },
    },
  ],
}

and xcodebuild from Xcode 5.0 5A1413, here is everything that gets written to 
Info.plist:

        <key>BuildMachineOSBuild</key>
        <string>12F37</string>

        <key>DTCompiler</key>
        <string>com.apple.compilers.llvm.clang.1_0</string>
        <key>DTPlatformBuild</key>
        <string>5A1413</string>
        <key>DTPlatformVersion</key>
        <string>GM</string>
        <key>DTSDKBuild</key>
        <string>10K549</string>
        <key>DTSDKName</key>
        <string>macosx10.6</string>
        <key>DTXcode</key>
        <string>0500</string>
        <key>DTXcodeBuild</key>
        <string>5A1413</string>

The most likely file that contains the string 10K549 in the SDK is 
System/Library/CoreServices/SystemVersion.plist’s ProductBuildVersion. 
macosx10.6 likely just comes from SDKSettings.plist’s CanonicalName.

Original comment by mark@chromium.org on 24 Sep 2013 at 2:10