Building for android from source; undefined reference to Win32MakefileGenerator
-
I'm trying to build Qt 5.11.1 from source for android following the guide, and I'm ending up with some weird error.
~/source_qt/qtbase $./configure -prefix /home/user/Qt/5.11.1/android_armv7 --disable-rpath -nomake tests -nomake examples -android-ndk /opt/android/ndk -android-sdk /opt/android/sdk -android-ndk-host linux-x86_64 -android-toolchain-version 4.9 -skip qttranslations -skip qtserialport -no-warnings-are-errors <srcbase> = /home/user/source_qt/qtbase <bldbase> = /home/user/source_qt/qtbase <outbase> = /home/user/source_qt/qtbase Creating qmake... .metamakefile.o:(.rodata._ZTV22Win32MakefileGenerator[_ZTV22Win32MakefileGenerator]+0x80): undefined reference to `Win32MakefileGenerator::escapeDependencyPath(QString const&) const' msvc_vcproj.o:(.rodata._ZTV15VcprojGenerator[_ZTV15VcprojGenerator]+0x80): undefined reference to `Win32MakefileGenerator::escapeDependencyPath(QString const&) const' msvc_vcxproj.o:(.rodata._ZTV16VcxprojGenerator[_ZTV16VcxprojGenerator]+0x80): undefined reference to `Win32MakefileGenerator::escapeDependencyPath(QString const&) const' collect2: error: ld returned 1 exit status make: *** [../bin/qmake] Error 1
I'm doing this for the first time, so I don't know if I do everything right.
The reason for trying to make a custom build is that my android application build with Qt 5.11.1 is crashing (not responding) onQt.quit()
or when callingQProcess::startDetached("reboot");
(Application is set up to be a launcher), if I build with Qt. 5.10.1 everything is fine, so trying to figure out what's wrong. -
You forgot to tell Qt that it should cross-compile: please add the
-xplatform android-g++
flag to your configure call. -
Wish that would help, I tried with and without it (randomly trying to see what's wrong) and posted the line where I didn't include the
-xplatform
but even with it I get the same error.
I don't know if it would help to change some parameters maybe?Previously I build the same source for linux without issues, but then again it's different for android.
-
@Wiru said in Building for android from source; undefined reference to Win32MakefileGenerator:
Previously I build the same source for linux without issues, but then again it's different for android.
Make sure your build dir is clean, then.
Also, what is
-android-ndk-host linux-x86_64
doing there? Perhaps follow the Windows instructions since your host is Windows https://wiki.qt.io/Building_qt-android_on_windows . Not sure if they work, I've never tried building Qt for Android on Windows. -
The thing is that the host is linux, that's why the
Win32MakefileGenerator
is even more confusing. I deleted all the modified flies, at least all that git said were different. I'll try to clone again just in case some files got ignored and didn't show up in git. -
Ok that was one reason, apparently some stuff stays from old builds and it's not shown in git.
Now the only issue is I get theERROR: Unknown command line option -skip
, if I understand right it should be used to not build unsupported modules.
But it does sayCreating qmake... .Done. ERROR: Unknown command line option -skip
So not sure if that's something that can be ignored.
-
@Wiru said in Building for android from source; undefined reference to Win32MakefileGenerator:
The thing is that the host is linux, that's why the Win32MakefileGenerator is even more confusing. I deleted all the modified flies, at least all that git said were different. I'll try to clone again just in case some files got ignored and didn't show up in git.
Ah, ok sorry I got confused :-)
If you use git and clean it (
git clean -dxf
) make sure the repo is initialized.Best way to safely compile Qt is to do an out of source build:
git clone ... cd repo perl init-repository cd .. mkdir build cd build ../repo/configure ...
Easier yet - use a tarball from qt.io archive. It's a faster download, no need to init-repository, in general just less hassle.
-
Here is a script I use to compile Qt on Android, maybe it will help you. Host is Kubuntu 18.10 in this case.
export QTVER=5.11.1 wget http://download.qt.io/official_releases/qt/5.11/$QTVER/single/qt-everywhere-src-$QTVER.tar.xz tar -xaf qt-everywhere-src-$QTVER.tar.xz mv qt-everywhere-src-$QTVER $QTVER-src mkdir qtbuild cd qtbuild # Check if this path is correct export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64 export ANDROID_NDK_ROOT=/path/to/android/ndk-r10e ../$QTVER-src/configure -release -xplatform android-g++ --disable-rpath -nomake tests -nomake examples -android-ndk-host linux-x86_64 -android-toolchain-version 4.9 -android-ndk $ANDROID_NDK_ROOT -android-sdk /path/to/android/sdk -no-warnings-are-errors -opensource -confirm-license -prefix ../$QTVER-android -skip qttranslations -skip qtserialport -skip qtserialbus -skip qtscxml -skip qtscript -skip qtcharts -skip qt3d -skip qtdatavis3d -skip qtcanvas3d -skip qtgamepad -skip qtvirtualkeyboard -skip qtwayland -skip qtwebengine -skip qtwebchannel -skip qtwebsockets -android-arch armeabi-v7a time make -j `nproc` make install
You may want to experiment with some OpenSSL flags, too, but I've left them out to make it easier.
-
@Wiru said in Building for android from source; undefined reference to Win32MakefileGenerator:
Ok that was one reason, apparently some stuff stays from old builds and it's not shown in git.
Now the only issue is I get theERROR: Unknown command line option -skip
, if I understand right it should be used to not build unsupported modules.
But it does sayCreating qmake... .Done. ERROR: Unknown command line option -skip
So not sure if that's something that can be ignored.
Nope. Your build dir or environment is seriously wrong if it fails to recognise
-skip
. -
Thanks for the help, I'll play around with settings.
First I'll try to download the zip because usingperl init-repository
just ends up withCan't open perl script "init-repository" no such file or directory
, and first I docd qtbase
, so who knows what's not working correctly. -
Ok I simply have no luck.
I downloaded the tar 5 times, and every time
wget http://download.qt.io/official_releases/qt/5.11/5.11.1/single/qt-everywhere-src-5.11.1.tar.xz
~/source_qt $ tar -xaf qt-everywhere-src-5.11.1.tar.xz xz: (stdin): Compressed data is corrupt tar: Unexpected EOF in archive tar: Unexpected EOF in archive tar: Error is not recoverable: exiting now
I'll continue trying with the git source... :S
-
Hi,
The
.zip
archive is for Windows.
The.tar.xz
archive is for Linux.Completely unrelated to the target you want to build for, it's a question of line ending type.
-
-
No worries :-) Building Qt is a complex thing, I guess we all understand it and went through similar hurdles at some point in the past ;-) Happy coding!