Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Can't build libqsqlmysql.so
Forum Updated to NodeBB v4.3 + New Features

Can't build libqsqlmysql.so

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 1.3k 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.
  • A Offline
    A Offline
    Alex Ryasky
    wrote on last edited by Alex Ryasky
    #1

    Hello.
    I'm newbie in Qt, I started to develop my app, which is intended to interact with MySQL database.
    I found, that I haven't mysql driver for Qt, so I read ton of topics and decided to compile it from Qt base.
    I have installed MariaDB 10.3, and I use MySQL everyday, and was surprised, that qmake didn't find it in system (Ubuntu 18.04):

    ~$ mysql --version
    mysql  Ver 15.1 Distrib 10.3.21-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
    

    So when I try to compile, I got this:

    ~/Qt/5.15.1/Src/qtbase/src/plugins/sqldrivers$ ../../../../../gcc_64/bin/qmake sqldrivers.pro 
    
    Running configuration tests...
    Checking for DB2 (IBM)... no
    Checking for InterBase... no
    Checking for MySQL... no
    Checking for OCI (Oracle)... no
    Checking for ODBC... no
    Checking for PostgreSQL... no
    Checking for SQLite (version 2)... no
    Checking for TDS (Sybase)... no
    Done running configuration tests.
    
    Configure summary:
    
    Qt Sql Drivers:
      DB2 (IBM) .............................. no
      InterBase .............................. no
      MySql .................................. no
      OCI (Oracle) ........................... no
      ODBC ................................... no
      PostgreSQL ............................. no
      SQLite2 ................................ no
      SQLite ................................. yes
        Using system provided SQLite ......... no
      TDS (Sybase) ........................... no
    
    Qt is now configured for building. Just run 'make'.
    Once everything is built, you must run 'make install'.
    Qt will be installed into '/home/alexrsk/Qt/5.15.1/gcc_64'.
    

    Please advice, what I have to do to make it work.

    B 1 Reply Last reply
    0
    • A Alex Ryasky

      Hello.
      I'm newbie in Qt, I started to develop my app, which is intended to interact with MySQL database.
      I found, that I haven't mysql driver for Qt, so I read ton of topics and decided to compile it from Qt base.
      I have installed MariaDB 10.3, and I use MySQL everyday, and was surprised, that qmake didn't find it in system (Ubuntu 18.04):

      ~$ mysql --version
      mysql  Ver 15.1 Distrib 10.3.21-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
      

      So when I try to compile, I got this:

      ~/Qt/5.15.1/Src/qtbase/src/plugins/sqldrivers$ ../../../../../gcc_64/bin/qmake sqldrivers.pro 
      
      Running configuration tests...
      Checking for DB2 (IBM)... no
      Checking for InterBase... no
      Checking for MySQL... no
      Checking for OCI (Oracle)... no
      Checking for ODBC... no
      Checking for PostgreSQL... no
      Checking for SQLite (version 2)... no
      Checking for TDS (Sybase)... no
      Done running configuration tests.
      
      Configure summary:
      
      Qt Sql Drivers:
        DB2 (IBM) .............................. no
        InterBase .............................. no
        MySql .................................. no
        OCI (Oracle) ........................... no
        ODBC ................................... no
        PostgreSQL ............................. no
        SQLite2 ................................ no
        SQLite ................................. yes
          Using system provided SQLite ......... no
        TDS (Sybase) ........................... no
      
      Qt is now configured for building. Just run 'make'.
      Once everything is built, you must run 'make install'.
      Qt will be installed into '/home/alexrsk/Qt/5.15.1/gcc_64'.
      

      Please advice, what I have to do to make it work.

      B Offline
      B Offline
      Bonnie
      wrote on last edited by Bonnie
      #2

      @Alex-Ryasky said in Can't build libqsqlmysql.so:

      Please advice

      Like reading the documentation first?
      https://doc.qt.io/qt-5/sql-driver.html#how-to-build-the-qmysql-plugin-on-unix-and-macos
      *Also remember to check the Note in https://doc.qt.io/qt-5/sql-driver.html#building-the-drivers part

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Alex Ryasky
        wrote on last edited by Alex Ryasky
        #3
        $ which mysql
        /usr/bin/mysql
        
        :~/Qt/5.15.1/Src/qtbase/src/plugins/sqldrivers$ ../../../../../gcc_64/bin/qmake  -- MYSQL_PREFIX=/usr/bin/mysql
        

        Same thing:

        Qt Sql Drivers:
          DB2 (IBM) .............................. no
          InterBase .............................. no
          MySql .................................. no
          OCI (Oracle) ........................... no
          ODBC ................................... no
          PostgreSQL ............................. no
          SQLite2 ................................ no
          SQLite ................................. yes
            Using system provided SQLite ......... no
          TDS (Sybase) ........................... no
        
        

        Also tried /usr/local, usr/local/bin, usr/local/sbin -- same results.

        B 1 Reply Last reply
        0
        • A Alex Ryasky
          $ which mysql
          /usr/bin/mysql
          
          :~/Qt/5.15.1/Src/qtbase/src/plugins/sqldrivers$ ../../../../../gcc_64/bin/qmake  -- MYSQL_PREFIX=/usr/bin/mysql
          

          Same thing:

          Qt Sql Drivers:
            DB2 (IBM) .............................. no
            InterBase .............................. no
            MySql .................................. no
            OCI (Oracle) ........................... no
            ODBC ................................... no
            PostgreSQL ............................. no
            SQLite2 ................................ no
            SQLite ................................. yes
              Using system provided SQLite ......... no
            TDS (Sybase) ........................... no
          
          

          Also tried /usr/local, usr/local/bin, usr/local/sbin -- same results.

          B Offline
          B Offline
          Bonnie
          wrote on last edited by Bonnie
          #4

          @Alex-Ryasky
          You are ignoring the most important part

          You need the MySQL / MariaDB header files, as well as the shared library libmysqlclient.so / libmariadb.so. Depending on your Linux distribution, you may need to install a package which is usually called "mysql-devel" or "mariadb-devel".
          Tell qmake where to find the MySQL / MariaDB header files and shared libraries (here it is assumed that MySQL / MariaDB is installed in /usr/local) and run make:

          They won't be in the bin folder. :)
          First you need to check that have you installed the dev* package.
          Also, as the Note says, remember to remove the config.cache before you run qmake again or it will always be a "no".
          And, as the Note says, again, you should open config.log to see what went wrong.
          Please try harder to solve the problem by yourself.

          Little tip added:
          *_PREFIX is used when you have the header file in PREFIX/include and the library file in PREFIX/lib.
          If they are not, then you should use *_INCDIR and *_LIBDIR to set the dirs.

          1 Reply Last reply
          3
          • A Offline
            A Offline
            Alex Ryasky
            wrote on last edited by
            #5

            Thank you very much, It helped a lot.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              Alex Ryasky
              wrote on last edited by Alex Ryasky
              #6

              Next time i'll delve deeper into environments questions and rely to myself.

              1 Reply Last reply
              1
              • T Offline
                T Offline
                Thombou
                wrote on last edited by
                #7

                If the issue is solved, please mark it as solved :)

                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