A New Collection of Thoughtful Learning Apps — Now Available on iOS & Android

Image
I’m excited to share a set of mobile apps I’ve recently completed and published on both the Google Play Store and the Apple App Store. These apps are designed with a simple goal in mind: to make meaningful, structured content more accessible, whether you’re studying theology or improving your English vocabulary. 📱 Now Available on Both Platforms All apps are live and available for download: Google Play Developer Page: https://play.google.com/store/apps/dev?id=5835943159853189043 Apple App Store Developer Page: https://apps.apple.com/ca/developer/q-z-l-corp/id1888794100 📖 Theology & Confession Study Apps For those interested in Reformed theology and classical Christian teachings, I’ve developed a series of apps that present foundational texts in a clean, focused reading format: The Belgic Confession Canons of Dort Heidelberg Catechism Westminster Shorter Catechism Each app is designed to provide a distraction-free experience, making it easier to read, reflect, and revisit these im...

How to fix gn Unexpected token error

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. 




❤️ Support This Blog


If this post helped you, you can support my writing with a small donation. Thank you for reading.


Comments

Popular Posts

Fix “A problem occurred starting process 'command node'” in Android Studio for React Native

Fix up watchman issue with Ghost

Using Mutual TLS (mTLS) in Next.js (Server-Side Only)