Qt: androidextras build failed

Created on 20 Jun 2019  路  5Comments  路  Source: therecipe/qt

I'm using official Qt 5.12.4 and Android NDK 18b (18.1.5063045). Without using any function from package "github.com/therecipe/qt/androidextras" app is built correctly.

Error message dump:

$ qtdeploy build android
ERRO[0008] failed to run command                         _func=RunCmd cmd="go build -p 8 -v -ldflags=all=\"-s\" \"-w\" -o /media/angel/data/angel/Obisoft/sin_cables/qt_golang/ssiManager/deploy/android/libgo_base.so -tags=\"android\" \"minimal\" -pkgdir /home/angel/go/pkg/android_android_arm -buildmode c-shared" dir=/media/angel/data/angel/Obisoft/sin_cables/qt_golang/ssiManager env="SHLVL=2 PYTHONPATH=:/home/angel/Universidad/Obisoft/sin_cables/tensorflow/models/research:/home/angel/Universidad/Obisoft/sin_cables/tensorflow/models/research/slim:/media/angel/data/angel/Obisoft/sin_cables/facenet/src:/home/angel/Universidad/Obisoft/sin_cables/tensorflow/models/research:/home/angel/Universidad/Obisoft/sin_cables/tensorflow/models/research/slim:/media/angel/data/angel/Obisoft/sin_cables/facenet/src GOPATH=/home/angel/go CXX=/home/angel/Android/Sdk/ndk/18.1.5063045/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ NO_AT_BRIDGE=1 DEFAULTS_PATH=/usr/share/gconf//usr/share/xsessions/plasma.default.path XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0 GOARM=7 LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36: XDG_CURRENT_DESKTOP=KDE DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus PATH=/media/angel/data/angel/Obisoft/sin_cables/raspberry/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:/home/angel/cmd:/home/angel/.cargo/bin:/home/angel/.local/bin:/media/angel/data/angel/Obisoft/sin_cables/raspberry/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:/home/angel/cmd:/opt/jdk1.8.0_201/bin:/opt/apache-ant-1.10.5/bin:/opt/apache-maven-3.6.0/bin:/opt/gradle-5.2.1/bin:/opt/go/bin:/home/angel/go/bin:/home/angel/.cargo/bin:/home/angel/.local/bin:/opt/jdk1.8.0_201/bin:/opt/apache-ant-1.10.5/bin:/opt/apache-maven-3.6.0/bin:/opt/gradle-5.2.1/bin:/opt/go/bin:/home/angel/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin GDK_SCALE=2 GTK2_RC_FILES=/etc/gtk-2.0/gtkrc:/home/angel/.gtkrc-2.0:/home/angel/.config/gtkrc-2.0 DESKTOP_STARTUP_ID=angel-SurfaceBook;1561017111;557994;3063_TIME742683 SHELL=/bin/bash XDG_RUNTIME_DIR=/run/user/1000 HOME=/home/angel TERM_PROGRAM=vscode GTK_RC_FILES=/etc/gtk/gtkrc:/home/angel/.gtkrc:/home/angel/.config/gtkrc PROMPT_COMMAND=__posh_git_ps1 \"\\\\[\\[\\e[0;32m\\]\\u@\\h \\[\\e[0;33m\\]\\w\" \" \\[\\e[1;34m\\]\\n\\$\\[\\e[0m\\] \";__posh_git_ps1 \"\\\\[\\[\\e[0;32m\\]\\u@\\h \\[\\e[0;33m\\]\\w\" \" \\[\\e[1;34m\\]\\n\\$\\[\\e[0m\\] \"; ANT_HOME=/opt/apache-ant-1.10.5 XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1 GOROOT=/opt/go CGO_LDFLAGS=-Wno-unused-command-line-argument -D__ANDROID_API__=16 -target armv7-none-linux-androideabi -gcc-toolchain /home/angel/Android/Sdk/ndk/18.1.5063045/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --sysroot=/home/angel/Android/Sdk/ndk/18.1.5063045/platforms/android-16/arch-arm CGO_CXXFLAGS_ALLOW=.* LESSCLOSE=/usr/bin/lesspipe %s %s QT_DIR=/home/angel/Qt KDE_SESSION_VERSION=5 MVN_HOME=/opt/apache-maven-3.6.0 PAM_KWALLET5_LOGIN=/run/user/1000/kwallet5.socket USER=angel XCURSOR_SIZE=0 LIBVIRT_DEFAULT_URI=qemu:///system XDG_SESSION_CLASS=user GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1 XDG_SEAT=seat0 CGO_ENABLED=1 XDG_VTNR=1 DESKTOP_SESSION=/usr/share/xsessions/plasma GDK_DPI_SCALE=0.5 PWD=/media/angel/data/angel/Obisoft/sin_cables/qt_golang/ssiManager ANDROID_NDK_DIR=/home/angel/Android/Sdk/ndk/18.1.5063045 DISPLAY=:0 QT_SCREEN_SCALE_FACTORS=eDP-1=2;DP-1=2;HDMI-1=2; XDG_SESSION_DESKTOP=KDE XCURSOR_THEME=Breeze_Snow XDG_CONFIG_DIRS=/etc/xdg/xdg-/usr/share/xsessions/plasma:/etc/xdg SSH_AUTH_SOCK=/tmp/ssh-L45MhgU941bw/agent.2851 TERM_PROGRAM_VERSION=1.35.1 QT_AUTO_SCREEN_SCALE_FACTOR=0 QT_VERSION=5.12.4 GRADLE_HOME=/opt/gradle-5.2.1 XDG_SESSION_TYPE=x11 ANDROID_SDK_DIR=/home/angel/Android/Sdk CGO_CPPFLAGS=-Wno-unused-command-line-argument -D__ANDROID_API__=16 -target armv7-none-linux-androideabi -gcc-toolchain /home/angel/Android/Sdk/ndk/18.1.5063045/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --sysroot=/home/angel/Android/Sdk/ndk/18.1.5063045/sysroot -isystem /home/angel/Android/Sdk/ndk/18.1.5063045/sysroot/usr/include/arm-linux-androideabi GOBIN=/home/angel/go/bin KDE_SESSION_UID=1000 MANDATORY_PATH=/usr/share/gconf//usr/share/xsessions/plasma.mandatory.path QT_ACCESSIBILITY=1 ANDROID_NDK_ROOT=/home/angel/Android/Sdk/ndk/18.1.5063045 GOOS=android GOARCH=arm LANG=es_ES.UTF-8 JAVA_HOME=/opt/jdk1.8.0_201 CHROME_DESKTOP=code-url-handler.desktop XDG_DATA_DIRS=/usr/share//usr/share/xsessions/plasma:/home/angel/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share:/var/lib/snapd/desktop LESSOPEN=| /usr/bin/lesspipe %s XAUTHORITY=/tmp/xauth-1000-_0 SESSION_MANAGER=local/angel-SurfaceBook:@/tmp/.ICE-unix/2951,unix/angel-SurfaceBook:/tmp/.ICE-unix/2951 CGO_LDFLAGS_ALLOW=.* GOFLAGS=-mod=vendor GS_LIB=/home/angel/.fonts XDG_SESSION_ID=3 SSH_AGENT_PID=2900 CGO_CFLAGS_ALLOW=.* KDE_FULL_SESSION=true TERM=xterm-256color LOGNAME=angel _=/home/angel/go/bin/qtdeploy CC=/home/angel/Android/Sdk/ndk/18.1.5063045/toolchains/llvm/prebuilt/linux-x86_64/bin/clang OPENWRT_BUILDROOT=/home/angel/Universidad/Obisoft/sin_cables/openwrt" error="exit status 2" name="build for android on linux"
runtime/cgo
github.com/therecipe/qt
github.com/therecipe/qt/quickcontrols2
net
github.com/therecipe/qt/core
github.com/therecipe/qt/qml
github.com/therecipe/qt/androidextras
github.com/therecipe/qt/gui
# github.com/therecipe/qt/androidextras
androidextras_android.cpp:9:10: fatal error: 'QAndroidActivityResultReceiver' file not found

