Rebuilding Android Qt with Linaro GCC 4.6.2.

mingw android mingw.android at gmail.com
Tue Dec 6 13:01:10 UTC 2011


Hi guys,

I sent this email to BogDan, but really, this list is a more
appropriate place for it (and Gmail and Yahoo don't like talking to
each other sometimes, so I don't think he's getting my emails
delivered promptly).

Sorry this is a bit long-winded! I managed to track down (on Linux)why
Qt Android doesn't build correctly with Linaro GCC 4.6.2 finally (btw
I released to the ndk mailing list the newest versions with
important neon fixes)... It's important that I get the 4.6.2 build
working and tested as neon will probably never work properly in 4.4.3,
plus 4.6.2 brings all sorts of other niceness (Cloog/Graphite + auto
parallelism).

On Ubuntu Linux GCC 4.6.1 Host Qt build works, here's a snippet of the commands:
pushd /usr/nec/shared-build/src/corelib
rm .moc/release-shared/moc_qabstractanimation.cpp
make

...executes...

/usr/nec/shared-build/bin/moc -DQT_SHARED -DQT_BUILD_CORE_LIB
-DQT_NO_USING_NAMESPACE -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS
-DQT_MOC_COMPAT -DQT_USE_FAST_OPERATOR_PLUS
-DQT_USE_FAST_CONCATENATION -DELF_INTERPRETER=\"/lib/ld-linux.so.2\"
-DQLIBRARYINFO_EPOCROOT -DHB_EXPORT=Q_CORE_EXPORT -DQT_NO_DEBUG
-DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT
-DQT_HAVE_SSE2 -DQT_HAVE_SSE3 -DQT_HAVE_SSSE3 -DQT_HAVE_SSE4_1
-DQT_HAVE_SSE4_2 -DQT_HAVE_AVX -D_LARGEFILE64_SOURCE
-D_LARGEFILE_SOURCE -I/usr/nec/qt-src/mkspecs/linux-g++
-I/usr/nec/qt-src/src/corelib -I../../include -I../../include/QtCore
-I.rcc/release-shared -Iglobal -I/usr/nec/qt-src/tools/shared
-I/usr/nec/qt-src/src/3rdparty/harfbuzz/src
-I/usr/nec/qt-src/src/3rdparty/md5 -I/usr/nec/qt-src/src/3rdparty/md4
-I.moc/release-shared -I.
/usr/nec/qt-src/src/corelib/animation/qabstractanimation.h -o
.moc/release-shared/moc_qabstractanimation.cpp



Android Linaro 4.6.2 Qt build fails:
pushd /usr/nec/unstable/Android/Qt/480/build-armeabi/src/corelib
rm .moc/release-shared/moc_qabstractanimation.cpp
make

...executes...

/usr/nec/unstable/Android/Qt/480/build-armeabi/bin/moc -DQT_SHARED
-DQT_NO_CORESERVICES -DQT_BUILD_CORE_LIB -DQT_NO_USING_NAMESPACE
-DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT
-DQT_USE_QSTRINGBUILDER -DQLIBRARYINFO_EPOCROOT
-DHB_EXPORT=Q_CORE_EXPORT -DQT_NO_DEBUG
-I/usr/nec/unstable/Android/Qt/480/qt-src/mkspecs/android-g++
-I/usr/nec/unstable/Android/Qt/480/qt-src/src/corelib -I../../include
-I../../include/QtCore -I.rcc/release-shared -Iglobal
-I/usr/nec/unstable/Android/Qt/480/qt-src/tools/shared
-I/usr/nec/unstable/Android/Qt/480/qt-src/src/3rdparty/harfbuzz/src
-I/usr/nec/unstable/Android/Qt/480/qt-src/src/3rdparty/md5
-I/usr/nec/unstable/Android/Qt/480/qt-src/src/3rdparty/md4
-I.moc/release-shared
-I/usr/nec/unstable/Android/Qt/480/build-armeabi/src/corelib/.rcc/release-shared
-I/usr/nec/android-ndk-r6b/platforms/android-5/arch-arm/usr/include
-I/usr/nec/android-ndk-r6b/sources/cxx-stl-4.6.2/gnu-libstdc++/include
-I/usr/nec/android-ndk-r6b/sources/cxx-stl-4.6.2/gnu-libstdc++/libs/armeabi/include
-I. /usr/nec/unstable/Android/Qt/480/qt-src/src/corelib/animation/qabstractanimation.h
-o .moc/release-shared/moc_qabstractanimation.cpp
...and fails...
usr/nec/android-ndk-r6b/sources/cxx-stl-4.6.2/gnu-libstdc++/include/bits/stl_relops.:68:
Parse error at "std"
make: *** [.moc/release-shared/moc_qabstractanimation.cpp] Error 1

...I examined the moc command lines in detail and the difference is
that we explicitly add the gnulibstdc++ includes path(s):
"-I/usr/nec/android-ndk-r6b/sources/cxx-stl-4.6.2/gnu-libstdc++/include
-I/usr/nec/android-ndk-r6b/sources/cxx-stl-4.6.2/gnu-libstdc++/libs/armeabi/include"

So I tested adding the equivalent (-I/usr/include/c++/4.6.1) to Ubuntu:
/usr/nec/shared-build/bin/moc -I/usr/include/c++/4.6.1 ...etc...
etc... /usr/nec/qt-src/src/corelib/animation/qabstractanimation.h -o
.moc/release-shared/moc_qabstractanimation.cpp
and it fails in much the same way:
usr/include/c++/4.6/bits/stringfwd.:43: Parse error at "std"

Which is good as it identifies that this is the problem. Moc can't
handle very recent libstdc++ headers (because it doesn't do macro
expansion).

For us, the problem obviously because in qmake.conf we've got:
ANDROID_SOURCES_CXX_STL_INCDIR =
$$NDK_ROOT/sources/cxx-stl-$$ANDROID_CXXSTL_SUFFIX/gnu-libstdc++/include
$$ANDROID_SOURCES_CXX_STL_LIBDIR/include
QMAKE_INCDIR            = $$ANDROID_PLATFORM_PATH/include
$$ANDROID_SOURCES_CXX_STL_INCDIR

So I guess we need to not add this when mocc'ing, but I'm not sure how
best to achieve this.

I guess we could have QMAKE_INCDIR_MOC which doesn't get these things
added or something like that? If anyone's got any thoughts then please
shout.

Cheers,

Ray.


More information about the Necessitas-devel mailing list