Open F0rth opened 6 years ago
so, I tried
[forth@mjolnir include]$ ls asm lrwxrwxrwx 1 forth forth 25 19 août 03:54 asm -> arm-linux-androideabi/asm
and got:
``
INFO[0000] running: 'qtsetup test android' [docker=false] [vagrant=false]
INFO[0000] testing qml/application
ERRO[0013] failed to run command cmd="go build -p 4 -v -ldflags=all=\"-s\" \"-w\" -o /home/forth/go/src/github.com/therecipe/qt/internal/examples/qml/application/deploy/android/libgo_base.so -tags=\"android\" \"minimal\" -pkgdir /home/forth/go/pkg/android_android_arm -buildmode c-shared" dir=/home/forth/go/src/github.com/therecipe/qt/internal/examples/qml/application env="GOARCH=arm CC=/tmp/android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc CGO_LDFLAGS_ALLOW=. GOARM=7 PATH=/home/forth/perl5/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/forth/go/bin:/home/forth/AE/VSCode-linux-x64:/home/forth/bin:/usr/lib/go-1.8/bin:/opt/go/bin:/home/forth/.local/bin:/home/forth/lgo/bin GOROOT=/usr/lib/go CGO_CFLAGS_ALLOW=. CGO_CXXFLAGS_ALLOW=.* GOPATH=/home/forth/go CXX=/tmp/android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ CGO_CPPFLAGS=-isystem /tmp/android-ndk-r17b/platforms/android-16/arch-arm/usr/include GOOS=android CGO_ENABLED=1 CGO_LDFLAGS=--sysroot=/tmp/android-ndk-r17b/platforms/android-16/arch-arm -llog" error="exit status 2" func=RunCmd name="build for android on linux"
errors
internal/race
runtime/internal/sys
unicode
unicode/utf8
sync/atomic
runtime/internal/atomic
math
internal/testlog
runtime
runtime/cgo
strconv
gcc_android.c:30: error: undefined reference to 'stderr' gcc_libinit.c:30: error: undefined reference to 'stderr' gcc_linux_arm.c:25: error: undefined reference to 'sigfillset' gcc_util.c:19: error: undefined reference to 'stderr' collect2: error: ld returned 1 exit status sync io reflect syscall bytes strings bufio time internal/poll os fmt log ``
ld -v GNU ld (GNU Binutils) 2.31.1
Hey
Sorry, seems like I broke the android image 2 weeks ago while cleaning up the code. But the image should work now again with: https://github.com/therecipe/qt/commit/d0f30a6e4c39e0989b1b00169b66abbca442becf However, it will take approx. 24 hours before it's being build because there is currently a very long list of images queued up to be build.
If you don't want to wait, then you can also build the image yourself. But you will also need to build the latest linux image first.
To do so, just update the binding and run:
cd $GOPATH/src/github.com/therecipe/qt/internal/docker/linux && docker build -t therecipe/qt:linux . && cd $GOPATH/src/github.com/therecipe/qt/internal/docker/android && docker build -t therecipe/qt:android .
If you however want to use your local android setup, then you might need to update the binding as well and check if you installed the android-sdk build-tools 28.0.2
and the platform-sdk 28
(build-tools 26.0.0
and platform-sdk 26
, if you don't want to update the binding)
But whether or not you update the binding, you will need to install the old android-ndk r14b from here: https://developer.android.com/ndk/downloads/older_releases
It seems like android-ndk versions newer than 14 might not be supported until Qt 5.12, but I will take a look.
And sorry, the documentation is a bit dated and I will probably need to update the links or clarify which dependency versions are currently supported/needed for this to work.
Also, btw you will need to run the setup again (desktop and android) after updating the binding.
thank you for your detailed anwsers. I followed your instructions (updated build-tools 28.0.2 and platform-sdk 28, ndk 14, git pull, regenerate linux and android target) and got those errors:
``
qtsetup test android
INFO[0000] running: 'qtsetup test android' [docker=false] [vagrant=false]
INFO[0000] testing qml/application
ERRO[0013] failed to run command cmd="go build -p 4 -v -ldflags=all=\"-s\" \"-w\" -o /home/forth/go/src/github.com/therecipe/qt/internal/examples/qml/application/deploy/android/libgo_base.so -tags=\"android\" \"minimal\" -pkgdir /home/forth/go/pkg/android_android_arm -buildmode c-shared" dir=/home/forth/go/src/github.com/therecipe/qt/internal/examples/qml/application env="GOOS=android GOROOT=/usr/lib/go CGO_CFLAGS_ALLOW=. CGO_CXXFLAGS_ALLOW=. GOARM=7 CC=/tmp/android-ndk-r14b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc CXX=/tmp/android-ndk-r14b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ CGO_CPPFLAGS=-isystem /tmp/android-ndk-r14b/platforms/android-16/arch-arm/usr/include CGO_LDFLAGS_ALLOW=.* CGO_LDFLAGS=--sysroot=/tmp/android-ndk-r14b/platforms/android-16/arch-arm -llog GOARCH=arm CGO_ENABLED=1 PATH=/home/forth/perl5/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/forth/go/bin:/home/forth/AE/VSCode-linux-x64:/home/forth/bin:/usr/lib/go-1.8/bin:/opt/go/bin:/home/forth/.local/bin:/home/forth/lgo/bin GOPATH=/home/forth/go" error="exit status 2" func=RunCmd name="build for android on linux"
errors
internal/race
runtime/internal/sys
sync/atomic
unicode
unicode/utf8
runtime/internal/atomic
math
internal/testlog
runtime
runtime/cgo
strconv
sync
io
reflect
syscall
bytes
strings
bufio
time
internal/poll
os
fmt
log
github.com/therecipe/qt
github.com/therecipe/qt/core
In file included from /tmp/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/include/type_traits:35:0, from /opt/Qt/5.11.1/android_armv7/include/QtCore/qglobal.h:45, from /opt/Qt/5.11.1/android_armv7/include/QtCore/qatomic.h:41, from /opt/Qt/5.11.1/android_armv7/include/QtCore/qrefcount.h:43, from /opt/Qt/5.11.1/android_armv7/include/QtCore/qbytearray.h:44, from /opt/Qt/5.11.1/android_armv7/include/QtCore/QByteArray:1, from core-minimal.cpp:9: /tmp/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
^ In file included from /opt/Qt/5.11.1/android_armv7/include/QtCore/qglobal.h:105:0, from /opt/Qt/5.11.1/android_armv7/include/QtCore/qatomic.h:41, from /opt/Qt/5.11.1/android_armv7/include/QtCore/qrefcount.h:43, from /opt/Qt/5.11.1/android_armv7/include/QtCore/qbytearray.h:44, from /opt/Qt/5.11.1/android_armv7/include/QtCore/QByteArray:1, from core-minimal.cpp:9: /opt/Qt/5.11.1/android_armv7/include/QtCore/qcompilerdetection.h:561:6: error: #error Qt requires a C++11 compiler and yours does not seem to be that.
^
In file included from /opt/Qt/5.11.1/android_armv7/include/QtCore/qatomic.h:41:0, from /opt/Qt/5.11.1/android_armv7/include/QtCore/qrefcount.h:43, from /opt/Qt/5.11.1/android_armv7/include/QtCore/qbytearray.h:44, from /opt/Qt/5.11.1/android_armv7/include/QtCore/QByteArray:1, from core-minimal.cpp:9: /opt/Qt/5.11.1/android_armv7/include/QtCore/qglobal.h:1162:1: warning: identifier 'nullptr' is a keyword in C++11 [-Wc++0x-compat] Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char varName, bool ok=nullptr) Q_DECL_NOEXCEPT; ^ In file included from /opt/Qt/5.11.1/android_armv7/include/QtCore/qatomic.h:46:0, from /opt/Qt/5.11.1/android_armv7/include/QtCore/qglobal.h:1200, from /opt/Qt/5.11.1/android_armv7/include/QtCore/qatomic.h:41, from /opt/Qt/5.11.1/android_armv7/include/QtCore/qrefcount.h:43, from /opt/Qt/5.11.1/android_armv7/include/QtCore/qbytearray.h:44, from /opt/Qt/5.11.1/android_armv7/include/QtCore/QByteArray:1, from core-minimal.cpp:9: /opt/Qt/5.11.1/android_armv7/include/QtCore/qbasicatomic.h:61:4: error: #error "Qt requires C++11 support"
^
In file included from /opt/Qt/5.11.1/android_armv7/include/QtCore/qobjectdefs.h:50:0,
from /opt/Qt/5.11.1/android_armv7/include/QtCore/qobject.h:46,
from /opt/Qt/5.11.1/android_armv7/include/QtCore/qcoreapplication.h:46,
from /opt/Qt/5.11.1/android_armv7/include/QtCore/QCoreApplication:1,
from core-minimal.cpp:11:
/opt/Qt/5.11.1/android_armv7/include/QtCore/qobjectdefs_impl.h:337:9: warning: identifier 'decltype' is a keyword in C++11 [-Wc++0x-compat]
template
``
Mh, I'm not quite sure what is causing this.
Could you try to remove /home/forth/go/pkg/android_android_arm
(maybe also /opt/go/pkg/android_android_arm
), then export a minimal PATH like:
/usr/local/bin:/usr/bin:/bin:/opt/go/bin
and then run qtsetup full android
again.
Also maybe post the content of $GOPATH/src/github.com/therecipe/qt/core/minimal_cgo_android_linux_arm.go
so I can look into this.
edit: also do you have ANDROID_NDK
exported by any chance? (It shouldn't be required but it also shouldn't cause trouble, just want to rule this out)
cat $GOPATH/src/github.com/therecipe/qt/core/minimal_cgo_android_linux_arm.go // +build android,minimal
package core
/*
*/ import "C"
env |grep NDK ANDROID_NDK_DIR=/tmp/android-ndk-r14b
I neither have /home/forth/go/pkg/android_android_arm nor /opt/go/pkg/android_android_arm but ls $GOPATH/pkg/gomobile/ total 36K drwxr-xr-x 8 forth forth 4,0K 13 août 2016 . drwxr-xr-x 5 forth forth 4,0K 5 avril 2017 .. drwxr-xr-x 8 forth forth 4,0K 13 août 2016 android-ndk-r12b drwxr-xr-x 2 forth forth 4,0K 12 août 2016 dl drwxr-xr-x 28 forth forth 4,0K 13 août 2016 pkg_android_386 drwxr-xr-x 28 forth forth 4,0K 13 août 2016 pkg_android_amd64 drwxr-xr-x 28 forth forth 4,0K 13 août 2016 pkg_android_arm drwxr-xr-x 28 forth forth 4,0K 13 août 2016 pkg_android_arm64 -rw-r--r-- 1 forth forth 31 13 août 2016 version
is it related ?
I delete this directory, cleaned the PATH env, but got the same error about c++11
/tmp/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/include/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
is it related ?
Mh, these are gomobile packages so it's probably not related
Could you show me the output from qtsetup check android
?
INFO[0000] running: 'qtsetup check android' [docker=false] [vagrant=false]
INFO[0000] GOOS: 'linux'
INFO[0000] GOARCH: 'amd64'
INFO[0000] GOVERSION: 'go1.10.3'
INFO[0000] GOROOT: '/usr/lib/go'
INFO[0000] GOPATH: '/home/forth/go'
INFO[0000] GOBIN: '/home/forth/go/bin'
INFO[0000] QT_HASH: 'd0f30a6e4c39e0989b1b00169b66abbca442becf'
INFO[0000] QT_VERSION: '5.11.1'
INFO[0000] QT_VERSION_MAJOR: '5.11.1'
INFO[0000] QT_DIR: '/opt/Qt'
INFO[0000] QT_STUB: 'false'
INFO[0000] QT_DEBUG: 'false'
INFO[0000] QT_QMAKE_DIR: ''
INFO[0000] QT_WEBKIT: 'false'
INFO[0000] JDK_DIR: '/opt/jdk/jdk1.8.0_181'
INFO[0000] ANDROID_SDK_DIR: '/opt/android'
INFO[0000] ANDROID_NDK_DIR: '/tmp/android-ndk-r14b'
Thanks
Okay, seems like your cgo*
files are missing the -std=gnu++11
flag inside the CXXFLAGS
exactly like the error suggests ... strange I'm not sure how this could have happened
Did you use the official Qt installer?
edit: also could you check if env | grep QMAKE
prints anything?
I have no QMAKE env var. I use the official Qt installer.
is it still relevant to go down the rabbit hole ? May it help you to understand this bug ? otherwise this issue can be closed :-)
Sorry for the delay.
Depends on you, I'm pretty sure that it's not a bug in qtdeploy since the cgo_*
files are all generated by parsing the Makefiles created by qmake. I could work around this by forcing the inclusion of -std=gnu++11
but that would just be a dirty fix.
I hoped that you might have some QMAKE_* env vars set or something ...
But what you could try would be to create an empty test.pro
file, then export ANDROID_NDK_ROOT
to point to the NDK, then run $QT_DIR/5.11.1/android_armv7/bin/qmake /path/to/test.pro
and check whether or not the generated Makefile has the -std=gnu++11
flag listed for the CXXFLAGS
.
If it does, then it's a qtdeploy issue if not then the issue is either caused by qmake or there is something wrong with your PATH or so.
Also which distro and version are you using?
Btw, this patch should fix the issue for you but it's just an ugly workaround:
diff --git a/internal/binding/templater/template_cgo_qmake.go b/internal/binding/templater/template_cgo_qmake.go
index 8b8e5a77..ad19ac20 100644
--- a/internal/binding/templater/template_cgo_qmake.go
+++ b/internal/binding/templater/template_cgo_qmake.go
@@ -429,6 +429,7 @@ func createCgo(module, path, target string, mode int, ipkg, tags string) string
switch target {
case "android", "android-emulator":
fmt.Fprint(bb, "#cgo LDFLAGS: -Wl,--allow-shlib-undefined\n")
+ fmt.Fprint(bb, "#cgo CXXFLAGS: -std=gnu++11\n")
case "windows":
fmt.Fprint(bb, "#cgo LDFLAGS: -Wl,--allow-multiple-definition\n")
case "ios":
CXXFLAGS = -D__ANDROID_API__=16 --sysroot=/tmp/android-ndk-r14b/sysroot -isystem /tmp/android-ndk-r14b/sysroot/usr/include/arm-linux-androideabi -isystem /tmp/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/include -isystem /tmp/android-ndk-r14b/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include -fstack-protector-strong -DANDROID -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -fno-builtin-memmove -mthumb -Os -Wall -W -D_REENTRANT -fPIC $(DEFINES)
I'm using archlinux.
Thanks, so it's a qmake issue ... I will try to reproduce it on a fresh VM and also dig through the qmake source, maybe I'm lucky
Hi,
I followed the instructions and installed:
so there is no "include" directory in "android-ndk-r17b/platforms/android-16/arch-arm/usr/" I symlinked it:
ls /tmp/android-ndk-r17b/platforms/android-16/arch-arm/usr/ total 0 drwxrwxr-x 3 forth forth 80 19 août 03:13 . drwxrwxr-x 3 forth forth 60 7 juin 16:04 .. lrwxrwxrwx 1 forth forth 31 19 août 03:13 include -> ../../../../sysroot/usr/include drwxrwxr-x 2 forth forth 520 7 juin 16:12 lib
there is no "asm" either, tried another symlink:
[forth@mjolnir usr]$ ls -alh include/asm lrwxrwxrwx 1 forth forth 25 19 août 03:21 include/asm -> aarch64-linux-android/asm
and now got this error: `` INFO[0000] running: 'qtsetup test android' [docker=false] [vagrant=false] INFO[0000] testing qml/application
ERRO[0014] failed to run command cmd="go build -p 4 -v -ldflags=all=\"-s\" \"-w\" -o /home/forth/go/src/github.com/therecipe/qt/internal/examples/qml/application/deploy/android/libgo_base.so -tags=\"android\" \"minimal\" -pkgdir /home/forth/go/pkg/android_android_arm -buildmode c-shared" dir=/home/forth/go/src/github.com/therecipe/qt/internal/examples/qml/application env="CXX=/tmp/android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ CGO_LDFLAGS=--sysroot=/tmp/android-ndk-r17b/platforms/android-16/arch-arm -llog CGO_LDFLAGS_ALLOW=. CGO_ENABLED=1 CGO_CPPFLAGS=-isystem /tmp/android-ndk-r17b/platforms/android-16/arch-arm/usr/include CGO_CXXFLAGS_ALLOW=. PATH=/home/forth/perl5/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/forth/go/bin:/home/forth/AE/VSCode-linux-x64:/home/forth/bin:/usr/lib/go-1.8/bin:/opt/go/bin:/home/forth/.local/bin:/home/forth/lgo/bin GOPATH=/home/forth/go GOROOT=/usr/lib/go GOARM=7 GOARCH=arm CC=/tmp/android-ndk-r17b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc CGO_CFLAGS_ALLOW=.* GOOS=android" error="exit status 2" func=RunCmd name="build for android on linux" errors runtime/internal/sys internal/race sync/atomic unicode/utf8 unicode runtime/internal/atomic internal/testlog math runtime/cgo runtime
runtime/cgo
In file included from /tmp/android-ndk-r17b/sysroot/usr/include/signal.h:35:0, from /tmp/android-ndk-r17b/sysroot/usr/include/sys/select.h:36, from /tmp/android-ndk-r17b/sysroot/usr/include/sys/time.h:37, from /tmp/android-ndk-r17b/sysroot/usr/include/time.h:33, from /tmp/android-ndk-r17b/sysroot/usr/include/pthread.h:37, from gcc_android_arm.c:5: /tmp/android-ndk-r17b/platforms/android-16/arch-arm/usr/include/asm/sigcontext.h:40:3: error: unknown type name '__uint128_t' __uint128_t vregs[32]; ^ strconv sync io reflect syscall bytes strings bufio time internal/poll os fmt log ``
(I wish I could use docker, but got another error about openssl so I tried this way)