google / android-emulator-container-scripts

Apache License 2.0
1.89k stars 265 forks source link

Error when trying to make emulator assessable on web #155

Open jduncanRadBlue opened 4 years ago

jduncanRadBlue commented 4 years ago

When running the following command: docker-compose -f js/docker/docker-compose.yaml up

this error is displayed in the terminal:

Pulling nginx (emulator_nginx:latest)... ERROR: pull access denied for emulator_nginx, repository does not exist or may require 'docker login': denied: requested access to the resource is denied.

pokowaka commented 4 years ago

Docker seems to think that you do not have the image available locally. Can you try to run ./create_webcontainer.sh -s. This will try to launch the web container after building it locally, making sure the needed images are available.

jduncanRadBlue commented 4 years ago

As soon as i ran that, this error popped up in the beginning of the terminal output.

(venv) Jennifers-MBP:android-emulator-container-scripts jduncan$ ./create_web_container.sh -s
rm -rf /Users/jduncan/IdeaProjects/tak-test/android-emulator-container-scripts/js/android-emulator-webrtc/src/proto/
rm -rf emulator
/Library/Developer/CommandLineTools/usr/bin/make -C android-emulator-webrtc build
make[1]: pkg-config: Command not found
g++ -std=c++11 -I/include -pthread  -c -o protoc-plugin/grpc_generator.o protoc-plugin/grpc_generator.cc
protoc-plugin/grpc_generator.cc:19:10: fatal error: 'google/protobuf/compiler/code_generator.h' file not found
#include <google/protobuf/compiler/code_generator.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[1]: *** [protoc-plugin/grpc_generator.o] Error 1
make: *** [deps] Error 2
I0703 09:00:47.328188 4546840000 gen-passwords.py:37] jduncan : hello
Building front-envoy
Step 1/6 : FROM envoyproxy/envoy:v1.12.0
 ---> 56683ef746a8

Then this error came up:

Step 7/10 : RUN npm run build
 ---> Running in 1d69e6ff6118

> js@0.1.0 build /app
> react-scripts build

Creating an optimized production build...
Failed to compile.

./src/components/emulator_screen.js
Cannot find module: 'android-emulator-webrtc/emulator'. Make sure this package is installed.

You can install this package by running: npm install android-emulator-webrtc/emulator.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! js@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the js@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-07-03T13_03_22_612Z-debug.log
ERROR: Service 'nginx' failed to build: The command '/bin/sh -c npm run build' returned a non-zero code: 1
Building nginx
pokowaka commented 4 years ago

Some things to note:

jduncanRadBlue commented 4 years ago

Thank you @pokowaka!

I have put it in an ec2 instance with ubuntu rather than try to push forward on my mac.

Is it necessary to follow all of the steps outlined in the README to get the emulator to show up on the web? I'm starting from the beginning of the doc. I have run out of disk space on the ec2 instance with 8G and 30G allocated.

I'm getting the following error when running the command

./create_web_container.sh

it seems to install the webrtc, envoy, emulator, jwt_signer, nginx, and then during the nginx build an error is thrown:

Step 7/10 : RUN npm run build
 ---> Running in 6058761edb81

> js@0.1.0 build /app
> react-scripts build

Creating an optimized production build...
Failed to compile.

./src/components/emulator_screen.js
Cannot find module: 'android-emulator-webrtc/emulator'. Make sure this package is installed.

You can install this package by running: npm install android-emulator-webrtc/emulator.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! js@0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the js@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-07-06T19_52_13_040Z-debug.log
ERROR: Service 'nginx' failed to build: The command '/bin/sh -c npm run build' returned a non-zero code: 1
Created container, you can launch it as follows:
docker-compose -f js/docker/docker-compose-build.yaml up

The webrtc package has been installed, and if I run the npm command to install again, the same error is thrown.

Any ideas on what is happening here?

pokowaka commented 4 years ago

We are using yalc to install a locally build package. Maybe yalc needs to be installed with the -g flag. You could try this:

 npm install -g yalc

Note: You must use an ec2 instance with nested virtualization (a1.metal). Make sure that /dev/kvm is available and usable on your ec2 instance before you proceed.

jduncanRadBlue commented 4 years ago

@pokowaka , Thanks! I'm getting further!

I have a new ec2 instance set up on a1.metal and have a new error message for you when running the ./create_web_container.sh command.

see console error below...

npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code EMISSINGARG

npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror     at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
npm ERR! typeerror     at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror     at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror     at /usr/share/npm/lib/install/deps.js:457:7
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror     at /usr/share/npm/lib/fetch-package-metadata.js:37:12
npm ERR! typeerror     at addRequestedAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:82:5)
npm ERR! typeerror     at returnAndAddMetadata (/usr/share/npm/lib/fetch-package-metadata.js:117:7)
npm ERR! typeerror     at pickVersionFromRegistryDocument (/usr/share/npm/lib/fetch-package-metadata.js:134:20)
npm ERR! typeerror     at /usr/share/npm/node_modules/iferr/index.js:13:50
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror     <http://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/ubuntu/android-emulator-container-scripts/js/npm-debug.log
Makefile:27: recipe for target 'deps' failed
make: *** [deps] Error 1
make: Leaving directory '/home/ubuntu/android-emulator-container-scripts/js'
  ERROR: Command errored out with exit status 1:
   command: /home/ubuntu/android-emulator-container-scripts/venv/bin/python3 /home/ubuntu/android-emulator-container-scripts/venv/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-zu31eu05/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.8,!=1.11.3; platform_python_implementation != '"'"'PyPy'"'"''
       cwd: None
  Complete output (74 lines):
  Collecting setuptools>=40.6.0
    Using cached setuptools-49.1.0-py3-none-any.whl (789 kB)
  Collecting wheel
    Using cached wheel-0.34.2-py2.py3-none-any.whl (26 kB)
  Collecting cffi!=1.11.3,>=1.8
    Using cached cffi-1.14.0.tar.gz (463 kB)
  Collecting pycparser
    Using cached pycparser-2.20-py2.py3-none-any.whl (112 kB)
  Using legacy setup.py install for cffi, since package 'wheel' is not installed.
  Installing collected packages: setuptools, wheel, pycparser, cffi
      Running setup.py install for cffi: started
      Running setup.py install for cffi: finished with status 'error'
      ERROR: Command errored out with exit status 1:
       command: /home/ubuntu/android-emulator-container-scripts/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-849y67iu/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-849y67iu/cffi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-6xmdvq0d/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-zu31eu05/overlay --compile --install-headers /home/ubuntu/android-emulator-container-scripts/venv/include/site/python3.6/cffi
           cwd: /tmp/pip-install-849y67iu/cffi/
      Complete output (56 lines):
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'libffi' found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'libffi' found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'libffi' found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'libffi' found
      Package libffi was not found in the pkg-config search path.
      Perhaps you should add the directory containing `libffi.pc'
      to the PKG_CONFIG_PATH environment variable
      No package 'libffi' found
      running install
      running build
      running build_py
      creating build
      creating build/lib.linux-aarch64-3.6
      creating build/lib.linux-aarch64-3.6/cffi
      copying cffi/vengine_cpy.py -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/commontypes.py -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/model.py -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/verifier.py -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/lock.py -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/error.py -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/backend_ctypes.py -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/__init__.py -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/pkgconfig.py -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/recompiler.py -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/cffi_opcode.py -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/cparser.py -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/api.py -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/setuptools_ext.py -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/vengine_gen.py -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/ffiplatform.py -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/_cffi_include.h -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/parse_c_type.h -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/_embedding.h -> build/lib.linux-aarch64-3.6/cffi
      copying cffi/_cffi_errors.h -> build/lib.linux-aarch64-3.6/cffi
      running build_ext
      building '_cffi_backend' extension
      creating build/temp.linux-aarch64-3.6
      creating build/temp.linux-aarch64-3.6/c
      aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/home/ubuntu/android-emulator-container-scripts/venv/include -I/usr/include/python3.6m -c c/_cffi_backend.c -o build/temp.linux-aarch64-3.6/c/_cffi_backend.o
      c/_cffi_backend.c:2:10: fatal error: Python.h: No such file or directory
       #include <Python.h>
                ^~~~~~~~~~
      compilation terminated.
      error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
      ----------------------------------------
  ERROR: Command errored out with exit status 1: /home/ubuntu/android-emulator-container-scripts/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-849y67iu/cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-849y67iu/cffi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-6xmdvq0d/install-record.txt --single-version-externally-managed --prefix /tmp/pip-build-env-zu31eu05/overlay --compile --install-headers /home/ubuntu/android-emulator-container-scripts/venv/include/site/python3.6/cffi Check the logs for full command output.
  ----------------------------------------
ERROR: Command errored out with exit status 1: /home/ubuntu/android-emulator-container-scripts/venv/bin/python3 /home/ubuntu/android-emulator-container-scripts/venv/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-zu31eu05/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=40.6.0' wheel 'cffi>=1.8,!=1.11.3; platform_python_implementation != '"'"'PyPy'"'"'' Check the logs for full command output.
Traceback (most recent call last):
  File "gen-passwords.py", line 7, in <module>
    from absl import app, flags, logging
ModuleNotFoundError: No module named 'absl'

any ideas on this one? Thanks so much for your help!

pokowaka commented 4 years ago

It looks like we depend on the python development headers. sudo apt-get install python3-dev might help. If this solved that problem we should probably update the documentation.