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

How to build for emulator? #58

Open
kunaldawn opened this issue Jan 16, 2022 · 6 comments
Open

How to build for emulator? #58

kunaldawn opened this issue Jan 16, 2022 · 6 comments

Comments

@kunaldawn
Copy link

I followed the instructions provided here https://github.com/kaiostech/B2G#building-and-running-the-android-10-emulator but the buid fails, Can some one direct me the right steps?

@fabricedesre
Copy link

Can you post the build failure details? You can get our mozbuild from https://packages.preprod.kaiostech.com/ndk/v7/mozbuild.tar.bz2 and you should make sure to have rustc 1.56.1 installed.

@kunaldawn
Copy link
Author

Hey @fabricedesre https://packages.preprod.kaiostech.com/ndk/v7/mozbuild.tar.bz2 worked and all LLVM version mismatch errors are resolved. i had to use 1.57.0 rustc though.

@kunaldawn
Copy link
Author

kunaldawn commented Jan 19, 2022

@fabricedesre need a bit help here,

after successful build, i tried to start the emulator, and I get nothing but black screen.

source build/envsetup.sh && lunch aosp_x86_64-eng && emulator -writable-system -selinux permissive

i tried without host gpu, but same black screen

source build/envsetup.sh && lunch aosp_x86_64-eng && emulator -writable-system -selinux permissive -gpu swiftshader_indirect -cores 4 -memory 4096 -debug-init -logcat '*:v' -wipe-data -no-accel

adb logcat

I was able to get adb shell though and logcat shows following error

01-19 11:28:01.414  1737  2121 E eglCodecCommon: glUtilsParamSize: unknow param 0x00008caa
01-19 11:28:01.415  1737  2121 E eglCodecCommon: glUtilsParamSize: unknow param 0x00008caa
01-19 11:28:01.417  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 17 0
01-19 11:28:01.422  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 18 (18) 20 0
01-19 11:28:01.429  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 16 (16) 20 1
01-19 11:28:01.429  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 18 1
01-19 11:28:01.430  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 15 (15) 3 1
01-19 11:28:01.440  1696  1696 W EmuHWC2 : validate: layer 1 CompositionType 1, fallback
01-19 11:28:02.330  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:28:07.348  2262  2262 I chatty  : uid=0(root) /system/bin/sdcard identical 5 lines
01-19 11:28:08.350  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:28:08.385  1737  1737 I Gecko   : *** UTM:SVC TimerManager:notify - fire timerID: addon-background-update-timer intended time: 86400 (1970-01-02T00:00:00.000Z)
01-19 11:28:08.386  1737  1737 I GeckoConsole: UTM:SVC TimerManager:notify - fire timerID: addon-background-update-timer intended time: 86400 (1970-01-02T00:00:00.000Z)
01-19 11:28:08.388  1737  1737 I Gecko   : *** UTM:SVC TimerManager:notify - notified @mozilla.org/addons/integration;1
01-19 11:28:08.389  1737  1737 I GeckoConsole: UTM:SVC TimerManager:notify - notified @mozilla.org/addons/integration;1
01-19 11:28:09.353  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:28:10.356  2262  2262 I chatty  : uid=0(root) /system/bin/sdcard identical 1 line
01-19 11:28:11.358  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:28:11.418  1737  2121 E eglCodecCommon: glUtilsParamSize: unknow param 0x00008caa
01-19 11:28:11.419  1737  2121 E eglCodecCommon: glUtilsParamSize: unknow param 0x00008caa
01-19 11:28:11.420  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 17 0
01-19 11:28:11.421  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 18 (18) 20 0
01-19 11:28:11.427  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 15 (15) 20 1
01-19 11:28:11.452  1696  1696 W EmuHWC2 : validate: layer 1 CompositionType 1, fallback
01-19 11:28:12.361  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:28:14.369  2262  2262 I chatty  : uid=0(root) /system/bin/sdcard identical 2 lines
01-19 11:28:15.371  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:28:15.791  1961  1961 E netmgr  : Failed to open QEMU pipe 'qemud:network': Invalid argument
01-19 11:28:15.792  1961  1961 E netmgr  : WifiForwarder unable to open QEMU pipe: Invalid argument
01-19 11:28:16.373  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:28:20.390  2262  2262 I chatty  : uid=0(root) /system/bin/sdcard identical 4 lines
01-19 11:28:21.392  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:28:21.429  1737  2121 E eglCodecCommon: glUtilsParamSize: unknow param 0x00008caa
01-19 11:28:21.430  1737  2121 E eglCodecCommon: glUtilsParamSize: unknow param 0x00008caa
01-19 11:28:21.432  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 17 0
01-19 11:28:21.433  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 18 (18) 20 0
01-19 11:28:21.438  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 15 (15) 20 1
01-19 11:28:21.450  1696  1729 W EmuHWC2 : validate: layer 1 CompositionType 1, fallback
01-19 11:28:22.395  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:28:30.416  2262  2262 I chatty  : uid=0(root) /system/bin/sdcard identical 8 lines
01-19 11:28:31.418  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:28:31.427  1737  2121 E eglCodecCommon: glUtilsParamSize: unknow param 0x00008caa
01-19 11:28:31.429  1737  2121 E eglCodecCommon: glUtilsParamSize: unknow param 0x00008caa
01-19 11:28:31.431  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 17 0
01-19 11:28:31.432  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 18 (18) 20 0
01-19 11:28:31.437  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 15 (15) 20 1
01-19 11:28:31.444  1696  1696 W EmuHWC2 : validate: layer 1 CompositionType 1, fallback
01-19 11:28:32.420  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:28:39.442  2262  2262 I chatty  : uid=0(root) /system/bin/sdcard identical 7 lines
01-19 11:28:40.446  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:28:41.423  1737  2121 E eglCodecCommon: glUtilsParamSize: unknow param 0x00008caa
01-19 11:28:41.429  1737  2121 E eglCodecCommon: glUtilsParamSize: unknow param 0x00008caa
01-19 11:28:41.431  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 17 0
01-19 11:28:41.432  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 18 (18) 20 0
01-19 11:28:41.436  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 15 (15) 20 1
01-19 11:28:41.444  1696  1696 W EmuHWC2 : validate: layer 1 CompositionType 1, fallback
01-19 11:28:41.450  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:28:42.451  2262  2262 I chatty  : uid=0(root) /system/bin/sdcard identical 1 line
01-19 11:28:43.453  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:28:44.379  1737  1737 I /system/bin/sh: type=1400 audit(0.0:119): avc: denied { read } for comm=4E65746C696E6B204D6F6E69746F72 scontext=u:r:init:s0 tcontext=u:r:init:s0 tclass=netlink_route_socket permissive=1
01-19 11:28:44.455  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:28:49.473  2262  2262 I chatty  : uid=0(root) /system/bin/sdcard identical 5 lines
01-19 11:28:50.478  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:28:51.429  1737  2121 E eglCodecCommon: glUtilsParamSize: unknow param 0x00008caa
01-19 11:28:51.430  1737  2121 E eglCodecCommon: glUtilsParamSize: unknow param 0x00008caa
01-19 11:28:51.431  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 17 0
01-19 11:28:51.432  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 18 (18) 20 0
01-19 11:28:51.436  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 15 (15) 20 1
01-19 11:28:51.449  1696  1729 W EmuHWC2 : validate: layer 1 CompositionType 1, fallback
01-19 11:28:51.480  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:28:59.503  2262  2262 I chatty  : uid=0(root) /system/bin/sdcard identical 8 lines
01-19 11:29:00.506  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory
01-19 11:29:01.434  1737  2121 E eglCodecCommon: glUtilsParamSize: unknow param 0x00008caa
01-19 11:29:01.440  1737  2121 E eglCodecCommon: glUtilsParamSize: unknow param 0x00008caa
01-19 11:29:01.442  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 17 0
01-19 11:29:01.448  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 18 (18) 20 0
01-19 11:29:01.452  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 16 (16) 20 1
01-19 11:29:01.452  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 18 1
01-19 11:29:01.453  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 15 (15) 3 1
01-19 11:29:01.464  1696  1729 W EmuHWC2 : validate: layer 1 CompositionType 1, fallback
01-19 11:29:01.511  2262  2262 E cutils  : Failed to read /data/.layout_version: No such file or directory

