Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt5.2 + Android + MySQL / PostgreSQL
Forum Updated to NodeBB v4.3 + New Features

Qt5.2 + Android + MySQL / PostgreSQL

Scheduled Pinned Locked Moved Mobile and Embedded
22 Posts 8 Posters 15.9k Views 3 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    For that the first thing needed would be android build of the MySQL and PostgreSQL library (arm version)

    I am not aware of android providing them. I might be wrong though and be happy to be proven so.

    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
    • R Offline
      R Offline
      RazZziel
      wrote on last edited by
      #3

      And isn't Qt able to provide a binary? Is that for licensing reasons or something?

      I've finally followed "this tutorial":http://qt-project.org/wiki/Build_Qt5_mysql_plugin_for_Android, and got it building. As I assume being forced to compile these libraries is as much as a pain in the ass for you, random Internet dwellers, as it is for me, I've automated the process: http://pastebin.com/i7QU10hq

      A lot of stuff is hardcoded, but it works for me, and it should be pretty easy to modify for your systems and needs.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        RazZziel
        wrote on last edited by
        #4

        Patched to rename libmariadb.so.1 to libmariadb.so http://pastebin.com/0saJePF9

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

          I don't know all the details but what comes to my mind is indeed licensing. Also, that would mean building these libraries on all supported platform (not all have e.g. MySQL) and include them in Qt's source code etc. Not practical at all

          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
          • P Offline
            P Offline
            projetoslinux
            wrote on last edited by
            #6

            hi Razziel its possible you send to me your http://pastebin.com/i7QU10hq
            dont have more in link

            1 Reply Last reply
            0
            • R Offline
              R Offline
              RazZziel
              wrote on last edited by
              #7

              I'm sorry I couldn't reply your pm. projetoslinux
              Here you go: http://pastebin.com/RTmFL8fZ

              1 Reply Last reply
              0
              • R Offline
                R Offline
                RazZziel
                wrote on last edited by
                #8

                Updated version for Qt 5.2.1: http://pastebin.com/k1u6gNe2

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  Muhammad
                  wrote on last edited by
                  #9

                  Hello Guys I've Qt 5.2.1 x86 for Android, I'm using windows 8 64bit. and I don't know what exactly should I do to make my application that uses MySQL works in Android.
                  Note: the Application works fine on desktop.
                  Please help

                  I don't have endpoint, I just have Checkpoints.

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    RazZziel
                    wrote on last edited by
                    #10

                    I guess you should do something similar to what is being done in my scripts, but for Windows instead of Linux. Or maybe someone has the libraries compiled for Android x86 and can upload them?

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      Muhammad
                      wrote on last edited by
                      #11

                      @RazZziel
                      In your script you have used mariadb should I do the same or it is good to use the MySQL Connector since I only need to connect to MySQL and in the Tutorial you followed they mentioned mariaDB and MySQL as two option, which as I understand only one of them should be done, Am I right?

                      Thanks

                      I don't have endpoint, I just have Checkpoints.

                      1 Reply Last reply
                      0
                      • R Offline
                        R Offline
                        RazZziel
                        wrote on last edited by
                        #12

                        MariaDB and MySQL are compatible; I used MariaDB because is what was being used on the tutorial I followed (I didn't make it), but I'm using it to connect both to MySQL and MariaDB servers. However indeed you only need one client library, either MySQL or MariaDB.

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

                          sorry for this RAzZziel, but dont load, stay longer for 2 months, its possible send to me your script
                          projetoslinux@gmail.com

                          thanks

                          [quote author="RazZziel" date="1395676332"]Updated version for Qt 5.2.1: http://pastebin.com/k1u6gNe2[/quote]

                          1 Reply Last reply
                          0
                          • R Offline
                            R Offline
                            RazZziel
                            wrote on last edited by
                            #14

                            This one shouldn't expire: http://pastebin.com/2A3EZQKA
                            Nor this one: https://gist.github.com/RazZziel/fd607459c1f07a43cdf9

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

                              Thank you very much RazZziel !!!!

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

                                Hi
                                [quote author="RazZziel" date="1400018116"]This one shouldn't expire: http://pastebin.com/2A3EZQKA
                                Nor this one: https://gist.github.com/RazZziel/fd607459c1f07a43cdf9[/quote]

                                this compile Ok but in running mode
                                W/Qt ( 6583): kernel/qsqldatabase.cpp:785 (void QSqlDatabasePrivate::init(const QString&)): QSqlDatabase: QMYSQL driver not loaded
                                W/Qt ( 6583): kernel/qsqldatabase.cpp:786 (void QSqlDatabasePrivate::init(const QString&)): QSqlDatabase: available drivers: QSQLITE
                                D/Qt ( 6583): ../POSlinux/src/hal/maintablehal2.cpp:10396 (int MainTablehal2::ServerConexionM(int)): Conexxion ext Error

                                not load
                                how i can load this plugin, in linux my program work normally
                                but in Android not load after use your EXCELLENT !!!! script

                                why i'm doing wrong ?????

                                1 Reply Last reply
                                0
                                • A Offline
                                  A Offline
                                  antreimer
                                  wrote on last edited by
                                  #17

                                  I created a wiki post on how to build and use postgresql plugin
                                  http://qt-project.org/wiki/Build_Qt5_postgresql_plugin_for_Android

                                  Here are the resulting libraries
                                  https://drive.google.com/folderview?id=0ByPpOAN5EsHKfmgwRTFvQUl5Z1NvUnlYMHptTEs0d2xEc24xZ19Jb0ZDMTBpb3JDQ014ZkU

                                  1 Reply Last reply
                                  0
                                  • A Offline
                                    A Offline
                                    antreimer
                                    wrote on last edited by
                                    #18

                                    I created a wiki post on how to build and use postgresql plugin
                                    http://qt-project.org/wiki/Build_Qt5_postgresql_plugin_for_Android

                                    Here are the resulting libraries
                                    https://drive.google.com/folderview?id=0ByPpOAN5EsHKfmgwRTFvQUl5Z1NvUnlYMHptTEs0d2xEc24xZ19Jb0ZDMTBpb3JDQ014ZkU

                                    1 Reply Last reply
                                    0
                                    • R RazZziel

                                      This one shouldn't expire: http://pastebin.com/2A3EZQKA
                                      Nor this one: https://gist.github.com/RazZziel/fd607459c1f07a43cdf9

                                      H Offline
                                      H Offline
                                      HPCTECH
                                      wrote on last edited by HPCTECH
                                      #19

                                      @RazZziel said:

                                      This one shouldn't expire: http://pastebin.com/2A3EZQKA
                                      Nor this one: https://gist.github.com/RazZziel/fd607459c1f07a43cdf9

                                      After moving to qt.io the above patch doesn't work fine so I modified the new one a little bit everything went fine but when the patch arrived to Qt mysql pluing it failed because of the following error:

                                      /home/hpctech-work/.Qt/android-ndk-r10e//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove -std=c++11 -O2 -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -mthumb -fvisibility=hidden -fvisibility-inlines-hidden -D_REENTRANT -Wall -Wno-psabi -W -fPIC -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -isystem /home/hpctech-work/.Qt/android-ndk-r10e/platforms/android-9/arch-arm/usr/include/mariadb -I/home/hpctech-work/.Qt/5.5/android_armv7/include -I/home/hpctech-work/.Qt/5.5/android_armv7/include/QtSql -I/home/hpctech-work/.Qt/5.5/android_armv7/include/QtCore -I. -isystem /home/hpctech-work/.Qt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.8/include -isystem /home/hpctech-work/.Qt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -isystem /home/hpctech-work/.Qt/android-ndk-r10e/platforms/android-9/arch-arm/usr/include -I/home/hpctech-work/.Qt/5.5/android_armv7/mkspecs/android-g++ -o main.o main.cpp
                                      In file included from /home/hpctech-work/.Qt/5.5/android_armv7/include/QtCore/qnamespace.h:37:0,
                                                       from /home/hpctech-work/.Qt/5.5/android_armv7/include/QtCore/qobjectdefs.h:41,
                                                       from /home/hpctech-work/.Qt/5.5/android_armv7/include/QtCore/qobject.h:40,
                                                       from /home/hpctech-work/.Qt/5.5/android_armv7/include/QtCore/qplugin.h:37,
                                                       from /home/hpctech-work/.Qt/5.5/android_armv7/include/QtSql/qsqldriverplugin.h:37,
                                                       from main.cpp:42:
                                      /home/hpctech-work/.Qt/5.5/android_armv7/include/QtCore/qglobal.h:693:47: error: expected constructor, destructor, or type conversion before 'static_assert'
                                       #define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
                                                                                     ^
                                      /home/hpctech-work/.Qt/5.5/android_armv7/include/QtCore/qplugin.h:136:5: note: in expansion of macro 'Q_STATIC_ASSERT_X'
                                           Q_STATIC_ASSERT_X(false, "Old plugin system used")
                                           ^
                                      main.cpp:80:1: note: in expansion of macro 'Q_EXPORT_PLUGIN2'
                                       Q_EXPORT_PLUGIN2(qsqlmysql, QMYSQLDriverPlugin)
                                       ^
                                      make: *** [main.o] Error 1
                                      Changes:
                                      diff: ./rootfs_files_before.txt: No such file or directory
                                      hpctech-work@hpctech-work ~/HPCTECH/Projects/MysqlClient/build-libmysql-android $
                                      

                                      How can I fix this issue?

                                      The full modified patch file is:

                                      #!/bin/bash
                                      
                                      # Based on http://qt-project.org/wiki/Build_Qt5_mysql_plugin_for_Android
                                      
                                      export ANDROID_NDK_ROOT="$HOME/.Qt/android-ndk-r10e/"
                                      export QT_ROOT="$HOME/.Qt/5.5/"
                                      
                                      SR="$ANDROID_NDK_ROOT/platforms/android-9/arch-arm/"
                                      BR="$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-"
                                      
                                      here="$(dirname "$0")"
                                      find "$SR" > "$here/rootfs_files_before.txt" || exit 1
                                      checkChanges() {
                                              find "$SR" > "$here/rootfs_files_after.txt" || exit 1
                                              echo "Changes:"
                                              diff -u "$here/rootfs_files_before.txt" "$here/rootfs_files_after.txt"
                                      }
                                      trap checkChanges EXIT
                                      
                                      # OpenSSL
                                      #pkg=openssl-1.0.1f.tar.gz
                                      #pkg=openssl-1.0.1e.tar.gz
                                      pkg=openssl-1.0.2d.tar.gz
                                      dir=$(basename $pkg .tar.gz)
                                      
                                      if [ ! -d $dir ]; then
                                              wget -c http://www.openssl.org/source/$pkg
                                              tar -xf $pkg || exit 1
                                      fi
                                      
                                      pushd $dir
                                              RANLIB="$BR"ranlib CC="$BR"gcc ./Configure android-armv7 --prefix=$SR/usr
                                              ANDROID_DEV=$SR/usr make #|| exit 1
                                              ANDROID_DEV=$SR/usr make || exit 1
                                              make install_sw || exit 1
                                      popd
                                      
                                      
                                      # libiconv
                                      pkg=libiconv-1.14.tar.gz
                                      dir=$(basename $pkg .tar.gz)
                                      
                                      if [ ! -d $dir ]; then
                                              wget -c http://ftp.gnu.org/pub/gnu/libiconv/$pkg
                                              tar -xf $pkg || exit 1
                                      fi
                                      
                                      pushd $dir
                                              STRIP="$BR"strip RANLIB="$BR"ranlib OBJDUMP="$BR"objdump AR="$BR"ar CC="$BR"gcc CFLAGS=--sysroot=$SR CPP="$BR"cpp CPPFLAGS=$CFLAGS ./configure --host=arm --prefix=$SR/usr --with-sysroot=$SR
                                              make || exit 1
                                              make install || exit 1
                                      popd
                                      
                                      
                                      # mariadbclient
                                      
                                      version=2.0.0
                                      pkg=mariadb_client-$version-src.tar.gz
                                      url=https://downloads.mariadb.org/f/client-native-$version/src/$pkg
                                      
                                      # FIXME: This one fails to build, linker errors
                                      #version=2.1.0
                                      #pkg=mariadb-connector-c-$version-src.tar.gz
                                      #url=https://downloads.mariadb.org/f/connector-c-$version/source-tgz/$pkg
                                      
                                      dir=$(basename $pkg .tar.gz)
                                      if [ ! -d $dir ]; then
                                              wget -c $url
                                              tar -xf $pkg || exit 1
                                      fi
                                      
                                      pushd $dir
                                              sed -i -e "s|ADD_SUBDIRECTORY(unittest/libmariadb)|#ADD_SUBDIRECTORY(unittest/libmariadb)|" CMakeLists.txt
                                              sed -i -e "N; s|typedef unsigned short ushort;\n#endif|#endif\ntypedef unsigned short ushort;|" include/my_global.h
                                              sed -i -e "N; s|SET_TARGET_PROPERTIES(libmariadb PROPERTIES VERSION.*||" libmariadb/CMakeLists.txt
                                              sed -i -e "N; s|SOVERSION \${CPACK_PACKAGE_VERSION_MAJOR})||" libmariadb/CMakeLists.txt # Pig disgusting: the previous multiline thingie should've done it
                                              sed -i -e "N; s|\${CPACK_PACKAGE_VERSION_MAJOR}||" libmariadb/CMakeLists.txt # Pig disgusting: what the fuck
                                              mkdir build
                                              pushd build
                                              PKG_CONFIG_PATH=$SR/usr/lib/pkgconfig cmake \
                                      		-DCMAKE_BUILD_TYPE=Release \
                                      		-DCMAKE_C_FLAGS=--sysroot="$SR" \
                                      		-DCMAKE_INSTALL_PREFIX="$SR/usr" \
                                      		-DCMAKE_C_COMPILER="$BR"gcc \
                                      		-DCMAKE_LINKER="$BR"ld \
                                      		-DCMAKE_AR="$BR"ar \
                                      		-DCMAKE_NM="$BR"nm \
                                      		-DCMAKE_OBJCOPY="$BR"objcopy \
                                      		-DCMAKE_OBJDUMP="$BR"objdump \
                                      		-DCMAKE_RANLIB="$BR"ranlib \
                                      		-DCMAKE_STRIP="$BR"strip \
                                      		-DICONV_INCLUDE_DIR="$SR/usr/include" \
                                      		-DICONV_LIBRARIES="$SR/usr/lib/libiconv.a" \
                                      		-DWITH_EXTERNAL_ZLIB=ON \
                                      		-DZLIB_INCLUDE_DIR="$SR/usr/include" \
                                      		-DZLIB_LIBRARY="$SR/usr/lib/libz.so" ../ || exit 1
                                              make install || exit 1
                                              popd
                                      
                                              # ???
                                              pwd
                                              cp build/libmariadb/*.{a,so} "$SR/usr/lib/mariadb/" || exit 1
                                      popd
                                      
                                      
                                      # qt
                                      qmake="$QT_ROOT/android_armv7/bin/qmake"
                                      [ ! -f "$qmake" ] && { echo "Could not find qmake in '$qmake'"; exit 1; }
                                      [ ! -x "$qmake" ] && { echo "Qmake is not executable in '$qmake'"; exit 1; }
                                      qtVersion=$(qmake -query QT_VERSION)
                                      
                                      pkg=qt-everywhere-opensource-src-$qtVersion.tar.gz
                                      #pkg=qtbase-opensource-src-$qtVersion.tar.gz
                                      dir=$(basename $pkg .tar.gz)
                                      
                                      if [ ! -d $dir ]; then
                                      #        wget -c http://download.qt.io/official_releases/qt/${qtVersion%.*}/$qtVersion/submodules/$pkg
                                              wget -c http://download.qt.io/official_releases/qt/${qtVersion%.*}/$qtVersion/$pkg
                                              tar -xf $pkg || exit 1
                                      fi
                                      
                                      pushd $dir/src/plugins/sqldrivers/mysql/
                                              $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 || exit 1
                                              make install || exit 1
                                      popd
                                      
                                      
                                      echo
                                      echo "BOOYAH!!!"
                                      echo
                                      
                                      
                                      H 1 Reply Last reply
                                      0
                                      • H HPCTECH

                                        @RazZziel said:

                                        This one shouldn't expire: http://pastebin.com/2A3EZQKA
                                        Nor this one: https://gist.github.com/RazZziel/fd607459c1f07a43cdf9

                                        After moving to qt.io the above patch doesn't work fine so I modified the new one a little bit everything went fine but when the patch arrived to Qt mysql pluing it failed because of the following error:

                                        /home/hpctech-work/.Qt/android-ndk-r10e//toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -c -Wno-psabi -march=armv7-a -mfloat-abi=softfp -mfpu=vfp -ffunction-sections -funwind-tables -fstack-protector -fno-short-enums -DANDROID -Wa,--noexecstack -fno-builtin-memmove -std=c++11 -O2 -Os -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -mthumb -fvisibility=hidden -fvisibility-inlines-hidden -D_REENTRANT -Wall -Wno-psabi -W -fPIC -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -isystem /home/hpctech-work/.Qt/android-ndk-r10e/platforms/android-9/arch-arm/usr/include/mariadb -I/home/hpctech-work/.Qt/5.5/android_armv7/include -I/home/hpctech-work/.Qt/5.5/android_armv7/include/QtSql -I/home/hpctech-work/.Qt/5.5/android_armv7/include/QtCore -I. -isystem /home/hpctech-work/.Qt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.8/include -isystem /home/hpctech-work/.Qt/android-ndk-r10e/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -isystem /home/hpctech-work/.Qt/android-ndk-r10e/platforms/android-9/arch-arm/usr/include -I/home/hpctech-work/.Qt/5.5/android_armv7/mkspecs/android-g++ -o main.o main.cpp
                                        In file included from /home/hpctech-work/.Qt/5.5/android_armv7/include/QtCore/qnamespace.h:37:0,
                                                         from /home/hpctech-work/.Qt/5.5/android_armv7/include/QtCore/qobjectdefs.h:41,
                                                         from /home/hpctech-work/.Qt/5.5/android_armv7/include/QtCore/qobject.h:40,
                                                         from /home/hpctech-work/.Qt/5.5/android_armv7/include/QtCore/qplugin.h:37,
                                                         from /home/hpctech-work/.Qt/5.5/android_armv7/include/QtSql/qsqldriverplugin.h:37,
                                                         from main.cpp:42:
                                        /home/hpctech-work/.Qt/5.5/android_armv7/include/QtCore/qglobal.h:693:47: error: expected constructor, destructor, or type conversion before 'static_assert'
                                         #define Q_STATIC_ASSERT_X(Condition, Message) static_assert(bool(Condition), Message)
                                                                                       ^
                                        /home/hpctech-work/.Qt/5.5/android_armv7/include/QtCore/qplugin.h:136:5: note: in expansion of macro 'Q_STATIC_ASSERT_X'
                                             Q_STATIC_ASSERT_X(false, "Old plugin system used")
                                             ^
                                        main.cpp:80:1: note: in expansion of macro 'Q_EXPORT_PLUGIN2'
                                         Q_EXPORT_PLUGIN2(qsqlmysql, QMYSQLDriverPlugin)
                                         ^
                                        make: *** [main.o] Error 1
                                        Changes:
                                        diff: ./rootfs_files_before.txt: No such file or directory
                                        hpctech-work@hpctech-work ~/HPCTECH/Projects/MysqlClient/build-libmysql-android $
                                        

                                        How can I fix this issue?

                                        The full modified patch file is:

                                        #!/bin/bash
                                        
                                        # Based on http://qt-project.org/wiki/Build_Qt5_mysql_plugin_for_Android
                                        
                                        export ANDROID_NDK_ROOT="$HOME/.Qt/android-ndk-r10e/"
                                        export QT_ROOT="$HOME/.Qt/5.5/"
                                        
                                        SR="$ANDROID_NDK_ROOT/platforms/android-9/arch-arm/"
                                        BR="$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-"
                                        
                                        here="$(dirname "$0")"
                                        find "$SR" > "$here/rootfs_files_before.txt" || exit 1
                                        checkChanges() {
                                                find "$SR" > "$here/rootfs_files_after.txt" || exit 1
                                                echo "Changes:"
                                                diff -u "$here/rootfs_files_before.txt" "$here/rootfs_files_after.txt"
                                        }
                                        trap checkChanges EXIT
                                        
                                        # OpenSSL
                                        #pkg=openssl-1.0.1f.tar.gz
                                        #pkg=openssl-1.0.1e.tar.gz
                                        pkg=openssl-1.0.2d.tar.gz
                                        dir=$(basename $pkg .tar.gz)
                                        
                                        if [ ! -d $dir ]; then
                                                wget -c http://www.openssl.org/source/$pkg
                                                tar -xf $pkg || exit 1
                                        fi
                                        
                                        pushd $dir
                                                RANLIB="$BR"ranlib CC="$BR"gcc ./Configure android-armv7 --prefix=$SR/usr
                                                ANDROID_DEV=$SR/usr make #|| exit 1
                                                ANDROID_DEV=$SR/usr make || exit 1
                                                make install_sw || exit 1
                                        popd
                                        
                                        
                                        # libiconv
                                        pkg=libiconv-1.14.tar.gz
                                        dir=$(basename $pkg .tar.gz)
                                        
                                        if [ ! -d $dir ]; then
                                                wget -c http://ftp.gnu.org/pub/gnu/libiconv/$pkg
                                                tar -xf $pkg || exit 1
                                        fi
                                        
                                        pushd $dir
                                                STRIP="$BR"strip RANLIB="$BR"ranlib OBJDUMP="$BR"objdump AR="$BR"ar CC="$BR"gcc CFLAGS=--sysroot=$SR CPP="$BR"cpp CPPFLAGS=$CFLAGS ./configure --host=arm --prefix=$SR/usr --with-sysroot=$SR
                                                make || exit 1
                                                make install || exit 1
                                        popd
                                        
                                        
                                        # mariadbclient
                                        
                                        version=2.0.0
                                        pkg=mariadb_client-$version-src.tar.gz
                                        url=https://downloads.mariadb.org/f/client-native-$version/src/$pkg
                                        
                                        # FIXME: This one fails to build, linker errors
                                        #version=2.1.0
                                        #pkg=mariadb-connector-c-$version-src.tar.gz
                                        #url=https://downloads.mariadb.org/f/connector-c-$version/source-tgz/$pkg
                                        
                                        dir=$(basename $pkg .tar.gz)
                                        if [ ! -d $dir ]; then
                                                wget -c $url
                                                tar -xf $pkg || exit 1
                                        fi
                                        
                                        pushd $dir
                                                sed -i -e "s|ADD_SUBDIRECTORY(unittest/libmariadb)|#ADD_SUBDIRECTORY(unittest/libmariadb)|" CMakeLists.txt
                                                sed -i -e "N; s|typedef unsigned short ushort;\n#endif|#endif\ntypedef unsigned short ushort;|" include/my_global.h
                                                sed -i -e "N; s|SET_TARGET_PROPERTIES(libmariadb PROPERTIES VERSION.*||" libmariadb/CMakeLists.txt
                                                sed -i -e "N; s|SOVERSION \${CPACK_PACKAGE_VERSION_MAJOR})||" libmariadb/CMakeLists.txt # Pig disgusting: the previous multiline thingie should've done it
                                                sed -i -e "N; s|\${CPACK_PACKAGE_VERSION_MAJOR}||" libmariadb/CMakeLists.txt # Pig disgusting: what the fuck
                                                mkdir build
                                                pushd build
                                                PKG_CONFIG_PATH=$SR/usr/lib/pkgconfig cmake \
                                        		-DCMAKE_BUILD_TYPE=Release \
                                        		-DCMAKE_C_FLAGS=--sysroot="$SR" \
                                        		-DCMAKE_INSTALL_PREFIX="$SR/usr" \
                                        		-DCMAKE_C_COMPILER="$BR"gcc \
                                        		-DCMAKE_LINKER="$BR"ld \
                                        		-DCMAKE_AR="$BR"ar \
                                        		-DCMAKE_NM="$BR"nm \
                                        		-DCMAKE_OBJCOPY="$BR"objcopy \
                                        		-DCMAKE_OBJDUMP="$BR"objdump \
                                        		-DCMAKE_RANLIB="$BR"ranlib \
                                        		-DCMAKE_STRIP="$BR"strip \
                                        		-DICONV_INCLUDE_DIR="$SR/usr/include" \
                                        		-DICONV_LIBRARIES="$SR/usr/lib/libiconv.a" \
                                        		-DWITH_EXTERNAL_ZLIB=ON \
                                        		-DZLIB_INCLUDE_DIR="$SR/usr/include" \
                                        		-DZLIB_LIBRARY="$SR/usr/lib/libz.so" ../ || exit 1
                                                make install || exit 1
                                                popd
                                        
                                                # ???
                                                pwd
                                                cp build/libmariadb/*.{a,so} "$SR/usr/lib/mariadb/" || exit 1
                                        popd
                                        
                                        
                                        # qt
                                        qmake="$QT_ROOT/android_armv7/bin/qmake"
                                        [ ! -f "$qmake" ] && { echo "Could not find qmake in '$qmake'"; exit 1; }
                                        [ ! -x "$qmake" ] && { echo "Qmake is not executable in '$qmake'"; exit 1; }
                                        qtVersion=$(qmake -query QT_VERSION)
                                        
                                        pkg=qt-everywhere-opensource-src-$qtVersion.tar.gz
                                        #pkg=qtbase-opensource-src-$qtVersion.tar.gz
                                        dir=$(basename $pkg .tar.gz)
                                        
                                        if [ ! -d $dir ]; then
                                        #        wget -c http://download.qt.io/official_releases/qt/${qtVersion%.*}/$qtVersion/submodules/$pkg
                                                wget -c http://download.qt.io/official_releases/qt/${qtVersion%.*}/$qtVersion/$pkg
                                                tar -xf $pkg || exit 1
                                        fi
                                        
                                        pushd $dir/src/plugins/sqldrivers/mysql/
                                                $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 || exit 1
                                                make install || exit 1
                                        popd
                                        
                                        
                                        echo
                                        echo "BOOYAH!!!"
                                        echo
                                        
                                        
                                        H Offline
                                        H Offline
                                        HPCTECH
                                        wrote on last edited by
                                        #20

                                        I fixed this issue by using the following modifications
                                        https://gist.github.com/hpctech/a16f94f7ac3524d49219#file-buildandroidmysql-sh

                                        1 Reply Last reply
                                        0
                                        • Y Offline
                                          Y Offline
                                          Yohan07
                                          wrote on last edited by
                                          #21

                                          Hi,

                                          Many thanks for "buildAndroidMysql.sh" !
                                          But i have a problem.
                                          When :

                                          PKG_CONFIG_PATH=$SR/usr/lib/pkgconfig cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS=--sysroot="$SR" -DCMAKE_INS
                                          TALL_PREFIX="$SR/usr" -DCMAKE_C_COMPILER="$BR"gcc -DCMAKE_LINKER="$BR"ld -DCMAKE_AR="$BR"ar -DCMAKE_NM="$BR"nm -DCMA
                                          KE_OBJCOPY="$BR"objcopy -DCMAKE_OBJDUMP="$BR"objdump -DCMAKE_RANLIB="$BR"ranlib -DCMAKE_STRIP="$BR"strip -DICONV_INC
                                          LUDE_DIR="$SR/usr/include" -DICONV_LIBRARIES="$SR/usr/lib/libiconv.a" -DWITH_EXTERNAL_ZLIB=ON -DZLIB_INCLUDE_DIR="$S
                                          R/usr/include" -DZLIB_LIBRARY="$SR/usr/lib/libz.so" ../
                                          

                                          I have this error :

                                          CMake Error at CMakeLists.txt:5 (PROJECT):
                                            CMAKE_SYSTEM_NAME is 'Android' but 'NVIDIA Nsight Tegra Visual Studio
                                            Edition' is not installed.
                                          

                                          Build on Windows 10 x64 for Android.
                                          MySQL Plugin for Qt 5.7.0.

                                          Many thanks for help.

                                          C 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