GN Mac/iOS target platform detection

242 views
Skip to first unread message

Marshall Greenblatt

unread,
Aug 26, 2016, 4:09:40 PM8/26/16
to 'Adam Michalik' via Chromium-dev
Hi All,

I'm attempting a desktop build of Chromium on Mac and GN is implicitly (and incorrectly) setting is_ios=true. I think there may be something wrong or missing in my Xcode.app (version 7.3.1). Can anyone point me to the code in GN that performs this target platform detection?

Thanks,
Marshall

Nico Weber

unread,
Aug 26, 2016, 4:14:51 PM8/26/16
to Marshall Greenblatt, 'Adam Michalik' via Chromium-dev
I don't think anything does that automatically. What's your args.gn?


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
    http://groups.google.com/a/chromium.org/group/chromium-dev


Marshall Greenblatt

unread,
Aug 26, 2016, 4:23:39 PM8/26/16
to Nico Weber, 'Adam Michalik' via Chromium-dev
The relevant part is:

is_debug=false
is_official_build=true
target_cpu="x64"

Nico Weber

unread,
Aug 26, 2016, 4:24:57 PM8/26/16
to Marshall Greenblatt, 'Adam Michalik' via Chromium-dev
You're not setting target_os? Why are you sure is_ios is true? Did you put a `print(is_ios)` somewhere?

Marshall Greenblatt

unread,
Aug 26, 2016, 4:37:10 PM8/26/16
to Nico Weber, 'Adam Michalik' via Chromium-dev
On Fri, Aug 26, 2016 at 11:24 PM, Nico Weber <tha...@chromium.org> wrote:
You're not setting target_os?

Correct.
 
Why are you sure is_ios is true? Did you put a `print(is_ios)` somewhere?

Because I'm getting these build erors: http://pastebin.com/KczKpFTM

This is the part that tells me is_ios=true:

See //build/toolchain/mac/BUILD.gn:11:1: whence it was imported.
import("//build/config/ios/ios_sdk.gni")

Also, I can't reproduce the problem locally with an Xcode.app bundle that I downloaded and installed in the usual way via App Store.

Dirk Pranke

unread,
Aug 26, 2016, 5:01:36 PM8/26/16
to Marshall Greenblatt, Nico Weber, 'Adam Michalik' via Chromium-dev
I would scatter some print() statements in //build/config/BUILDCONFIG.gn; that's the only place where is_ios should be getting set to true. I'd be surprised if that had something to do w/ your xcode install.

-- Dirk

Marshall Greenblatt

unread,
Aug 29, 2016, 5:49:09 AM8/29/16
to Dirk Pranke, Nico Weber, 'Adam Michalik' via Chromium-dev
On Fri, Aug 26, 2016 at 11:59 PM, Dirk Pranke <dpr...@chromium.org> wrote:
I would scatter some print() statements in //build/config/BUILDCONFIG.gn; that's the only place where is_ios should be getting set to true. I'd be surprised if that had something to do w/ your xcode install.

Thanks for the suggestion. After debugging I see that the is_ios flag is not actually true in my case. The confusion resulted from M53, unlike master, including //build/config/ios/ios_sdk.gni without checking the is_ios flag [1] (and I was looking at the master sources instead of the M53 sources).

There also appears to be some non-deterministic behavior (or perhaps GN is intentionally running things in parallel) which added to the confusion. Sometimes `gn gen` fails with:

ERROR at //build/config/mac/mac_sdk.gni:42:5: Script returned non-zero exit code.
    exec_script("//build/mac/find_sdk.py", find_sdk_args, "list lines")
    ^----------
Current dir: /Users/buildagent/chromium/src/out/Debug_GN_x64/
Command: python -- /Users/buildagent/chromium/src/build/mac/find_sdk.py --print_sdk_path 10.10
Returned 1.

And other times it fails with:

ERROR at //build/config/ios/ios_sdk.gni:38:7: Script returned non-zero exit code.
      exec_script("//build/config/mac/sdk_info.py", [ ios_sdk_name ], "scope")
      ^----------
Current dir: /Users/buildagent/chromium/src/out/Debug_GN_x64/
Command: python -- /Users/buildagent/chromium/src/build/config/mac/sdk_info.py iphonesimulator
Returned 1.

In any case, I think this strongly indicates a problem with my Xcode.app bundle. I'll re-create it and hopefully that will resolve the problem.

Nico Weber

unread,
Aug 29, 2016, 10:00:18 AM8/29/16
to Marshall Greenblatt, Dirk Pranke, 'Adam Michalik' via Chromium-dev
On Mon, Aug 29, 2016 at 5:48 AM, Marshall Greenblatt <magree...@gmail.com> wrote:
On Fri, Aug 26, 2016 at 11:59 PM, Dirk Pranke <dpr...@chromium.org> wrote:
I would scatter some print() statements in //build/config/BUILDCONFIG.gn; that's the only place where is_ios should be getting set to true. I'd be surprised if that had something to do w/ your xcode install.

Thanks for the suggestion. After debugging I see that the is_ios flag is not actually true in my case. The confusion resulted from M53, unlike master, including //build/config/ios/ios_sdk.gni without checking the is_ios flag [1] (and I was looking at the master sources instead of the M53 sources).

There also appears to be some non-deterministic behavior (or perhaps GN is intentionally running things in parallel) which added to the confusion. Sometimes `gn gen` fails with:

ERROR at //build/config/mac/mac_sdk.gni:42:5: Script returned non-zero exit code.
    exec_script("//build/mac/find_sdk.py", find_sdk_args, "list lines")
    ^----------
Current dir: /Users/buildagent/chromium/src/out/Debug_GN_x64/
Command: python -- /Users/buildagent/chromium/src/build/mac/find_sdk.py --print_sdk_path 10.10

You can manually run `build/mac/find_sdk.py --print_sdk_path 10.10` to see what's going wrong. find_sdk.py is a pretty simple script and just calls xcrun two ways.

Brett Wilson

unread,
Aug 29, 2016, 12:13:36 PM8/29/16
to Marshall Greenblatt, Dirk Pranke, Nico Weber, 'Adam Michalik' via Chromium-dev
On Mon, Aug 29, 2016 at 2:48 AM, Marshall Greenblatt <magree...@gmail.com> wrote:
On Fri, Aug 26, 2016 at 11:59 PM, Dirk Pranke <dpr...@chromium.org> wrote:
I would scatter some print() statements in //build/config/BUILDCONFIG.gn; that's the only place where is_ios should be getting set to true. I'd be surprised if that had something to do w/ your xcode install.

Thanks for the suggestion. After debugging I see that the is_ios flag is not actually true in my case. The confusion resulted from M53, unlike master, including //build/config/ios/ios_sdk.gni without checking the is_ios flag [1] (and I was looking at the master sources instead of the M53 sources).

There also appears to be some non-deterministic behavior (or perhaps GN is intentionally running things in parallel) which added to the confusion. Sometimes `gn gen` fails with:

GN is extremely parallel so if there are two errors, I would expect that they might come in a different order on different runs.

Brett
Reply all
Reply to author
Forward
0 new messages