adb shell b2g-info

some times it reports two b2g main process

generic_x86_64:/ # b2g-info                                                                                                                                                          
Failed to match '2434 (Renderer) t 1 2316 0 0 -1 1077952576 174 0 0 0 0 0 0 0 20 0 1 0 2037 4672315392 12478 18446744073709551615 107085656367104 107085656385280 140737442798032 0 0 0 0 4096 1073792767 1 0 0 17 1 0 0 0 0 0 107085656394784 107085656394792 107085687222272 140737442801778 140737442801794 140737442801794 140737442803688 0
' with '^([0-9]+) \((.*)\) [A-Z] ([0-9]+) [0-9]+ [0-9]+ [0-9]+ -?[0-9]+ [0-9]+ [0-9]+ [0-9]+ [0-9]+ [0-9]+ ([0-9]+) ([0-9]+) [0-9]+ [0-9]+ [0-9]+ (-?[0-9]+)',returning 1.
Fatal error: Two B2G main processes found (pids 2316 and 2434)
2|generic_x86_64:/ # b2g-info                                                                                                                                                        
                     |      megabytes     |
      NAME  PID PPID CPU(s) NICE  USS   PSS   RSS SWAP  VSIZE PRIORITY USER
       b2g 2519    1    1.4    0 97.1 125.7 165.6  0.0 4458.3  default root
api-daemon 1693    1    0.4    0 10.7  10.8  15.4  0.0  132.0  unknown root
forkserver 2583 2519    0.3    0 12.6  35.1  67.8  0.0 2263.8  default root

System memory info:

                 Total 1993.0 MB
          Used - cache  245.7 MB
       B2G procs (PSS)  171.6 MB
   Non-B2G procs (PSS)  200.5 MB
                Kernel -126.4 MB
          Free + cache 1747.3 MB
                 Cache  356.8 MB
      Free(other_free) 1390.5 MB
     Cache(other_file)  356.8 MB
             SwapTotal 1494.7 MB
      B2G procs (SWAP)    0.0 MB
  Non-B2G procs (SWAP)    0.0 MB
              SwapFree 1494.7 MB

generic_x86_64:/ # b2g-info                                                                                                                                                          
Fatal error: B2G main process not found.
2|generic_x86_64:/ # b2g-info                                                                                                                                                        
Fatal error: B2G main process not found.
2|generic_x86_64:/ # b2g-info                                                                                                                                                        
                     |      megabytes      |
      NAME  PID PPID CPU(s) NICE   USS   PSS   RSS SWAP  VSIZE PRIORITY USER
       b2g 2722    1    1.0    0 104.4 116.9 140.2  0.0 4423.9  default root
api-daemon 1693    1    0.4    0  10.6  10.8  15.4  0.0  127.8  unknown root
       b2g 2789 2722    0.1    0  10.4  22.5  45.1  0.0  227.8  default root

System memory info:

                 Total 1993.0 MB
          Used - cache  227.7 MB
       B2G procs (PSS)  150.2 MB
   Non-B2G procs (PSS)  201.0 MB
                Kernel -123.5 MB
          Free + cache 1765.2 MB
                 Cache  357.3 MB
      Free(other_free) 1407.9 MB
     Cache(other_file)  357.3 MB
             SwapTotal 1494.7 MB
      B2G procs (SWAP)    0.0 MB
  Non-B2G procs (SWAP)    0.0 MB
              SwapFree 1494.7 MB

generic_x86_64:/ # b2g-info                                                                                                                                                          
Fatal error: B2G main process not found.
2|generic_x86_64:/ # b2g-info                                                                                                                                                        
                     |      megabytes      |
      NAME  PID PPID CPU(s) NICE   USS   PSS   RSS SWAP  VSIZE PRIORITY USER
       b2g 2948    1    0.8    0 107.9 114.1 129.6  0.0 4415.7  default root
api-daemon 1693    1    0.5    0  10.7  10.8  15.4  0.0  127.8  unknown root

