Unable to build Qt MySQL Driver
Unsolved
Mobile and Embedded
-
Since years ago I could successfully build Qt MySQL driver for Android under Ubuntu host (based on this wiki page). Today I executed the same shell script but it gives me this error message:
Project ERROR: Cannot run target compiler '/opt/android-sdk/ndk/android-ndk-r9d/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++'. Output: =================== =================== Maybe you forgot to setup the environment? make: *** No targets specified and no makefile found. Stop.
May you please help me to figure out what's wrong?
NOTE: I could build
libiconv
,openssl
andmariadb
successfully.android_mysql.pro
TARGET = qsqlmysql HEADERS += $$PWD/qsql_mysql_p.h SOURCES += $$PWD/qsql_mysql.cpp $$PWD/main.cpp OTHER_FILES += mysql.json PLUGIN_CLASS_NAME = QMYSQLDriverPlugin include(../qsqldriverbase.pri)
build_qt_mysql_driver.sh
#!/bin/bash # Edit these lines export NDK_ROOT="/opt/android-sdk/ndk/android-ndk-r9d" export QT_ROOT="/home/mbnoimi/.Qt/5.15.2" SR="$NDK_ROOT/platforms/android-19/arch-arm" BR="$NDK_ROOT/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-" platform=android-armv7 platform_sort=arm qmake="$QT_ROOT/android/bin/qmake" libiconv_pkg=libiconv-1.14.tar.gz openssl_pkg=openssl-1.0.2j.tar.gz mariadb_pkg=mariadb-connector-c-2.3.2-src.tar.gz # Fix Qt MySQL projects cp $QT_ROOT/Src/qtbase/src/plugins/sqldrivers/mysql/mysql.pro $QT_ROOT/Src/qtbase/src/plugins/sqldrivers/mysql/mysql_orig.pro cp android_mysql.pro $QT_ROOT/Src/qtbase/src/plugins/sqldrivers/mysql/mysql.pro # Don't edit after this line # libiconv compile dir=$(basename $libiconv_pkg .tar.gz) rm -r $dir tar -xf $libiconv_pkg || exit 1 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=$platform_sort --prefix=$SR/usr --with-sysroot=$SR make || exit 1 make install || exit 1 popd echo echo "libiconv compiled !!!" echo #rm -r $dir # openssl compile dir=$(basename $openssl_pkg .tar.gz) rm -r $dir tar -xf $openssl_pkg || exit 1 pushd $dir RANLIB="$BR"ranlib CC="$BR"gcc ./Configure $platform --prefix=$SR/usr ANDROID_DEV=$SR/usr make || exit 1 make install_sw || exit 1 popd echo echo "openssl compiled !!!" echo #rm -r $dir # mariadb compile dir=$(basename $mariadb_pkg .tar.gz) rm -r $dir tar -xf $mariadb_pkg || exit 1 pushd $dir sed -i -e "s|ADD_SUBDIRECTORY(unittest/libmariadb)|#ADD_SUBDIRECTORY(unittest/libmariadb)|" CMakeLists.txt sed -i -e "N; s|#define _global_h|#define _global_h\n\n#ifndef ushort\n#define ushort uint16\n#endif|" 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 sed -i -e "N; s|\${CPACK_PACKAGE_VERSION_MAJOR}||" libmariadb/CMakeLists.txt 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 pushd include sed -i -e "N; s|#define HAVE_UCONTEXT_H 1|/* #undef HAVE_UCONTEXT_H */|" my_config.h sed -i -e "N; s|#define HAVE_GETPWNAM 1|/* #undef HAVE_GETPWNAM */|" my_config.h sed -i -e "N; s|#define HAVE_STPCPY 1|/* #undef HAVE_STPCPY */|" my_config.h popd make || exit 1 make install || exit 1 popd popd echo echo "mariadb compiled !!!" echo #rm -r $dir # qt mariadb driver compile export ANDROID_NDK_ROOT=$NDK_ROOT [ ! -f "$qmake" ] && { echo "Could not find qmake in '$qmake'"; exit 1; } [ ! -x "$qmake" ] && { echo "Qmake is not executable in '$qmake'"; exit 1; } pushd $QT_ROOT/Src/qtbase/src/plugins/sqldrivers/mysql/ make clean $qmake "QMAKE_CXX=$BR"g++ "QMAKE_LINK=$BR"g++ "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 "qt mariadb driver compiled !!!" echo
-
$ ls -hl /opt/android-sdk/ndk/android-ndk-r9d/toolchains/ total 60K drwxr-xr-x 3 mbnoimi mbnoimi 4.0K Mar 1 2014 arm-linux-androideabi-4.6 drwxr-xr-x 3 mbnoimi mbnoimi 4.0K Mar 1 2014 arm-linux-androideabi-4.8 drwxr-xr-x 2 mbnoimi mbnoimi 4.0K Mar 1 2014 arm-linux-androideabi-clang3.3 drwxr-xr-x 2 mbnoimi mbnoimi 4.0K Mar 1 2014 arm-linux-androideabi-clang3.4 drwxr-xr-x 3 mbnoimi mbnoimi 4.0K Mar 1 2014 llvm-3.3 drwxr-xr-x 3 mbnoimi mbnoimi 4.0K Mar 1 2014 llvm-3.4 drwxr-xr-x 3 mbnoimi mbnoimi 4.0K Mar 1 2014 mipsel-linux-android-4.6 drwxr-xr-x 3 mbnoimi mbnoimi 4.0K Mar 1 2014 mipsel-linux-android-4.8 drwxr-xr-x 2 mbnoimi mbnoimi 4.0K Mar 1 2014 mipsel-linux-android-clang3.3 drwxr-xr-x 2 mbnoimi mbnoimi 4.0K Mar 1 2014 mipsel-linux-android-clang3.4 drwxr-xr-x 3 mbnoimi mbnoimi 4.0K Dec 17 2013 renderscript drwxr-xr-x 3 mbnoimi mbnoimi 4.0K Mar 1 2014 x86-4.6 drwxr-xr-x 3 mbnoimi mbnoimi 4.0K Mar 1 2014 x86-4.8 drwxr-xr-x 2 mbnoimi mbnoimi 4.0K Mar 1 2014 x86-clang3.3 drwxr-xr-x 2 mbnoimi mbnoimi 4.0K Mar 1 2014 x86-clang3.4