Important: Please read the Qt Code of Conduct -

[SOLVED] Mysql driver not compile in QT 5.3 for Android

  • Hi
    I have crosscompiled mysql for android with sucess in qt 5.2.1 but with 5.3.0-RC
    have a error in mysql.h

    use RazZziel script


    #dir=$(basename $pkg .tar.gz)

    #if [ ! -d $dir ]; then
    #[ -f $pkg ] || wget$pkg

    [ -f $pkg ] || wget$pkg

    tar -xf $pkg || exit 1


    pushd $dir/src/plugins/sqldrivers/mysql/

    $qmake "INCLUDEPATH+=$SR/usr/include/" "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/" -o Makefile
    make || exit 1
    make install || exit 1

    and have this error
    /home/fuinha/android-ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/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 -std=gnu++0x -g -g -gdwarf-2 -marm -O0 -fno-omit-frame-pointer -fvisibility=hidden -fvisibility-inlines-hidden -fno-exceptions -Wall -Wno-psabi -W -D_REENTRANT -fPIC -DQT_NO_MTDEV -DQT_NO_LIBUDEV -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEPTIONS -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I../../../../mkspecs/android-g++ -I. -I/home/fuinha/android-ndk/platforms/android-19/arch-arm/usr/include -I../../../../include/QtSql/5.3.0 -I../../../../include/QtSql/5.3.0/QtSql -I../../../../include -I../../../../include/QtSql -I../../../../include/QtCore/5.3.0 -I../../../../include/QtCore/5.3.0/QtCore -I../../../../include/QtCore -I.moc -I/home/fuinha/android-ndk/sources/cxx-stl/gnu-libstdc++/4.8/include -I/home/fuinha/android-ndk/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -isystem /home/fuinha/android-ndk/platforms/android-9/arch-arm/usr/include -o .obj/main.o main.cpp
    In file included from main.cpp:44:0:
    ../../../sql/drivers/mysql/qsql_mysql_p.h:63:19: fatal error: mysql.h: No such file or directory
    #include <mysql.h>
    compilation terminated.
    make: *** [.obj/main.o] Error 1

  • @projetoslinux: I developed a program on QT for android on win7 but not on linux, could you share your ? i want to try it on my win7 develop platforms,thanks.

  • I guess most developers favors SQLite on Android.

  • Lifetime Qt Champion


    It's not a question of favorite database. Android doesn't have an official MySQL native library.

    projetoslinux double check that the path you are giving for the includes are correct

  • Ok

    Im testing
    thanks SGaist !!!

    dirk_sy if you want a lib for linux armv7a send-me a mail and i replay whit is
    my mail


  • Lifetime Qt Champion

    You should avoid posting your email address like that, it's not protected. You can send it directly to dirk_sy through the contact member page.

  • Sorry and Thanks Sgaist !!!

    mail edited ...

  • the contact member page cannot write in an email address,how can we contact each other?by the way ,how can I compile a Mysql driver at win7-32?is there any way I can follow?please ,help,thanks.
    @projetoslinux: I have send a message to u,and I have write an address in the message,my user name ,you can find here.thanks again.

  • After several weeks I found PROBLEM

    Only add line to ad include and libs in qmake

    "INCLUDEPATH+=$SR/usr/include/mariadb/" "LIBPATH+=$SR/usr/lib/mariadb/"

    thanks !!!

  • Hi, I'm trying unsuccessfully for a week to collect mysql driver for android, can I throw, will be very grateful. Or where there is a link to instructions on how to assemble.

  • link to download mysql plugins for armv7
    compiled in ubuntu 14.04 32bits

  • Thank you very much. but after much agonizing gathered under Ubuntu 14.04 amd64.
    And who knows how to build under windows?

  • Lifetime Qt Champion

    For Windows, please search the forum, it has been asked and answered many times already

  • Please tell me exactly where I can not find this discussion, and I see Mr. forum only questions and no concrete answers.

  • Lifetime Qt Champion

    Did you first follow the guide from the documentation ? What error did you have ?

  • In general, I can not find the assembly instructions for Android MySQL under Windows. And under Ubuntu 14.04 but I gathered when compiling the project, it gives the driver is available but not loaded. Under Ubuntu, collected according to the instructions

  • Lifetime Qt Champion

    You won't find them because officially, there's no MySQL client library for Android.

    The guides provide instructions for MariaDB so you have that option, but if you want to save time, just follow the guide, then copy the needed resulting files to your Windows installation.

  • Thanks for the replies I will try. I would like to specify which files you want to copy and Or need some other files?

  • Lifetime Qt Champion

    It's all shown in the wiki entry you mentioned earlier

Log in to reply