System memory info:

                 Total 1993.0 MB
          Used - cache  219.3 MB
       B2G procs (PSS)  125.0 MB
   Non-B2G procs (PSS)  202.4 MB
                Kernel -108.0 MB
          Free + cache 1773.7 MB
                 Cache  362.1 MB
      Free(other_free) 1411.6 MB
     Cache(other_file)  362.1 MB
             SwapTotal 1494.7 MB
      B2G procs (SWAP)    0.0 MB
  Non-B2G procs (SWAP)    0.0 MB
              SwapFree 1494.7 MB

generic_x86_64:/ # 

can you please assist here!

@fabricedesre
Copy link

I'll ask around but I haven't used an emulator build in a while.

@kunaldawn
Copy link
Author

kunaldawn commented Jan 21, 2022

I have tried both arm and x86_64 emulator builds, both have same issue, emulator black screen & below kind of errors

01-19 11:29:01.434  1737  2121 E eglCodecCommon: glUtilsParamSize: unknow param 0x00008caa
01-19 11:29:01.440  1737  2121 E eglCodecCommon: glUtilsParamSize: unknow param 0x00008caa
01-19 11:29:01.442  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 17 0
01-19 11:29:01.448  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 18 (18) 20 0
01-19 11:29:01.452  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 16 (16) 20 1
01-19 11:29:01.452  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 1 (1) 18 1
01-19 11:29:01.453  1737  2121 D eglCodecCommon: setVertexArrayObject: set vao to 15 (15) 3 1

Also tried with different host systems to check if its a GPU driver error, but same behaviour across all host systems.
Also tried with emulator software renderer and host gpu renderer, no success.

I really need help at this point as my team is stuck here. Please help me to resolve this.
Below is the instructions i had to follow to get a build, let me know if i have done something wrong there, i am not sure if i am using correct manifest or not.

Steps followed

Workspace setup

OS : ubuntu 20.04 LTS

install build dependency

sudo apt-get install git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 libncurses5 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig texinfo python python3-pip ccache wget

install mozbuild perbuilt host dependency

cd $HOME	
rm -rf .mozbuild/
wget https://packages.preprod.kaiostech.com/ndk/v7/mozbuild.tar.bz2
tar -xvf mozbuild.tar.bz2

install repo

sudo curl -o /usr/local/bin/repo https://storage.googleapis.com/git-repo-downloads/repo && sudo chmod +x /usr/local/bin/repo


install rust and dependency

export RUSTUP_TOOLCHAIN=1.57.0
​
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
​
rustup install $RUSTUP_TOOLCHAIN
rustup default $RUSTUP_TOOLCHAIN
rustup target add armv7-linux-androideabi
rustup target add thumbv7neon-linux-androideabi
rustup target add x86_64-linux-android
cargo install bindgen
​
(please restart terminal session after this to make $PATH changes available)

install node and dependency

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
​
(please restart terminal session after this to make $PATH changes available)
​
nvm install node
npm install -g yarn

clone & sync B2G repo

cd $HOME
​
git clone https://github.com/kaiostech/B2G.git
cd B2G
​
export GITREPO=https://github.com/kaiostech/manifests.git
export REPO_INIT_FLAGS="--depth=1"
​
./config.sh emulator-10-x86_64
​
cd gonk-misc/api-daemon/support/libsignal-sys
git submodule init
git submodule update
cd ../../../../

patch source

cd $HOME# had to disable SELINUX as it blocks build with errors
cp patches/buildspec.mk B2G/buildspec.mk
cp patches/Android.mk B2G/system/sepolicy/Android.mk
cp patches/sepolicy.mk B2G/gonk-misc/sepolicy/sepolicy.mk

build B2G

export LOCAL_NDK_BASE_URL='ftp://ftp.kaiostech.com/ndk/android-ndk'
export ANDROID_NDK=$HOME/.mozbuild/android-ndk-r21d
export ANDROID_NDK_HOME=$HOME/.mozbuild/android-ndk-r21d
export RUSTUP_TOOLCHAIN=1.57.0
​
cd $HOME/B2G
cd gecko
# choose option 4
./mach bootstrap
cd ..
./build.sh

@kunaldawn
Copy link
Author

@fabricedesre any help regarding running the emulator is deeply appreciated!

@kunaldawn kunaldawn changed the title How to build? How to build for emulator? Jan 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants