Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'aarch64' cpu = {'amd64': 'amd64', 'arm64': 'arm64', 'x86_64': 'amd64'}[platform.machine().lower()] #1

Open
liurunjieDW opened this issue May 29, 2023 · 6 comments
Labels
question Further information is requested

Comments

@liurunjieDW
Copy link

liurunjieDW commented May 29, 2023

my .build.sh

#!/bin/bash
cmake -DCMAKE_BUILD_TYPE=Release  "-DCMAKE_PREFIX_PATH=/usr/lib/llvm-14"  -DCMAKE_INSTALL_PREFIX=../install ../SkottieWrapper

after i exec .build.sh, i exec make Build_Skia
then i encounter the issue:

third_party/externals/icu            > dbd3825b31041d782c5b504c59dcfb5ac7dda08c
Traceback (most recent call last):
  File "bin/fetch-gn", line 26, in <module>
    cpu = {'amd64': 'amd64', 'arm64': 'arm64', 'x86_64': 'amd64'}[platform.machine().lower()]
KeyError: 'aarch64'
Traceback (most recent call last):
  File "tools/git-sync-deps", line 266, in <module>
    exit(main(sys.argv[1:]))
  File "tools/git-sync-deps", line 261, in main
    os.path.join(os.path.dirname(deps_file_path), 'bin', 'fetch-gn')])
  File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python2', 'bin/fetch-gn']' returned non-zero exit status 1
make[3]: *** [third_party/CMakeFiles/Build_Skia.dir/build.make:73: third_party/Skia] Error 1
make[2]: *** [CMakeFiles/Makefile2:142: third_party/CMakeFiles/Build_Skia.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:149: third_party/CMakeFiles/Build_Skia.dir/rule] Error 2

this is my env

dw@dw-Parallels-ARM-Virtual-Machine:~/SkottieWrapper/build$ uname -r
5.19.0-42-generic
dw@dw-Parallels-ARM-Virtual-Machine:~/SkottieWrapper/build$ uname -a
Linux dw-Parallels-ARM-Virtual-Machine 5.19.0-42-generic #43~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Apr 21 16:50:55 UTC 2 aarch64 aarch64 aarch64 GNU/Linux
dw@dw-Parallels-ARM-Virtual-Machine:~/SkottieWrapper/build$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.1 LTS
Release:	22.04
Codename:	jammy

@xspeed1989 xspeed1989 added the question Further information is requested label May 30, 2023
@xspeed1989
Copy link
Owner

I need more info about this issue.
Post content of bin/fetch-gn here please

@liurunjieDW
Copy link
Author

I need more info about this issue. Post content of bin/fetch-gn here please
fine,it's below

#!/usr/bin/env python

# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import os
import platform
import shutil
import stat
import sys
import tempfile
import zipfile

if sys.version_info[0] < 3:
  from urllib2 import urlopen
else:
  from urllib.request import urlopen

os.chdir(os.path.join(os.path.dirname(__file__), os.pardir))

gnzip = os.path.join(tempfile.mkdtemp(), 'gn.zip')
with open(gnzip, 'wb') as f:
  OS  = {'darwin': 'mac', 'linux': 'linux', 'linux2': 'linux', 'win32': 'windows'}[sys.platform]
  cpu = {'amd64': 'amd64', 'arm64': 'arm64', 'x86_64': 'amd64', 'aarch64': 'arm64'}[platform.machine().lower()]

  rev = 'd62642c920e6a0d1756316d225a90fd6faa9e21e'
  url = 'https://chrome-infra-packages.appspot.com/dl/gn/gn/{}-{}/+/git_revision:{}'.format(
          OS,cpu,rev)
  f.write(urlopen(url).read())

gn = 'gn.exe' if 'win32' in sys.platform else 'gn'
with zipfile.ZipFile(gnzip, 'r') as f:
  f.extract(gn, 'bin')

gn = os.path.join('bin', gn)

os.chmod(gn, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR |
             stat.S_IRGRP                | stat.S_IXGRP |
             stat.S_IROTH                | stat.S_IXOTH )