Most helpful comment

@angiglesias It could be that android deployments with 5.12.4 aren't supported at the moment, I already fixed some issue with https://github.com/therecipe/qt/commit/af32cfd0e0aa8943a622f44f321e76d41237db77, but there might be more I haven't catched yet. (For example, I think the android minSDK version was bumped from 16 to 21 in 5.12.4, and I haven't made the changes to reflect that in qtdeploy yet)

If you want to use the official Qt version, then try to use 5.12.3 for now (that's also the version the docker images uses at the moment)

About the androidextras_android.cpp:9:10: fatal error: 'QAndroidActivityResultReceiver' file not found, this is probably caused by not running qtsetup generate android before using qtdeploy build android (I will try to get rid of the need to run that extra setup command in the future)

And I'm not sure about the undefined: core.PointerFromQMetaObject issue, but the easiest way to solve this would probably be to run qtsetup generate desktop && qtsetup generate android

All 5 comments

hi @angiglesias can you please share your os?
also have you tried qtdeploy with docker? I've had similar issues and docker images deploys actually did the trick for me.

here are guides for win, mac, linux
https://github.com/therecipe/qt/wiki/Deploying-Windows-to-Android#docker-deployment
https://github.com/therecipe/qt/wiki/Deploying-Linux-to-Android#docker-deployment
https://github.com/therecipe/qt/wiki/Deploying-macOS-to-Android#docker-deployment

hi @bh90210 I'm using Linux (KDE Neon 18.04) and go version 1.12.6. I tried deploying using docker (qtdeploy -docker build android and gave more less the same error message:

TERM='dumb' /home/user/android-ndk-r18b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang -I /media/ssiManager/vendor/github.com/therecipe/qt/androidextras -fPIC -marm -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK/b110=/tmp/go-build -gno-record-gcc-switches -Wno-unused-command-line-argument -D__ANDROID_API__=16 -target armv7-none-linux-androideabi -gcc-toolchain /home/user/android-ndk-r18b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --sysroot=/home/user/android-ndk-r18b/sysroot -isystem /home/user/android-ndk-r18b/sysroot/usr/include/arm-linux-androideabi -I ./ -g -O2 -o ./_x003.o -c utils-androidextras_android.cgo2.c
cd /media/ssiManager/vendor/github.com/therecipe/qt/androidextras
TERM='dumb' /home/user/android-ndk-r18b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -I . -fPIC -marm -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=$WORK/b110=/tmp/go-build -gno-record-gcc-switches -Wno-unused-command-line-argument -D__ANDROID_API__=16 -target armv7-none-linux-androideabi -gcc-toolchain /home/user/android-ndk-r18b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64 --sysroot=/home/user/android-ndk-r18b/sysroot -isystem /home/user/android-ndk-r18b/sysroot/usr/include/arm-linux-androideabi -I $WORK/b110/ -g -O2 -o $WORK/b110/_x004.o -c androidextras_android.cpp
# github.com/therecipe/qt/androidextras
androidextras_android.cpp:9:10: fatal error: 'QAndroidActivityResultReceiver' file not found

At this point I thought the problem was with my setup so I tried to deploy the qt/internal/examples/androidextras apps, which they didn't gave any problems. These two apps are in my $GOPATH and my app is a go module, so I move my app to my gopath, delete the vendor dir and go module files, download the dependencies with go get and deployed again, this time giving a new error message:

 github.com/therecipe/qt/androidextras
../github.com/therecipe/qt/androidextras/androidextras_android.go:4173:10: undefined: core.PointerFromQMetaObject
../github.com/therecipe/qt/androidextras/androidextras_android.go:4173:50: undefined: core.QMetaObject
../github.com/therecipe/qt/androidextras/androidextras_android.go:4176:9: undefined: core.PointerFromQMetaObject
../github.com/therecipe/qt/androidextras/androidextras_android.go:4179:50: undefined: core.QMetaObject
../github.com/therecipe/qt/androidextras/androidextras_android.go:4181:10: undefined: core.NewQMetaObjectFromPointer

Now it appears to be a problem with go code, weird. So I try again in this scenario to deploy with docker as @bh90210 suggested and it worked!. Right now I'm really confused, to be honest...

you didn't post the error! :smile:

you didn't post the error!

Sorry! sent the comment before finishing it

@angiglesias It could be that android deployments with 5.12.4 aren't supported at the moment, I already fixed some issue with https://github.com/therecipe/qt/commit/af32cfd0e0aa8943a622f44f321e76d41237db77, but there might be more I haven't catched yet. (For example, I think the android minSDK version was bumped from 16 to 21 in 5.12.4, and I haven't made the changes to reflect that in qtdeploy yet)

If you want to use the official Qt version, then try to use 5.12.3 for now (that's also the version the docker images uses at the moment)

About the androidextras_android.cpp:9:10: fatal error: 'QAndroidActivityResultReceiver' file not found, this is probably caused by not running qtsetup generate android before using qtdeploy build android (I will try to get rid of the need to run that extra setup command in the future)

And I'm not sure about the undefined: core.PointerFromQMetaObject issue, but the easiest way to solve this would probably be to run qtsetup generate desktop && qtsetup generate android

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vahid-sohrabloo picture vahid-sohrabloo  路  7Comments

ismlsmile picture ismlsmile  路  5Comments

mathieujobin picture mathieujobin  路  4Comments

woodyjon picture woodyjon  路  5Comments

xlucas picture xlucas  路  7Comments