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. Library 'mysql' is not defined.
QtWS25 Last Chance

Library 'mysql' is not defined.

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
mysqlxampp
10 Posts 4 Posters 8.4k Views
  • 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.
  • R Offline
    R Offline
    RodrigoFBM
    wrote on last edited by koahnig
    #1

    I tried everything. Now I'm trying to compile the driver but I had this issu. Please, help-me. I'm using Win7 64 bit with Qt 32 bits and MySql 32bit with XAMPP.

    K 1 Reply Last reply
    1
    • R RodrigoFBM

      I tried everything. Now I'm trying to compile the driver but I had this issu. Please, help-me. I'm using Win7 64 bit with Qt 32 bits and MySql 32bit with XAMPP.

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @RodrigoFBM

      Hi and welcome to devnet forum

      Where and when you are getting this error message?
      Please post the original error output message.

      Do you have a library for mysql installed for linking?
      Since you are posting in mobile/embedded forum, what is your target platform?
      Where did you get the Qt libs from?

      Vote the answer(s) that helped you to solve your issue(s)

      R 1 Reply Last reply
      1
      • K koahnig

        @RodrigoFBM

        Hi and welcome to devnet forum

        Where and when you are getting this error message?
        Please post the original error output message.

        Do you have a library for mysql installed for linking?
        Since you are posting in mobile/embedded forum, what is your target platform?
        Where did you get the Qt libs from?

        R Offline
        R Offline
        RodrigoFBM
        wrote on last edited by RodrigoFBM
        #3

        @koahnig Thnx very much.

        The commands and error:

        Setting up environment for Qt usage...
        
        C:\Qt\5.10.0\mingw53_32>set mysql=C:\MySQL\MyServer
        
        C:\Qt\5.10.0\mingw53_32>cd C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\mysql
        
        C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=%mysql%
        \\include" "LIBS+=%mysql%\\lib\\libmysql.lib" -o Makefile mysql.pro
        
        Cannot read C:/Qt/5.10.0/Src/qtbase/src/plugins/sqldrivers/qtsqldrivers-config.pri: The system cannot find the specified file.
        Project ERROR: Library 'mysql' is not defined.
        

        I'm have MySql connector C and MySqlServer 5.7 installed and XAMPP.
        The target is for Android armv7

        K 1 Reply Last reply
        0
        • R RodrigoFBM

          @koahnig Thnx very much.

          The commands and error:

          Setting up environment for Qt usage...
          
          C:\Qt\5.10.0\mingw53_32>set mysql=C:\MySQL\MyServer
          
          C:\Qt\5.10.0\mingw53_32>cd C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\mysql
          
          C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=%mysql%
          \\include" "LIBS+=%mysql%\\lib\\libmysql.lib" -o Makefile mysql.pro
          
          Cannot read C:/Qt/5.10.0/Src/qtbase/src/plugins/sqldrivers/qtsqldrivers-config.pri: The system cannot find the specified file.
          Project ERROR: Library 'mysql' is not defined.
          

          I'm have MySql connector C and MySqlServer 5.7 installed and XAMPP.
          The target is for Android armv7

          K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          @RodrigoFBM said in Library 'mysql' is not defined.:

          The commands and error:

          Setting up environment for Qt usage...
          
          C:\Qt\5.10.0\mingw53_32>set mysql=C:\MySQL\MyServer
          

          What is the path above?

          C:\Qt\5.10.0\mingw53_32>cd C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\mysql

          C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=%mysql%
          \include" "LIBS+=%mysql%\lib\libmysql.lib" -o Makefile mysql.pro

          Cannot read C:/Qt/5.10.0/Src/qtbase/src/plugins/sqldrivers/qtsqldrivers-config.pri: The system cannot find the specified file.
          Project ERROR: Library 'mysql' is not defined.

          That looks tome like you are doing MinGW compilation for your desktop,correct?

          I'm have MySql connector C and MySqlServer 5.7 installed and XAMPP.
          The target is for Android armv7

          Since you like to use MySql on Android, you would need the mysql for Android as well.

          Vote the answer(s) that helped you to solve your issue(s)

          R 1 Reply Last reply
          0
          • K koahnig

            @RodrigoFBM said in Library 'mysql' is not defined.:

            The commands and error:

            Setting up environment for Qt usage...
            
            C:\Qt\5.10.0\mingw53_32>set mysql=C:\MySQL\MyServer
            

            What is the path above?

            C:\Qt\5.10.0\mingw53_32>cd C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\mysql

            C:\Qt\5.10.0\Src\qtbase\src\plugins\sqldrivers\mysql>qmake "INCLUDEPATH+=%mysql%
            \include" "LIBS+=%mysql%\lib\libmysql.lib" -o Makefile mysql.pro

            Cannot read C:/Qt/5.10.0/Src/qtbase/src/plugins/sqldrivers/qtsqldrivers-config.pri: The system cannot find the specified file.
            Project ERROR: Library 'mysql' is not defined.

            That looks tome like you are doing MinGW compilation for your desktop,correct?

            I'm have MySql connector C and MySqlServer 5.7 installed and XAMPP.
            The target is for Android armv7

            Since you like to use MySql on Android, you would need the mysql for Android as well.

            R Offline
            R Offline
            RodrigoFBM
            wrote on last edited by
            #5

            @koahnig said in Library 'mysql' is not defined.:

            • Where I've installed the MySql Server.

            • Yes

            • Where do I find MySQL for Android? How to proceed this MySQL in Qt?

            K 1 Reply Last reply
            0
            • R RodrigoFBM

              @koahnig said in Library 'mysql' is not defined.:

              • Where I've installed the MySql Server.

              • Yes

              • Where do I find MySQL for Android? How to proceed this MySQL in Qt?

              K Offline
              K Offline
              koahnig
              wrote on last edited by
              #6

              @RodrigoFBM

              You would need the connector/C++ installed stuff installed and that folder or a subfolder seem to make more sense. However, I have not done that myself yet.

              You should be aware that you need to cross-compile Qt and all associated stuff for Android as well. In your case it would be also the mysql connector stuff.

              Vote the answer(s) that helped you to solve your issue(s)

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

                Hi and welcome to devnet,

                Building the MySQL plugin for Android is described here.

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

                R 1 Reply Last reply
                2
                • SGaistS SGaist

                  Hi and welcome to devnet,

                  Building the MySQL plugin for Android is described here.

                  R Offline
                  R Offline
                  RodrigoFBM
                  wrote on last edited by
                  #8

                  @SGaist , hey. Thnkx!

                  I modify the sheel script for:

                  #!/bin/bash
                  # Usage: ./build_libsqlmariadb.so.sh [clean]
                  # 2016-07-22 T-bond (https://t-bond.hu) Added Windows-MSYS build support, Added clean option, and output to dir. Added temp build dir. Fixed no getpwent error. More cleaner compile output. Skip for already built libs
                  
                  # Based on https://gist.github.com/RazZziel/fd607459c1f07a43cdf9
                  output_dir="libmariadb_so_output"
                  build_dir="build_libmariadb_temp"
                  
                  export ANDROID_NDK_ROOT="/c/Android/android-ndk-r14b"
                  export QT_ROOT="/c/Qt/5.10.0"
                   
                  SR="$ANDROID_NDK_ROOT/platforms/android-17/arch-arm/"
                  BR="$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-"
                  no_skips=true
                  
                  #Clean build and outputs
                  if [ "$1" = "clean" ]; then
                  	echo "Cleaning..."
                  	rm -r -f $build_dir $output_dir
                  	echo "Cleaned."
                  else
                  pushd () {
                      command pushd "$@" > /dev/null
                  }
                  
                  popd () {
                      command popd "$@" > /dev/null
                  }
                  
                  if [ ! -d $build_dir ]; then
                  mkdir $build_dir
                  fi
                  pushd $build_dir
                   
                  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.2h.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
                  		if [ ! -f "skip" ] || [ "$no_skips" = true ]; then
                  	        RANLIB="$BR"ranlib CC="$BR"gcc ./Configure android-armv7 --prefix=$SR/usr
                  	        ANDROID_DEV=$SR/usr make || exit 1
                  	        make build_libs || exit 1
                          touch skip
                      	fi
                  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
                  		if [ ! -f "skip" ] || [ "$no_skips" = true ]; then
                  			#Fix for outdated scripts on Windows T-bond.
                  			wget "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" -O new_config.guess
                  			wget "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD" -O new_config.sub
                  			\cp new_config.guess build-aux/config.guess
                  			\cp new_config.guess libcharset/build-aux/config.guess
                  			\cp new_config.sub build-aux/config.sub
                  			\cp new_config.sub libcharset/build-aux/config.sub
                  			#Fix for outdated scripts on Windows T-bond. END
                  			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
                  	        touch skip
                      	fi
                  popd
                   
                   
                  # mariadbclient
                   
                  version=2.0.0
                  pkg=mariadb_client-$version-src.tar.gz
                  url=http://archive.mariadb.org/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
                  		if [ ! -f "skip" ] || [ "$no_skips" = true ]; then
                  	        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
                  	        sed -i '/#ifdef HAVE_GETPWNAM/c#if defined(HAVE_GETPWNAM) && defined(HAVE_GETPWENT)' libmariadb/mf_pack.c #T-bond: Fix the no getpwent error. http://forum.kodi.tv/showthread.php?tid=280134
                  	        #DCMAKE_CXX_COMPILER DCMAKE_SYSTEM_VERSION DCMAKE_SYSTEM_NAME WINDOWS ONLY!!!
                  	        if [ ! -d "build" ]; then
                  	        	mkdir build
                  	    	fi
                  	        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_SYSTEM_NAME="Android" \
                  			-DCMAKE_SYSTEM_VERSION=1 \
                  			-DCMAKE_CXX_COMPILER="$BR"g++ \
                  			-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
                  	        cp build/libmariadb/*.{a,so} "$SR/usr/lib/mariadb/" || exit 1
                  	        touch skip
                  	    fi
                  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=5.7.0
                  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
                          tar -xf $pkg || exit 1
                  fi
                   
                  pushd $dir/src/plugins/sqldrivers/mysql/
                  		$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 
                  popd
                  
                  if [ ! -d $output_dir ]; then
                  	mkdir $output_dir
                  fi
                  cp $SR/usr/lib/mariadb/libmariadb.so $output_dir/libmariadb.so
                  cp $QT_ROOT/android_armv7/plugins/sqldrivers/libqsqlmysql.so $output_dir/libqsqlmysql.so
                   
                  echo
                  echo "BOOYAH!!!"
                  echo
                  fi
                  

                  and save like android.sh in C:\MinGW\msys\1.0\bin directory.
                  Then I go to command prompt and type:
                  cd C:\MinGW\msys\1.0\bin
                  and then:
                  sh android.sh

                  But I get these errors:

                  android.sh: line 31: mkdir: command not found
                  android.sh: line 23: pushd: build_libmariadb_temp: No such file or directory
                  android.sh: line 35: dirname: command not found
                  FIND: incorrect parameter format
                  

                  Can you helpe me? :/

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

                    Are you using a Windows command prompt ?

                    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
                    1
                    • RovshanR Offline
                      RovshanR Offline
                      Rovshan
                      wrote on last edited by
                      #10

                      Good afternoon. The topic is old, but still relevant to this day. I decided to try to connect MYSQL for Android.

                      Article: https://wiki.qt.io/Build_Qt_5_MySQL_Plugin_for_Android
                      Ct 5.10.1
                      I write under android
                      Faced with difficulties.

                      0_1532947356074_2.png

                      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