# We'll also copy to a path that depot_tools' GN wrapper will expect to find the binary.
copy_path = 'buildtools/linux64/gn' if 'linux'  in sys.platform else \
            'buildtools/mac/gn'     if 'darwin' in sys.platform else \
            'buildtools/win/gn.exe'
if os.path.isdir(os.path.dirname(copy_path)):
  shutil.copy(gn, copy_path)

@liurunjieDW
Copy link
Author

unme -a
Linux dw-Parallels-ARM-Virtual-Machine 5.19.0-42-generic #43~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Apr 21 16:50:55 UTC 2 aarch64 aarch64 aarch64 GNU/Linux

@xspeed1989
Copy link
Owner

I need more info about this issue. Post content of bin/fetch-gn here please
fine,it's below

#!/usr/bin/env python

# Copyright 2016 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import os
import platform
import shutil
import stat
import sys
import tempfile
import zipfile

if sys.version_info[0] < 3:
  from urllib2 import urlopen
else:
  from urllib.request import urlopen

os.chdir(os.path.join(os.path.dirname(__file__), os.pardir))

gnzip = os.path.join(tempfile.mkdtemp(), 'gn.zip')
with open(gnzip, 'wb') as f:
  OS  = {'darwin': 'mac', 'linux': 'linux', 'linux2': 'linux', 'win32': 'windows'}[sys.platform]
  cpu = {'amd64': 'amd64', 'arm64': 'arm64', 'x86_64': 'amd64', 'aarch64': 'arm64'}[platform.machine().lower()]

  rev = 'd62642c920e6a0d1756316d225a90fd6faa9e21e'
  url = 'https://chrome-infra-packages.appspot.com/dl/gn/gn/{}-{}/+/git_revision:{}'.format(
          OS,cpu,rev)
  f.write(urlopen(url).read())

gn = 'gn.exe' if 'win32' in sys.platform else 'gn'
with zipfile.ZipFile(gnzip, 'r') as f:
  f.extract(gn, 'bin')

gn = os.path.join('bin', gn)

os.chmod(gn, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR |
             stat.S_IRGRP                | stat.S_IXGRP |
             stat.S_IROTH                | stat.S_IXOTH )

# We'll also copy to a path that depot_tools' GN wrapper will expect to find the binary.
copy_path = 'buildtools/linux64/gn' if 'linux'  in sys.platform else \
            'buildtools/mac/gn'     if 'darwin' in sys.platform else \
            'buildtools/win/gn.exe'
if os.path.isdir(os.path.dirname(copy_path)):
  shutil.copy(gn, copy_path)

cpu = {'amd64': 'amd64', 'arm64': 'arm64', 'x86_64': 'amd64', 'aarch64': 'arm64'}[platform.machine().lower()]

Is aarch64 added to the cpu list by yourself?

@liurunjieDW
Copy link
Author

liurunjieDW commented May 30, 2023

'aarch64': 'arm64'

yes i added 'aarch64': 'arm64' to the cpu list ,if it wasn't ,
you would encouter the issue,

third_party/externals/icu            > dbd3825b31041d782c5b504c59dcfb5ac7dda08c
Traceback (most recent call last):
  File "bin/fetch-gn", line 26, in <module>
    cpu = {'amd64': 'amd64', 'arm64': 'arm64', 'x86_64': 'amd64'}[platform.machine().lower()]
KeyError: 'aarch64'

@xspeed1989
Copy link
Owner

xspeed1989 commented May 31, 2023

'aarch64': 'arm64'

yes i added 'aarch64': 'arm64' to the cpu list ,if it wasn't , you would encouter the issue,

third_party/externals/icu            > dbd3825b31041d782c5b504c59dcfb5ac7dda08c
Traceback (most recent call last):
  File "bin/fetch-gn", line 26, in <module>
    cpu = {'amd64': 'amd64', 'arm64': 'arm64', 'x86_64': 'amd64'}[platform.machine().lower()]
KeyError: 'aarch64'

Does it works fine?
I think this is an issue of ICU or gn, you can report the issue to upstream,
maybe I will make a patch then apply it when build running

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants