Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. [SOLVED]Cannot compile Qt 5.2 from Git for Android including mysql support
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]Cannot compile Qt 5.2 from Git for Android including mysql support

Scheduled Pinned Locked Moved Installation and Deployment
13 Posts 4 Posters 9.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kshots
    wrote on last edited by
    #4

    ... and here's how you get iconv to compile: Grab the sources, and in the source dir, do the following:

    @STRIP="$BR"strip RANLIB="$BR"ranlib OBJDUMP="$BR"objdump AR="$BR"ar CC="$BR"gcc CFLAGS=--sysroot=$SR CPP="$BR"cpp CPPFLAGS=$CFLAGS ./configure --build=x86_64 --host=arm --prefix=$SR/usr --with-sysroot=$SR && make install@

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #5

      Hi and welcome to devnet,

      Thanks for sharing your solution. You could create a wiki page with the complete solution. It might be easier for other forum users to find it.

      In between, please update the thread title to solved, so other forum user may know a solution has been found :)

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kshots
        wrote on last edited by
        #6

        You're probably right. I wrote up a wiki "here":http://qt-project.org/wiki/Build_Qt5_mysql_plugin_for_Android

        1 Reply Last reply
        0
        • P Offline
          P Offline
          projetoslinux
          wrote on last edited by
          #7

          Hi for all

          this wiki is great

          I have sucess but only in 2 last commands , i have error
          its possible help-me

          my ubuntu is 12.04
          my dir is /home/fuinha/Qt5.2.0/5.2.0/

          my error in

          "$BR"objdump -p libqsqlmysql.so | grep NEEDED

          -->> 'libqsqlmysql.so': No such file

          why NEEDED

          im my /Qt5.2.0/5.2.0/Src/qtbase/src/plugins/sqldrivers/mysql$

          ../../../../bin/qmake "INCLUDEPATH+=$SR/usr/include/mariadb" "LIBS+=$SR/usr/lib/mariadb/libmariadbclient.a $SR/usr/lib/libssl.a $SR/usr/lib/libcrypto.a $SR/usr/lib/libiconv.a" "LIBPATH+=$SR/usr/lib/mariadb" -o Makefile mysql.pro && make install

          -->>bash: ../../../../bin/qmake: No such file or directory

          i work in
          /home/fuinha/Qt5.2.0/5.2.0/gcc_64/bin/qmake "INCLUDEPATH+=$SR/usr/include/mariadb" "LIBS+=$SR/usr/lib/mariadb/libmariadbclient.a $SR/usr/lib/libssl.a $SR/usr/lib/libcrypto.a $SR/usr/lib/libiconv.a" "LIBPATH+=$SR/usr/lib/mariadb" -o Makefile mysql.pro && make install

          -->> .../gcc_64/include/QtCore -I.moc main.cpp -o .moc/main.moc
          moc: Cannot create .moc/main.moc
          make: *** [.moc/main.moc] Error 1

          and
          /home/fuinha/Qt5.2.0/5.2.0/android_armv7/bin/qmake "INCLUDEPATH+=$SR/usr/include/mariadb" "LIBS+=$SR/usr/lib/mariadb/libmariadbclient.a $SR/usr/lib/libssl.a $SR/usr/lib/libcrypto.a $SR/usr/lib/libiconv.a" "LIBPATH+=$SR/usr/lib/mariadb" -o Makefile mysql.pro && make install

          ---->>>
          Project ERROR: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK.
          Could not read qmake configuration file /home/fuinha/Qt5.2.0/5.2.0/Src/qtbase/mkspecs/android-g++/qmake.conf.
          Error processing project file: mysql.pro

          Sorry for my newbie questions and thanks for help-me

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kshots
            wrote on last edited by
            #8

            The first error you posted:

            ../../../../bin/qmake “INCLUDEPATH+=$SR/usr/include/mariadb” “LIBS+=$SR/usr/lib/mariadb/libmariadbclient.a $SR/usr/lib/libssl.a $SR/usr/lib/libcrypto.a $SR/usr/lib/libiconv.a” “LIBPATH+=$SR/usr/lib/mariadb” -o Makefile mysql.pro && make install

            —>>bash: ../../../../bin/qmake: No such file or directory

            Implies that you did not build qt before executing those commands. You must first build qt 5.2.0 (as you have selected) with whatever options you want, minus the mysql database options. This will in turn produce the "qmake" executable that the error shows was never generated. This specific executable has all the correct parameters configured for android, which is why you need to use it rather than whatever version of Qt may be installed with your system.

            1 Reply Last reply
            0
            • K Offline
              K Offline
              kshots
              wrote on last edited by
              #9

              I also just noticed this section of your post:

              “$BR“objdump -p libqsqlmysql.so | grep NEEDED

              —>> ‘libqsqlmysql.so’: No such file

              why NEEDED

              Checking the wiki, it appears someone added a bit after my initial posting (one of the nice things about wikis :)). Whoever added that, what they're saying is that you need to add a list of dependencies to the APK image, and grepping for "NEEDED" will tell you what the dependencies for the plugin are (which should be the dependencies I listed at the top, but this is a good thing to check). You also need to do this after successfully building the plugin (which is why it couldn't find it), so given your problem with building the plugin, you shouldn't be running this yet.

              1 Reply Last reply
              0
              • P Offline
                P Offline
                projetoslinux
                wrote on last edited by
                #10

                thanks i testing

                1 Reply Last reply
                0
                • P Offline
                  P Offline
                  projetoslinux
                  wrote on last edited by
                  #11

                  tHANK YOU SOLVED FOR ME !!!!

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    chjichin
                    wrote on last edited by
                    #12

                    Hi all,
                    I follow above steps to compiler, at the final step, i got the error message, pls help me, tks!
                    pos@pos-MS-7817:~/adt/qt5/qtbase/src/plugins/sqldrivers/mysql$ SR=~/adt/android-ndk-r10d/platforms/android-9/arch-arm
                    pos@pos-MS-7817:~/adt/qt5/qtbase/src/plugins/sqldrivers/mysql$ BR=~/adt/android-ndk-r10d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-
                    pos@pos-MS-7817:~/adt/qt5/qtbase/src/plugins/sqldrivers/mysql$ ../../../../bin/qmake "INCLUDEPATH+=$SR/usr/include/mariadb" "LIBS+=$SR/usr/lib/mariadb/libmariadbclient.a $SR/usr/lib/libssl.a $SR/usr/lib/libcrypto.a $SR/usr/lib/libiconv.a" "LIBPATH+=$SR/usr/lib/mariadb" -o Makefile mysql.pro && make install
                    rm -f libqsqlmysql.so
                    g++ -Wl,--no-undefined -Wl,-O1 -fuse-ld=gold -Wl,-rpath,/usr/local/Qt-5.4.0/lib -shared -o libqsqlmysql.so .obj/main.o .obj/qsql_mysql.o .obj/moc_qsql_mysql_p.o -L/home/pos/adt/android-ndk-r10d/platforms/android-9/arch-arm/usr/lib/mariadb /home/pos/adt/android-ndk-r10d/platforms/android-9/arch-arm/usr/lib/mariadb/libmariadbclient.a /home/pos/adt/android-ndk-r10d/platforms/android-9/arch-arm/usr/lib/libssl.a /home/pos/adt/android-ndk-r10d/platforms/android-9/arch-arm/usr/lib/libcrypto.a /home/pos/adt/android-ndk-r10d/platforms/android-9/arch-arm/usr/lib/libiconv.a -lmysqlclient -L/home/pos/adt/qt5/qtbase/lib -lQt5Sql -lQt5Core -lpthread
                    /usr/bin/ld.gold: fatal error: /home/pos/adt/android-ndk-r10d/platforms/android-9/arch-arm/usr/lib/mariadb/libmariadbclient.a(libmariadb.c.o): unsupported ELF machine number 40
                    collect2: error: ld returned 1 exit status
                    make: *** [../../../../plugins/sqldrivers/libqsqlmysql.so] Error 1
                    pos@pos-MS-7817:~/adt/qt5/qtbase/src/plugins/sqldrivers/mysql$

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      chjichin
                      wrote on last edited by
                      #13

                      Hi all,
                      I follow above steps to compiler, at the final step, i got the error message, pls help me, tks!
                      pos@pos-MS-7817:~/adt/qt5/qtbase/src/plugins/sqldrivers/mysql$ SR=~/adt/android-ndk-r10d/platforms/android-9/arch-arm
                      pos@pos-MS-7817:~/adt/qt5/qtbase/src/plugins/sqldrivers/mysql$ BR=~/adt/android-ndk-r10d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-
                      pos@pos-MS-7817:~/adt/qt5/qtbase/src/plugins/sqldrivers/mysql$ ../../../../bin/qmake "INCLUDEPATH+=$SR/usr/include/mariadb" "LIBS+=$SR/usr/lib/mariadb/libmariadbclient.a $SR/usr/lib/libssl.a $SR/usr/lib/libcrypto.a $SR/usr/lib/libiconv.a" "LIBPATH+=$SR/usr/lib/mariadb" -o Makefile mysql.pro && make install
                      rm -f libqsqlmysql.so
                      g++ -Wl,--no-undefined -Wl,-O1 -fuse-ld=gold -Wl,-rpath,/usr/local/Qt-5.4.0/lib -shared -o libqsqlmysql.so .obj/main.o .obj/qsql_mysql.o .obj/moc_qsql_mysql_p.o -L/home/pos/adt/android-ndk-r10d/platforms/android-9/arch-arm/usr/lib/mariadb /home/pos/adt/android-ndk-r10d/platforms/android-9/arch-arm/usr/lib/mariadb/libmariadbclient.a /home/pos/adt/android-ndk-r10d/platforms/android-9/arch-arm/usr/lib/libssl.a /home/pos/adt/android-ndk-r10d/platforms/android-9/arch-arm/usr/lib/libcrypto.a /home/pos/adt/android-ndk-r10d/platforms/android-9/arch-arm/usr/lib/libiconv.a -lmysqlclient -L/home/pos/adt/qt5/qtbase/lib -lQt5Sql -lQt5Core -lpthread
                      /usr/bin/ld.gold: fatal error: /home/pos/adt/android-ndk-r10d/platforms/android-9/arch-arm/usr/lib/mariadb/libmariadbclient.a(libmariadb.c.o): unsupported ELF machine number 40
                      collect2: error: ld returned 1 exit status
                      make: *** [../../../../plugins/sqldrivers/libqsqlmysql.so] Error 1
                      pos@pos-MS-7817:~/adt/qt5/qtbase/src/plugins/sqldrivers/mysql$

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved