Chromium for iOS

317 views
Skip to first unread message

Growtopia Jaw

unread,
Feb 25, 2022, 5:52:40 PM2/25/22
to Chromium-dev
I'm compiling Chromium for iOS arm64 on macOS Big Sur 11.6 with Xcode 13.2

Running hooks: 13% (16/122) mac_toolchain
________ running 'python3 src/build/mac_toolchain.py' in '/Volumes/chromium/chromium'
Skipping Mac toolchain installation for mac
Running hooks: 69% (85/122) setup_gn
________ running 'vpython src/ios/build/tools/setup-gn.py' in '/Volumes/chromium/chromium'
Traceback (most recent call last):
File "src/ios/build/tools/setup-gn.py", line 7, in <module>
import configparser
ImportError: No module named configparser
Error: Command 'vpython src/ios/build/tools/setup-gn.py' returned non-zero exit status 1 in /Volumes/chromium/chromium
Traceback (most recent call last):
File "src/ios/build/tools/setup-gn.py", line 7, in <module>
import configparser
ImportError: No module named configparser

Kept getting this error when running gclient runhooks.

Growtopia Jaw

unread,
Feb 28, 2022, 12:11:50 AM2/28/22
to Chromium-dev, Growtopia Jaw
Submitted a bug report with proposed solution. https://bugs.chromium.org/p/chromium/issues/detail?id=1301223

Takuto Ikuta

unread,
Feb 28, 2022, 12:59:00 AM2/28/22
to growto...@gmail.com, Chromium-dev
I'm wondering where setup-gn.py is invoked from as https://chromium.googlesource.com/chromium/src/+/refs/tags/98.0.4758.97/DEPS doesn't have the hook using vpython?

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/063b7567-7fb3-40d6-869f-1201f9b56123n%40chromium.org.

Growtopia Jaw

unread,
Feb 28, 2022, 12:25:27 PM2/28/22
to Chromium-dev, tik...@chromium.org, Chromium-dev, Growtopia Jaw
65A0BF65-7EBD-40E0-B7BD-5A2EDEA5F4AE.png
As far as I know, running "gclient sync --no-history --shallow" triggers the setup-gn.py file

Hope this screenshot might help.

Takuto Ikuta

unread,
Feb 28, 2022, 7:50:46 PM2/28/22
to Growtopia Jaw, Chromium-dev
Ah, could you use python3 there then?

2022年3月1日(火) 5:07 Growtopia Jaw <growto...@gmail.com>:
I've finally figured out how the setup-gn.py got invoked. Basically, I followed this guide on compiling Chromium for iOS, https://chromium.googlesource.com/chromium/src/+/main/docs/ios/build_instructions.md

Below, the guide specified that "You can add a custom hook to .gclient file to configure setup-gn.py to be run as part of gclient runhooks."

This is what the .gclient file looks like
carbon.png

Takuto Ikuta

unread,
Feb 28, 2022, 8:34:44 PM2/28/22
to Growtopia Jaw, Chromium-dev
I made https://crrev.com/c/3495884 to update instructions.

Takuto Ikuta

unread,
Feb 28, 2022, 9:24:18 PM2/28/22
to Growtopia Jaw, Chromium-dev
I think python3 in the custom hook is not related to the python version in your error?

On Tue, Mar 1, 2022 at 11:14 AM Growtopia Jaw <growto...@gmail.com> wrote:
I did try forcing it to use python3 by setting "VPYTHON_BYPASS=manually managed python not supported by chrome operations" environment variable but this resulted in an error where gsutil requires python 2.6 or 2.7

So I guess that would be a no.

Screenshot of the error is attached as a reference
Screenshot 2022-03-01 at 10.11.37 AM.png

Growtopia Jaw

unread,
Mar 1, 2022, 3:26:49 PM3/1/22
to Chromium-dev, Growtopia Jaw, tik...@chromium.org, Chromium-dev
I've finally figured out how the setup-gn.py got invoked. Basically, I followed this guide on compiling Chromium for iOS, https://chromium.googlesource.com/chromium/src/+/main/docs/ios/build_instructions.md

Below, the guide specified that "You can add a custom hook to .gclient file to configure setup-gn.py to be run as part of gclient runhooks."

This is what the .gclient file looks like
carbon.png

Growtopia Jaw

unread,
Mar 1, 2022, 3:26:49 PM3/1/22
to Chromium-dev, tik...@chromium.org, Chromium-dev, Growtopia Jaw
I did try forcing it to use python3 by setting "VPYTHON_BYPASS=manually managed python not supported by chrome operations" environment variable but this resulted in an error where gsutil requires python 2.6 or 2.7

So I guess that would be a no.

Screenshot of the error is attached as a reference
Screenshot 2022-03-01 at 10.11.37 AM.png
On Tuesday, March 1, 2022 at 9:34:44 AM UTC+8 tik...@chromium.org wrote:

Growtopia Jaw

unread,
Mar 1, 2022, 3:26:55 PM3/1/22
to Takuto Ikuta, Chromium-dev
I misunderstood your question. Unfortunately, my build script didn't make it far enough into the build to test if setup-gn.py will run with python3. I'll update this thread with more information once I succeed in building Chromium for iOS.

Growtopia Jaw

unread,
Mar 1, 2022, 3:27:00 PM3/1/22
to Takuto Ikuta, Chromium-dev
I ran gclient runhooks with both python2 and python3 and it seems that both returned an error.

Error with python2 (when .gclient is set to use python)
Running hooks:  13% (16/122) mac_toolchain                
________ running 'python3 src/build/mac_toolchain.py' in '/Volumes/Xcode/chromium'

Skipping Mac toolchain installation for mac
Hook 'python3 src/testing/generate_location_tags.py --out src/testing/location_tags.json' took 137.84 secs

Running hooks:  69% (85/122) setup_gn                        
________ running 'vpython src/ios/build/tools/setup-gn.py' in '/Volumes/Xcode/chromium'

Traceback (most recent call last):
  File "src/ios/build/tools/setup-gn.py", line 8, in <module>
    import convert_gn_xcodeproj
  File "/Volumes/Xcode/chromium/src/ios/build/tools/convert_gn_xcodeproj.py", line 55, in <module>
    @functools.lru_cache
AttributeError: 'module' object has no attribute 'lru_cache'
Error: Command 'vpython src/ios/build/tools/setup-gn.py' returned non-zero exit status 1 in /Volumes/Xcode/chromium

Traceback (most recent call last):
  File "src/ios/build/tools/setup-gn.py", line 8, in <module>
    import convert_gn_xcodeproj
  File "/Volumes/Xcode/chromium/src/ios/build/tools/convert_gn_xcodeproj.py", line 55, in <module>
    @functools.lru_cache
AttributeError: 'module' object has no attribute 'lru_cache'

Error with python3 (when .gclient is set to use python3)
Running hooks:  13% (16/122) mac_toolchain                
________ running 'python3 src/build/mac_toolchain.py' in '/Volumes/Xcode/chromium'

Skipping Mac toolchain installation for mac
Running hooks:  69% (85/122) setup_gn                                                  
________ running 'python3 src/ios/build/tools/setup-gn.py' in '/Volumes/Xcode/chromium'

Traceback (most recent call last):
  File "/Volumes/Xcode/chromium/src/ios/build/tools/setup-gn.py", line 401, in <module>
    sys.exit(Main(sys.argv[1:]))
  File "/Volumes/Xcode/chromium/src/ios/build/tools/setup-gn.py", line 395, in Main
    GenerateXcodeProject(gn_path, args.root, args.proj_name, out_dir, settings)
  File "/Volumes/Xcode/chromium/src/ios/build/tools/setup-gn.py", line 263, in GenerateXcodeProject
    convert_gn_xcodeproj.ConvertGnXcodeProject(
  File "/Volumes/Xcode/chromium/src/ios/build/tools/convert_gn_xcodeproj.py", line 489, in ConvertGnXcodeProject
    UpdateXcodeProject(
  File "/Volumes/Xcode/chromium/src/ios/build/tools/convert_gn_xcodeproj.py", line 328, in UpdateXcodeProject
    mapping = project.GetHostMappingForXCTests()
  File "/Volumes/Xcode/chromium/src/ios/build/tools/convert_gn_xcodeproj.py", line 257, in GetHostMappingForXCTests
    test_host_name = build_config['buildSettings']['TEST_TARGET_NAME']
KeyError: 'TEST_TARGET_NAME'
Error: Command 'python3 src/ios/build/tools/setup-gn.py' returned non-zero exit status 1 in /Volumes/Xcode/chromium

Traceback (most recent call last):
  File "/Volumes/Xcode/chromium/src/ios/build/tools/setup-gn.py", line 401, in <module>
    sys.exit(Main(sys.argv[1:]))
  File "/Volumes/Xcode/chromium/src/ios/build/tools/setup-gn.py", line 395, in Main
    GenerateXcodeProject(gn_path, args.root, args.proj_name, out_dir, settings)
  File "/Volumes/Xcode/chromium/src/ios/build/tools/setup-gn.py", line 263, in GenerateXcodeProject
    convert_gn_xcodeproj.ConvertGnXcodeProject(
  File "/Volumes/Xcode/chromium/src/ios/build/tools/convert_gn_xcodeproj.py", line 489, in ConvertGnXcodeProject
    UpdateXcodeProject(
  File "/Volumes/Xcode/chromium/src/ios/build/tools/convert_gn_xcodeproj.py", line 328, in UpdateXcodeProject
    mapping = project.GetHostMappingForXCTests()
  File "/Volumes/Xcode/chromium/src/ios/build/tools/convert_gn_xcodeproj.py", line 257, in GetHostMappingForXCTests
    test_host_name = build_config['buildSettings']['TEST_TARGET_NAME']
KeyError: 'TEST_TARGET_NAME'

Hook 'python3 src/ios/build/tools/setup-gn.py' took 119.39 secs

Sylvain Defresne

unread,
Mar 3, 2022, 5:15:52 AM3/3/22
to growto...@gmail.com, Takuto Ikuta, Chromium-dev
The error when running with python3 is caused by the script ios/build/tools/convert_gn_xcodeproj.py inability to parse the Xcode project generated by `gn gen --ide=xcode`. This error does not reproduce for other developers, so what version of `python3` is in your PATH and do you have any local modifications?

BTW, you don't need to use setup-gn.py to build Chrome on iOS. So, if you just want to build you can remove the hook from .gclient.
-- Sylvain

Reply all
Reply to author
Forward
0 new messages