Today I encountered a strange error when I try to compile latest android-chromium.
$gn gen --args='target_os="android"' out/Default
ERROR at //.gn:30:16: Unexpected token '{'
default_args = {
^
$vim .gn
29 # additional logic required by Chrome to set the variables.
30 default_args = {
31 v8_extra_library_files = [
It is very strange, the .gn file looks well.
then I doubt the program comes from gn tool.
$ which gn
/home/lenger/depot_tools/gn
$vim /home/lenger/depot_tools/gn
#!/usr/bin/env bash
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
base_dir=$(dirname "$0")
PYTHONDONTWRITEBYTECODE=1 exec python "$base_dir/gn.py" "$@"
gn just a python wrapper. let's check where the real gn tool is.
$vim /home/lenger/depot_tools/gn.py
def main(args):
bin_path = gclient_utils.GetBuildtoolsPlatformBinaryPath()
if not bin_path:
print >> sys.stderr, ('gn.py: Could not find checkout in any parent of '
'the current path.\nThis must be run inside a '
'checkout.')
return 1
gn_path = os.path.join(bin_path, 'gn' + gclient_utils.GetExeSuffix())
print (gn_path)
if not os.path.exists(gn_path):
print >> sys.stderr, 'gn.py: Could not find gn executable at: %s' % gn_path
return 2
else:
return subprocess.call([gn_path] + args[1:])
The red line was added by me to debug the real gn path.
Then let's run gn command
$gn
/home/lenger/commontrunk/chromium/src/buildtools/linux64/gn
ERROR No command specified.
Ok then I found the cause. the gn tool is in another chromium repo.
It is not in my latest android-chromium and not the latest one.
let's figure out why the build tool select like this.
$vim /home/lenger/depot_tools/gn.py
def main(args):
bin_path = gclient_utils.GetBuildtoolsPlatformBinaryPath()
$ vim ~/depot_tools/gclient_utils.py
def GetBuildtoolsPath():
"""Returns the full path to the buildtools directory.
This is based on the root of the checkout containing the current directory."""
# Overriding the build tools path by environment is highly unsupported and may
# break without warning. Do not rely on this for anything important.
override = os.environ.get('CHROMIUM_BUILDTOOLS_PATH')
if override is not None:
return override
primary_solution = GetPrimarySolutionPath()
if not primary_solution:
return None
buildtools_path = os.path.join(primary_solution, 'buildtools')
if not os.path.exists(buildtools_path):
# Buildtools may be in the gclient root.
gclient_root = FindGclientRoot(os.getcwd())
buildtools_path = os.path.join(gclient_root, 'buildtools')
return buildtools_path
def GetBuildtoolsPlatformBinaryPath():
"""Returns the full path to the binary directory for the current platform."""
buildtools_path = GetBuildtoolsPath()
if not buildtools_path:
return None
I found it.
env CHROMIUM_BUILDTOOLS_PATH might override the build tool path.
then I check my env:
$ env | grep BUILD
CHROMIUM_BUILDTOOLS_PATH=/home/lenger/commontrunk/chromium/src/buildtools/
Oh. I remember now, I had set this env a long time ago in my .bashrc.
I make this strange error by myself.
Ok. easy to fix it now. just unset that env.
$unset CHROMIUM_BUILDTOOLS_PATH
Let's try gn again
$gn gen --args='target_os="android"' out/Default
/home/lenger/android_chromium/src/buildtools/linux64/gn
Done. Made 13942 targets from 1133 files in 6795ms
Good. Everything goes well now.
Subscribe to:
Post Comments (Atom)
fixed: embedded-redis: Unable to run on macOS Sonoma
Issue you might see below error while trying to run embedded-redis for your testing on your macOS after you upgrade to Sonoma. java.la...
-
Refer: https://github.com/bazelbuild/bazel/wiki/Building-with-a-custom-toolchain https://www.tensorflow.org/tutorials/image_recognition
-
Solution react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android...
-
F:\webrowser>react-native run-android Scanning folders for symlinks in F:\webrowser\node_modules (73ms) Starting JS server... Buildin...
No comments:
Post a Comment