New issue
Advanced search Search tips

Issue 680069 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

Hermetic build prevents using the same checkout to build for ios and mac

Project Member Reported by sdefresne@chromium.org, Jan 11 2017

Issue description

I used to have the following in my .gclient file:

$ cat .gclient
solutions = [
  {
    "name"        : "src",
    "url"         : "https://chromium.googlesource.com/chromium/src.git",
    "deps_file"   : "DEPS",
    "managed"     : False,
    "custom_deps" : {},
    "safesync_url": "",
  },
]
target_os = ["ios", "mac"]

This allowed me to use the same tree to build for iOS and macOS. However, with hermetic build, I now get failures when trying to generate for mac:

$ gn gen out/tools --args='target_os="mac"'
ERROR at //build/config/mac/mac_sdk.gni:61:5: Script returned non-zero exit code.
    exec_script("//build/mac/find_sdk.py", find_sdk_args, "list lines")
    ^----------
Current dir: /Users/sdefresne/Developer/chromium/src/out/tools/
Command: python -- /Users/sdefresne/Developer/chromium/src/build/mac/find_sdk.py --print_sdk_path --developer_dir /Users/sdefresne/Developer/chromium/src/build/mac_files/Xcode.app 10.10
Returned 1.
stderr:

Traceback (most recent call last):
  File "/Users/sdefresne/Developer/chromium/src/build/mac/find_sdk.py", line 89, in <module>
    print main()
  File "/Users/sdefresne/Developer/chromium/src/build/mac/find_sdk.py", line 57, in main
    sdks = [re.findall('^MacOSX(10\.\d+)\.sdk$', s) for s in os.listdir(sdk_dir)]
OSError: [Errno 2] No such file or directory: '/Users/sdefresne/Developer/chromium/src/build/mac_files/Xcode.app/Platforms/MacOSX.platform/Developer/SDKs'

See //build/toolchain/mac/BUILD.gn:14:1: whence it was imported.
import("//build/config/mac/mac_sdk.gni")
^--------------------------------------
See //BUILD.gn:74:1: which caused the file to be included.
group("gn_all") {
^----------------

Investigating, it looks like the build/mac_files are not downloaded because the script src/build/mac_toolchain.py looks whether "ios" is in target_os but the src/build/mac/find_sdk.py script is still invoked with --developer_dir path pointing to src/build/mac_files.

use_system_xcode is however initialized by invoking build/mac/should_use_hermetic_xcode.py with target_os as a parameter (hence "mac") in my case.

I think we can solve this by changing hermetic_xcode_path from src/build/mac_files/Xcode.app to src/build/${target_os}_files/Xcode.app and modifying src/build/mac_toolchain.py to download ios/mac hermetic builds to src/build/${os}_files. It can use the same condition to detect whether to omit downloading the files for ios.
 
Owner: sdefresne@chromium.org
Status: Started (was: Untriaged)
Only the bots should be using iOS hermetic and they don't switch back and forth, right?  

Logically this does make sense, but I'm not sure if anyone should ever have both mac_files and ios_files at the same time, unless they are forcing hermetic locally.

Maybe mac_toolchain.py should look at the gn_arg target_os and not the gclient value?
The script cannot look at gn_args as it does not exists yet. Only option is to look at target_os and maybe download both SDK. Should only happens for developer that set FORCE_MAC_TOOLCHAIN=1 and use target_os=["ios", "mac"] which should be a minority.

Most developer won't define FORCE_MAC_TOOLCHAIN=1 or will only have one entry in target_os. In that case, the script will behave as it does currently.
Project Member

Comment 4 by bugdroid1@chromium.org, Jan 12 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/aacc2845873563b3361c0c9b2a7bec6ead4cd155

commit aacc2845873563b3361c0c9b2a7bec6ead4cd155
Author: sdefresne <sdefresne@chromium.org>
Date: Thu Jan 12 10:33:37 2017

Allow using the same checkout to build both iOS and macOS.

As it is possible to specify multiple value for target_os in
.gclient, update the script build/mac_toolchain.py to download
the file for the hermetic build on all those OSes. Change the
path where the hermetic files are downloaded to use different
path for each OS.

BUG= 680069 

Review-Url: https://codereview.chromium.org/2626063002
Cr-Commit-Position: refs/heads/master@{#443198}

[modify] https://crrev.com/aacc2845873563b3361c0c9b2a7bec6ead4cd155/.gitignore
[modify] https://crrev.com/aacc2845873563b3361c0c9b2a7bec6ead4cd155/build/mac_toolchain.py
[modify] https://crrev.com/aacc2845873563b3361c0c9b2a7bec6ead4cd155/build/toolchain/toolchain.gni

Status: Fixed (was: Started)

Sign in to add a comment