Reputation: 141
I'm trying to build AOSP for android 11 on WSL2 Ubuntu 20 on my x86-64 machine (Intel cpu), the build (for aosp_arm64-eng) was successfull but the emulator won't run on my WSL2.
I've tried applying fixes I've found on the net but nothing helped (modifying env variables, installing libs etc. (I haven't tried the LD_PRELOAD trick yet) I think it tries to use the Qt within the repo).
(also see: "Failed to load platform plugin "xcb" " while launching qt5 app on linux without qt installed )
the flow was:
$ repo init -u https://android.googlesource.com/platform/manifest -b android-11.0.0_r50
$ repo sync
$ source build/envsetup.sh
$ lunch aosp_arm64-eng
$ m -j4
[build was successfull]
$ emulator
WARNING: encryption is off
INFO: QtLogger.cpp:68: Warning: could not connect to display ((null):0, (null))
INFO: QtLogger.cpp:68: Info: Could not load the Qt platform plugin "xcb" in "/home/idan/WORKING_DIRECTORY/prebuilts/android-emulator/linux-x86_64/lib64/qt/plugins" even though it was found. ((null):0, (null))
Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb.
((null):0, (null))
INFO: QtLogger.cpp:68: Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb.
((null):0, (null))
Aborted
$ which emulator
/home/idan/WORKING_DIRECTORY/prebuilts/android-emulator/linux-x86_64/emulator
ldd output for emulator:
linux-vdso.so.1 (0x00007ffe785b7000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7e5d483000)
libc++.so.1 => /home/idan/WORKING_DIRECTORY/prebuilts/android-emulator/linux-x86_64/lib64/libc++.so.1 (0x00007f7e5d3a4000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7e5d255000)
libtcmalloc_minimal.so.4 => /home/idan/WORKING_DIRECTORY/prebuilts/android-emulator/linux-x86_64/lib64/libtcmalloc_minimal.so.4 (0x00007f7e5ce64000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f7e5ce59000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7e5ce34000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7e5ce19000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7e5cc27000)
/lib64/ld-linux-x86-64.so.2 (0x00007f7e5d4a2000)
inside the following folder I have these .so files:
~/WORKING_DIRECTORY/prebuilts/android-emulator/linux-x86_64/lib64/qt/lib$ ls
libQt5CoreAndroidEmu.so.5 libQt5SvgAndroidEmu.so.5 libX11-xcb.so.1.0.0 libxcb-xkb.so.1 libxkbcommon-x11.so.0.0.0
libQt5DBusAndroidEmu.so.5 libQt5WidgetsAndroidEmu.so.5 libfontconfig.so.1 libxcb-xkb.so.1.0 libxkbcommon.so
libQt5GuiAndroidEmu.so.5 libQt5XcbQpaAndroidEmu.so.5 libfreetype.so.6 libxcb-xkb.so.1.0.0 libxkbcommon.so.0
libQt5NetworkAndroidEmu.so.5 libX11-xcb.so.1 libsoftokn3.so libxkbcommon-x11.so libxkbcommon.so.0.0.0
libQt5PrintSupportAndroidEmu.so.5 libX11-xcb.so.1.0 libsqlite3.so libxkbcommon-x11.so.0
and inside plugins:
~/WORKING_DIRECTORY/prebuilts/android-emulator/linux-x86_64/lib64/qt/plugins/platforms$ ls
libqxcb.so
$ ldd libqxcb.so
linux-vdso.so.1 (0x00007fff4bf5b000)
libQt5XcbQpaAndroidEmu.so.5 => not found
libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f3b43599000)
libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f3b434da000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f3b434be000)
libQt5GuiAndroidEmu.so.5 => not found
libQt5DBusAndroidEmu.so.5 => not found
libQt5CoreAndroidEmu.so.5 => not found
libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007f3b43434000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f3b43411000)
libX11-xcb.so.1 => /lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f3b4340c000)
libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f3b433e2000)
libXext.so.6 => /lib/x86_64-linux-gnu/libXext.so.6 (0x00007f3b433cd000)
libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007f3b4328e000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f3b4313f000)
libxkbcommon-x11.so.0 => /lib/x86_64-linux-gnu/libxkbcommon-x11.so.0 (0x00007f3b43134000)
libxkbcommon.so.0 => /lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007f3b430f2000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f3b430ec000)
libc++.so.1 => /lib/x86_64-linux-gnu/libc++.so.1 (0x00007f3b4302a000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f3b4300d000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3b42e1b000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f3b42ded000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f3b42de4000)
libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f3b42dac000)
libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007f3b42cf4000)
libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007f3b42cbe000)
/lib64/ld-linux-x86-64.so.2 (0x00007f3b435fe000)
libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007f3b42cb8000)
libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f3b42cb0000)
libxcb-xkb.so.1 => /lib/x86_64-linux-gnu/libxcb-xkb.so.1 (0x00007f3b42c92000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f3b42c87000)
libc++abi.so.1 => /lib/x86_64-linux-gnu/libc++abi.so.1 (0x00007f3b42c4d000)
libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007f3b42c33000)
Upvotes: 2
Views: 3927
Reputation: 1074
Inside plugins when you did ....
$ ldd libqxcb.so
linux-vdso.so.1 (0x00007fff4bf5b000)
libQt5XcbQpaAndroidEmu.so.5 => not found
libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f3b43599000)
libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f3b434da000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f3b434be000)
libQt5GuiAndroidEmu.so.5 => not found
libQt5DBusAndroidEmu.so.5 => not found
libQt5CoreAndroidEmu.so.5 => not found
Many of the libs were not found
. But these libs are present in prebuilts/android-emulator/linux-x86_64/lib64/qt/lib/
.
You just need to copy these libs to /lib/x86_64-linux-gnu/
Upvotes: 0
Reputation: 141
Well, eventually I tried it on a remote ssh connection to a linux server and got a similar error.
The thing is that the emulator need a graphical environment. So either use grab the build output image and use it in Android studio or use a vncserver (and client) to connect to it from a GUI environment.
Upvotes: 0
Reputation: 76797
Assuming WSL2, just try to install it system-wide:
sudo apt-get install libx11-xcb1
or whatever else may provivde libqxcb.so
.
The overall performance may be better when running directly on Windows & HAXM.
I'd just wonder, how well WSL2 would handle KVM, as it may itself be an emulation.
Building on WSL2 isn't the problem, but running the emulator without KVM is:
https://boxofcables.dev/kvm-optimized-custom-kernel-wsl2-2022/
Upvotes: 1