Results 1 to 3 of 3

Thread: Build Qt for Android with MinGW

  1. #1
    Join Date
    Aug 2011
    Posts
    16
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Question Build Qt for Android with MinGW

    Hello,

    i try to compile Qt 5.2.1 with MinGW. My OS is Windows 7 SP1 32-Bit. I get an error while compiling. How can i solve that problem?
    Qt Code:
    1. mingw32-make[3]: Entering directory 'C:/qt/qtactiveqt/src/tools'
    2. cd idc\ && ( if not exist Makefile C:\qt\qtbase\bin\qmake C:\qt\qtactiveqt\src\t
    3. ools\idc\idc.pro -o Makefile ) && mingw32-make -f Makefile
    4. mingw32-make[4]: Entering directory 'C:/qt/qtactiveqt/src/tools/idc'
    5. mingw32-make -f Makefile.Release
    6. mingw32-make[5]: Entering directory 'C:/qt/qtactiveqt/src/tools/idc'
    7. g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++0x -fno-exceptions -frtti -W
    8. all -Wextra -DUNICODE -DQT_NO_XKBCOMMON -DQT_NO_EXCEPTIONS -DQT_NO_DEBUG -DQT_BO
    9. OTSTRAP_LIB -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CO
    10. DECS -DQT_NO_DATASTREAM -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_SYSTEMLOCALE -DQ
    11. T_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -DQT_NO_DEPRECATED -DQ
    12. T_NO_TRANSLATION -DQT_QMAKE_LOCATION="C:/qt/qtbase/bin/qmake" -I. -I"C:\qt\qtbas
    13. e\include" -I"C:\qt\qtbase\include\QtCore" -I"C:\qt\qtbase\include\QtXml" -I"C:\
    14. qt\qtbase\include\QtCore\5.2.1" -I"C:\qt\qtbase\include\QtCore\5.2.1\QtCore" -I"
    15. C:\qt\qtbase\include\QtXml\5.2.1" -I"C:\qt\qtbase\include\QtXml\5.2.1\QtXml" -I"
    16. C:\qt\qtbase\include" -I"C:\icu\include" -I"C:\qt\qtbase\mkspecs\win32-g++" -o .
    17. obj\release\main.o main.cpp
    18. g++ -Wl,-s -Wl,-subsystem,console -o C:\qt\qtbase\bin\idc.exe .obj/release/main.
    19. o -Lc:\qt\qtbase\lib -Lc:\icu\lib -LC:/qt/qtbase/lib -lQt5Bootstrap -luser32 -l
    20. ole32 -ladvapi32
    21. .obj/release/main.o:main.cpp:(.text+0x1c9): undefined reference to `QProcess::QP
    22. rocess(QObject*)'
    23. .obj/release/main.o:main.cpp:(.text+0x1dc): undefined reference to `QProcess::sy
    24. stemEnvironment()'
    25. .obj/release/main.o:main.cpp:(.text+0x401): undefined reference to `QLibraryInfo
    26. ::location(QLibraryInfo::LibraryLocation)'
    27. .obj/release/main.o:main.cpp:(.text+0x617): undefined reference to `QProcess::se
    28. tEnvironment(QStringList const&)'
    29. .obj/release/main.o:main.cpp:(.text+0x632): undefined reference to `QProcess::st
    30. art(QString const&, QFlags<QIODevice::OpenModeFlag>)'
    31. .obj/release/main.o:main.cpp:(.text+0x645): undefined reference to `QProcess::wa
    32. itForFinished(int)'
    33. .obj/release/main.o:main.cpp:(.text+0x651): undefined reference to `QProcess::ex
    34. itCode() const'
    35. .obj/release/main.o:main.cpp:(.text+0x6e0): undefined reference to `QProcess::~Q
    36. Process()'
    37. c:/mingw/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/
    38. ld.exe: .obj/release/main.o: bad reloc address 0x1b in section `.text$_Z7fprintf
    39. P6_iobufPKcz[__Z7fprintfP6_iobufPKcz]'
    40. collect2.exe: error: ld returned 1 exit status
    41. Makefile.Release:77: recipe for target 'C:\qt\qtbase\bin\idc.exe' failed
    42. mingw32-make[5]: *** [C:\qt\qtbase\bin\idc.exe] Error 1
    43. mingw32-make[5]: Leaving directory 'C:/qt/qtactiveqt/src/tools/idc'
    44. Makefile:34: recipe for target 'release' failed
    45. mingw32-make[4]: *** [release] Error 2
    46. mingw32-make[4]: Leaving directory 'C:/qt/qtactiveqt/src/tools/idc'
    47. Makefile:38: recipe for target 'sub-idc-make_first' failed
    48. mingw32-make[3]: *** [sub-idc-make_first] Error 2
    49. mingw32-make[3]: Leaving directory 'C:/qt/qtactiveqt/src/tools'
    50. Makefile:82: recipe for target 'sub-tools-make_first-ordered' failed
    51. mingw32-make[2]: *** [sub-tools-make_first-ordered] Error 2
    52. mingw32-make[2]: Leaving directory 'C:/qt/qtactiveqt/src'
    53. Makefile:41: recipe for target 'sub-src-make_first' failed
    54. mingw32-make[1]: *** [sub-src-make_first] Error 2
    55. mingw32-make[1]: Leaving directory 'C:/qt/qtactiveqt'
    56. makefile:314: recipe for target 'module-qtactiveqt-make_first' failed
    57. mingw32-make: *** [module-qtactiveqt-make_first] Error 2
    To copy to clipboard, switch view to plain text mode 

    That's my environment variables:
    Qt Code:
    1. SETX QMAKESPEC "win32-g++"
    2. SETX QTDIR "c:\qt"
    3. SETX include "c:\qt\qtbase\include;c:\icu\include"
    4. SETX lib "c:\qt\qtbase\lib;c:\icu\lib"
    5. SETX PATH "c:\perl\perl\bin;c:\perl\perl\site\bin;c:\mingw\bin;c:\qt\qtbase\bin;c:\qt\qtrepotools\bin;c:\qt\gnuwin32\bin;c:\python\installdir;c:\icu\bin"
    6.  
    7. SETX ANDROID_NDK_PLATFORM "android-9"
    8. SETX ANDROID_TARGET_ARCH "armeabi-v7a"
    9. SETX ANDROID_BUILD_TOOLS_REVISION "19.0.2"
    10. SETx ANDROID_NDK_HOST "windows"
    To copy to clipboard, switch view to plain text mode 

    That's my configure command, beore i start the compiling process:
    Qt Code:
    1. configure -platform win32-g++ -debug-and-release -opengl desktop -xplatform android-g++ -android-ndk c:\android-ndk -android-sdk c:\android-sdk -android-toolchain-version 4.7 -opensource
    To copy to clipboard, switch view to plain text mode 

    Thanks in advance

  2. #2
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Build Qt for Android with MinGW

    You have to do something like this to configure qt for android:-
    Qt Code:
    1. ./configure -xplatform android-g++ -nomake tests -nomake examples -android-ndk <path/to/ndk> -android-sdk <path/to/sdk> -android-ndk-host <e.g. linux-x86_64> -android-toolchain-version <e.g. 4.8> -skip qttranslations -skip qtwebkit -skip qtserialport -skip qtwebkit-examples -no-warnings-are-errors
    To copy to clipboard, switch view to plain text mode 

    You need a JDK (version 1.6) and you should have this in your PATH. The $JAVA_HOME environment variable needs to be pointing to its directory (e.g. /usr/lib/jvm/java-6-openjdk-i386). Also you’ll need to have defined $ANDROID_SDK_ROOT pointing to the SDK and $ANDROID_API_VERSION pointing to the used android.jar API version (e.g. android-19)
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

  3. #3
    Join Date
    Aug 2011
    Posts
    16
    Thanks
    3
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Question Re: Build Qt for Android with MinGW

    Hi,

    thank you for the answer.

    The option "-android-ndk-host" is not available (Qt 5.2.1). So my new configure command is:
    Qt Code:
    1. c:\android> c:\qt\configure -developer-build -platform win32-g++ -opengl de
    2. sktop -xplatform android-g++ -android-ndk c:\android-ndk -android-sdk c:\android
    3. -sdk -android-toolchain-version 4.7 -opensource -confirm-license -nomake tests -
    4. nomake examples -skip qttranslations -skip qtwebkit -skip qtserialport -skip qtw
    5. ebkit-examples
    To copy to clipboard, switch view to plain text mode 

    I have add to my environment variables
    Qt Code:
    1. JAVA_HOME "C:\Program Files\Java\jdk1.7.0_51"
    To copy to clipboard, switch view to plain text mode 

    Now i get an new error, but im not sure why Qt is missing "moc_qabstractanimation.cpp", can you help me?
    Qt Code:
    1. mingw32-make[3]: Entering directory 'C:/android-build/qtbase/src/corelib'
    2. mingw32-make -f Makefile.Release
    3. mingw32-make[4]: Entering directory 'C:/android-build/qtbase/src/corelib'
    4. g++ -x c++-header -c -pipe -fno-keep-inline-dllexport -O2 -std=gnu++0x -fexcepti
    5. ons -mthreads -frtti -Wall -Wextra -DUNICODE -DQT_NO_XKBCOMMON -DQT_NO_USING_NAM
    6. ESPACE -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -DQT_ASCII_CAST_WARNINGS -DQT_MOC_CO
    7. MPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BE
    8. FORE=0x040800 -D_USE_MATH_DEFINES -DQT_USE_ICU -DPCRE_HAVE_CONFIG_H -DPCRE_STATI
    9. C -DQT_CORE_LIB -DQT_NO_DEBUG -IC:\qt\qtbase\src\corelib -I"C:\qt\qtbase\include
    10. " -I"C:\qt\qtbase\include\QtCore" -I"C:\qt\qtbase\include\QtCore\5.2.1" -I"C:\qt
    11. \qtbase\include\QtCore\5.2.1\QtCore" -I"tmp" -I"global" -I"C:\qt\qtbase\src\3rdp
    12. arty\pcre" -I"C:\qt\qtbase\src\3rdparty\harfbuzz\src" -I"C:\qt\qtbase\src\3rdpar
    13. ty\md5" -I"C:\qt\qtbase\src\3rdparty\md4" -I"C:\qt\qtbase\src\3rdparty\sha3" -I"
    14. .moc\release" -I"C:\qt\qtbase\include" -I"C:\icu\include" -I"." -I"C:\qt\qtbase\
    15. mkspecs\win32-g++" -o .pch\release\qt_pch.h.gch\c++ C:\qt\qtbase\src\corelib\glo
    16. bal\qt_pch.h
    17. g++ -c -include .pch\release\qt_pch.h -pipe -fno-keep-inline-dllexport -O2 -std=
    18. gnu++0x -fexceptions -mthreads -frtti -Wall -Wextra -DUNICODE -DQT_NO_XKBCOMMON
    19. -DQT_NO_USING_NAMESPACE -DQT_BUILD_CORE_LIB -DQT_BUILDING_QT -DQT_ASCII_CAST_WAR
    20. NINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS -DQT_DISA
    21. BLE_DEPRECATED_BEFORE=0x040800 -D_USE_MATH_DEFINES -DQT_USE_ICU -DPCRE_HAVE_CONF
    22. IG_H -DPCRE_STATIC -DQT_CORE_LIB -DQT_NO_DEBUG -IC:\qt\qtbase\src\corelib -I"C:\
    23. qt\qtbase\include" -I"C:\qt\qtbase\include\QtCore" -I"C:\qt\qtbase\include\QtCor
    24. e\5.2.1" -I"C:\qt\qtbase\include\QtCore\5.2.1\QtCore" -I"tmp" -I"global" -I"C:\q
    25. t\qtbase\src\3rdparty\pcre" -I"C:\qt\qtbase\src\3rdparty\harfbuzz\src" -I"C:\qt\
    26. qtbase\src\3rdparty\md5" -I"C:\qt\qtbase\src\3rdparty\md4" -I"C:\qt\qtbase\src\3
    27. rdparty\sha3" -I".moc\release" -I"C:\qt\qtbase\include" -I"C:\icu\include" -I"."
    28. -I"C:\qt\qtbase\mkspecs\win32-g++" -o .obj\release\qabstractanimation.o C:\qt\q
    29. tbase\src\corelib\animation\qabstractanimation.cpp
    30. C:\qt\qtbase\src\corelib\animation\qabstractanimation.cpp:1434:38: fatal error:
    31. moc_qabstractanimation.cpp: No such file or directory
    32. #include "moc_qabstractanimation.cpp"
    33. ^
    34. compilation terminated.
    35. Makefile.Release:9884: recipe for target '.obj/release/qabstractanimation.o' fai
    36. led
    37. mingw32-make[4]: *** [.obj/release/qabstractanimation.o] Error 1
    38. mingw32-make[4]: Leaving directory 'C:/android-build/qtbase/src/corelib'
    39. Makefile:34: recipe for target 'release' failed
    40. mingw32-make[3]: *** [release] Error 2
    41. mingw32-make[3]: Leaving directory 'C:/android-build/qtbase/src/corelib'
    42. Makefile:132: recipe for target 'sub-corelib-make_first' failed
    43. mingw32-make[2]: *** [sub-corelib-make_first] Error 2
    44. mingw32-make[2]: Leaving directory 'C:/android-build/qtbase/src'
    45. Makefile:41: recipe for target 'sub-src-make_first' failed
    46. mingw32-make[1]: *** [sub-src-make_first] Error 2
    47. mingw32-make[1]: Leaving directory 'C:/android-build/qtbase'
    48. Makefile:56: recipe for target 'module-qtbase-make_first' failed
    49. mingw32-make: *** [module-qtbase-make_first] Error 2
    To copy to clipboard, switch view to plain text mode 

    Thanks in advance

Similar Threads

  1. Android and MinGW?
    By UGP.ir in forum Newbie
    Replies: 5
    Last Post: 19th January 2014, 23:52
  2. Qt 5.0.0 Build Issues Mingw
    By Sajjmon in forum Installation and Deployment
    Replies: 0
    Last Post: 23rd January 2013, 11:31
  3. Qt Creator How to build QtCreator with mingw?
    By FinderCheng in forum Qt Tools
    Replies: 0
    Last Post: 28th August 2011, 02:41
  4. Build ncreport using mingw qt
    By rivci in forum Qt Programming
    Replies: 0
    Last Post: 5th April 2011, 14:57
  5. Build LibTorrent to .lib Mingw
    By nhs_0702 in forum Qt Programming
    Replies: 0
    Last Post: 2nd April 2010, 13:01

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.