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. Problems with configuring SQL when building Qt 5.8 from source
QtWS25 Last Chance

Problems with configuring SQL when building Qt 5.8 from source

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 6 Posters 12.3k 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.
  • I Offline
    I Offline
    iter
    wrote on 28 Jan 2017, 17:28 last edited by iter
    #1

    I tried building the new Qt 5.8 using the same configuration I have been using since 5.5, but it failed with the following errors:

    ERROR: Invalid value given for boolean command line option 'sql-psql'.
    
    ERROR: Invalid value given for boolean command line option 'sql-mysql'.
    
    ERROR: Unknown command line option '-l'.
    
    Qmake failed, return code 3
    

    The errors are product of those 3 configuration options:

    -qt-sql-psql -qt-sql-mysql -l mysqlclient
    

    So I changed them to:

    -sql-psql -sql-mysql -L mysqlclient
    

    That didn't produce the same errors from above, but configuration failed nevertheless:

    ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.
    

    Here is the full list of the SQL related configuration options:

    -L E:\msys64\mingw64\lib -qt-sql-psql -qt-sql-mysql -l mysqlclient -I E:\msys64\mingw64\include\mariadb
    

    What is going on here? What has changed? Why is the option to specify that I want build in rather than plug in SQL drivers on accepted? What is that pre-condition and why does it fail?

    Also, IIRC the -l option was to include a pre-built library, why is that not working anymore? With a capital -L it is to include a library path, not a particular library. Oddly enough the configuration detects the psql libray, but not the mysql, I am using mariadb in this particular case.

    The documentation (it says it is for 5.8) still lists the same old ways to configure SQL:

    -no-sql-<driver> ... Disable SQL <driver> entirely.
    -qt-sql-<driver> ... Enable a SQL <driver> in the Qt Library, by default
                         none are turned on.
    -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to
                         at run time.
    
                         Possible values for <driver>:
                         [ db2 ibase mysql oci odbc psql sqlite sqlite2 tds ]
    

    However the -qt-sql-psql format results in an error.

    How to properly configure Qt to build with mysql and psql support?

    A 1 Reply Last reply 28 Jan 2017, 18:42
    0
    • I iter
      28 Jan 2017, 17:28

      I tried building the new Qt 5.8 using the same configuration I have been using since 5.5, but it failed with the following errors:

      ERROR: Invalid value given for boolean command line option 'sql-psql'.
      
      ERROR: Invalid value given for boolean command line option 'sql-mysql'.
      
      ERROR: Unknown command line option '-l'.
      
      Qmake failed, return code 3
      

      The errors are product of those 3 configuration options:

      -qt-sql-psql -qt-sql-mysql -l mysqlclient
      

      So I changed them to:

      -sql-psql -sql-mysql -L mysqlclient
      

      That didn't produce the same errors from above, but configuration failed nevertheless:

      ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.
      

      Here is the full list of the SQL related configuration options:

      -L E:\msys64\mingw64\lib -qt-sql-psql -qt-sql-mysql -l mysqlclient -I E:\msys64\mingw64\include\mariadb
      

      What is going on here? What has changed? Why is the option to specify that I want build in rather than plug in SQL drivers on accepted? What is that pre-condition and why does it fail?

      Also, IIRC the -l option was to include a pre-built library, why is that not working anymore? With a capital -L it is to include a library path, not a particular library. Oddly enough the configuration detects the psql libray, but not the mysql, I am using mariadb in this particular case.

      The documentation (it says it is for 5.8) still lists the same old ways to configure SQL:

      -no-sql-<driver> ... Disable SQL <driver> entirely.
      -qt-sql-<driver> ... Enable a SQL <driver> in the Qt Library, by default
                           none are turned on.
      -plugin-sql-<driver> Enable SQL <driver> as a plugin to be linked to
                           at run time.
      
                           Possible values for <driver>:
                           [ db2 ibase mysql oci odbc psql sqlite sqlite2 tds ]
      

      However the -qt-sql-psql format results in an error.

      How to properly configure Qt to build with mysql and psql support?

      A Offline
      A Offline
      ambershark
      wrote on 28 Jan 2017, 18:42 last edited by
      #2

      @iter The second option is correct.

      The problem reported after that is that the test for mysql failed. Can you show the details of the configure process. It should show the tests (although those may be in a more verbose mode).

      And from those tests we may gain some insight as to why your mysql isn't working. It could be for quite a few reasons including different architecture of the mysql libs, not being able to find the includes or the libraries, etc. A lot of reasons really.

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      0
      • I Offline
        I Offline
        iter
        wrote on 29 Jan 2017, 00:24 last edited by
        #3

        Nope, the libs are built with GCC 5.3.0 x64, exactly the same compiler I am trying to build Qt with.

        Furthermore I am able to build Qt 5.7 and 5.7.1 with mysql using those exact same libraries. The configuration script for 5.7.1 detects mysql, but not for 5.8.

        I am not sure what do you mean by the "configure process", but if it is the full configuration option list, this is it:

        configure -c++std c++11 -prefix E:\Qt\Qt58s -platform win32-g++ -release -opensource -static -static-runtime -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -no-compile-examples -no-icu -opengl desktop -skip qtscript -nomake examples -nomake tests -skip qtwayland -skip qtwebview -skip qtwebengine -skip qtwebchannel -no-qml-debug -confirm-license -sql-psql -sql-mysql -L E:\msys64\mingw64\lib -I E:\msys64\mingw64\include\mariadb
        
        A J 2 Replies Last reply 29 Jan 2017, 00:50
        0
        • I iter
          29 Jan 2017, 00:24

          Nope, the libs are built with GCC 5.3.0 x64, exactly the same compiler I am trying to build Qt with.

          Furthermore I am able to build Qt 5.7 and 5.7.1 with mysql using those exact same libraries. The configuration script for 5.7.1 detects mysql, but not for 5.8.

          I am not sure what do you mean by the "configure process", but if it is the full configuration option list, this is it:

          configure -c++std c++11 -prefix E:\Qt\Qt58s -platform win32-g++ -release -opensource -static -static-runtime -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -no-compile-examples -no-icu -opengl desktop -skip qtscript -nomake examples -nomake tests -skip qtwayland -skip qtwebview -skip qtwebengine -skip qtwebchannel -no-qml-debug -confirm-license -sql-psql -sql-mysql -L E:\msys64\mingw64\lib -I E:\msys64\mingw64\include\mariadb
          
          A Offline
          A Offline
          ambershark
          wrote on 29 Jan 2017, 00:50 last edited by ambershark
          #4

          @iter I meant the output from configure. So when you run configure redirect that output to a file and post the contents. Make sure you redirect stderr too.

          I.e. ./configure &> config-results.

          Oh and I haven't built 5.8 yet, so it's possible it's just broken. I doubt it though, that's a pretty big thing to miss in QA.

          My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

          1 Reply Last reply
          0
          • I iter
            29 Jan 2017, 00:24

            Nope, the libs are built with GCC 5.3.0 x64, exactly the same compiler I am trying to build Qt with.

            Furthermore I am able to build Qt 5.7 and 5.7.1 with mysql using those exact same libraries. The configuration script for 5.7.1 detects mysql, but not for 5.8.

            I am not sure what do you mean by the "configure process", but if it is the full configuration option list, this is it:

            configure -c++std c++11 -prefix E:\Qt\Qt58s -platform win32-g++ -release -opensource -static -static-runtime -qt-zlib -qt-libpng -qt-libjpeg -qt-freetype -no-compile-examples -no-icu -opengl desktop -skip qtscript -nomake examples -nomake tests -skip qtwayland -skip qtwebview -skip qtwebengine -skip qtwebchannel -no-qml-debug -confirm-license -sql-psql -sql-mysql -L E:\msys64\mingw64\lib -I E:\msys64\mingw64\include\mariadb
            
            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 30 Jan 2017, 06:18 last edited by
            #5

            @iter To add to @ambershark add -v parameter to configure

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • C Offline
              C Offline
              Constantin Iacobescu
              wrote on 8 Feb 2018, 17:04 last edited by
              #6

              I see that after 1 year still not any good answer.
              Me I try to compile Qt 5.10 static for iOS and here is my command line I use.

              ./configure
              -static
              -debug
              -commercial
              -confirm-license
              -prefix /Users/Constantin/Development/Qt/5.10.0/ios_static
              -xplatform macx-ios-clang
              -c++std c++11
              --disable-rpath
              -appstore-compliant
              -sdk iphoneos
              -nomake tests
              -nomake examples
              -qt-doubleconversion
              -qt-pcre
              -qt-zlib
              -qt-freetype
              -qt-harfbuzz
              -qt-xcb
              -qt-xkbcommon-x11
              -qt-libpng
              -qt-libjpeg
              -qt-sqlite
              -sql-sqlite
              -skip qt3d
              -skip qtactiveqt
              -skip qtcanvas3d
              -skip qtcharts
              -skip qtdatavis3d
              -skip qtdeclarative
              -skip qtdoc
              -skip qtgamepad
              -skip qtpurchasing
              -skip qtquickcontrols
              -skip qtquickcontrols2
              -skip qtserialbus
              -skip qtserialport
              -skip qttranslations
              -skip qtwebchannel
              -skip qtwebengine
              -skip qtwebglplugin
              -skip qtwebsockets
              -skip qtwebview
              -skip qtwinextras
              -no-warnings-are-errors
              -verbose

              But when I try to use the sqlite in my program is not working when I add to my code

              Q_IMPORT_PLUGIN(qsqlite)
              

              I receive the same error

              Undefined symbols for architecture arm64:
                "qt_static_plugin_qsqlite()", referenced from:
                    StaticqsqlitePluginInstance::StaticqsqlitePluginInstance()
              

              First of all which is the correct configure command?
              Here they say this http://doc.qt.io/qt-5/sql-driver.html
              -plugin-sql-sqlite (build as a plugin) or -qt-sql-sqlite (linked directly into the Qt library)
              but no one is working. WTF?
              And as you see I use the commercial trial license so please give me a reason to buy it after all.
              Please update your documentation and spare our frustration of throwing the money out the window.
              Thank you

              A Y 2 Replies Last reply 12 Feb 2018, 22:16
              0
              • C Offline
                C Offline
                Constantin Iacobescu
                wrote on 8 Feb 2018, 17:19 last edited by
                #7

                On the other hand if the new good configuration is this:

                -sql-<driver> ........ Enable SQL <driver> plugin. Supported drivers:
                db2 ibase mysql oci odbc psql sqlite2 sqlite tds
                [all auto]

                That's mean its build as a plugin or is linked directly into the Qt library ?

                Me I need to be linked directly into the Qt library and even more using the -qt-sqlite

                -sqlite .............. Select used sqlite3 [system/qt]
                
                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 8 Feb 2018, 19:45 last edited by
                  #8

                  Hi,

                  -qt-sql- means builtin Qt.
                  -plugin-sql- means that it will be a separated library.

                  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
                  2
                  • C Constantin Iacobescu
                    8 Feb 2018, 17:04

                    I see that after 1 year still not any good answer.
                    Me I try to compile Qt 5.10 static for iOS and here is my command line I use.

                    ./configure
                    -static
                    -debug
                    -commercial
                    -confirm-license
                    -prefix /Users/Constantin/Development/Qt/5.10.0/ios_static
                    -xplatform macx-ios-clang
                    -c++std c++11
                    --disable-rpath
                    -appstore-compliant
                    -sdk iphoneos
                    -nomake tests
                    -nomake examples
                    -qt-doubleconversion
                    -qt-pcre
                    -qt-zlib
                    -qt-freetype
                    -qt-harfbuzz
                    -qt-xcb
                    -qt-xkbcommon-x11
                    -qt-libpng
                    -qt-libjpeg
                    -qt-sqlite
                    -sql-sqlite
                    -skip qt3d
                    -skip qtactiveqt
                    -skip qtcanvas3d
                    -skip qtcharts
                    -skip qtdatavis3d
                    -skip qtdeclarative
                    -skip qtdoc
                    -skip qtgamepad
                    -skip qtpurchasing
                    -skip qtquickcontrols
                    -skip qtquickcontrols2
                    -skip qtserialbus
                    -skip qtserialport
                    -skip qttranslations
                    -skip qtwebchannel
                    -skip qtwebengine
                    -skip qtwebglplugin
                    -skip qtwebsockets
                    -skip qtwebview
                    -skip qtwinextras
                    -no-warnings-are-errors
                    -verbose

                    But when I try to use the sqlite in my program is not working when I add to my code

                    Q_IMPORT_PLUGIN(qsqlite)
                    

                    I receive the same error

                    Undefined symbols for architecture arm64:
                      "qt_static_plugin_qsqlite()", referenced from:
                          StaticqsqlitePluginInstance::StaticqsqlitePluginInstance()
                    

                    First of all which is the correct configure command?
                    Here they say this http://doc.qt.io/qt-5/sql-driver.html
                    -plugin-sql-sqlite (build as a plugin) or -qt-sql-sqlite (linked directly into the Qt library)
                    but no one is working. WTF?
                    And as you see I use the commercial trial license so please give me a reason to buy it after all.
                    Please update your documentation and spare our frustration of throwing the money out the window.
                    Thank you

                    A Offline
                    A Offline
                    ambershark
                    wrote on 12 Feb 2018, 22:16 last edited by
                    #9

                    @Constantin-Iacobescu This has nothing to do with the original post a year ago ... It would have been better as a new post.

                    It looks like you built Qt with built-in sqlite. Then you are trying to use the sqlite plugin in your code. That is why it has the linker error trying to initialize it. At least I'm pretty sure this is how it works. It may generate the plugin even when using the built-in method in which case it should be fine but we'll need more information to help you debug it.

                    In your qmake file make sure you have QT += sql in order to enable sql support.

                    Just tested on my qt with built in sqlite and it works properly. No Q_IMPORT_PLUGIN() needed.

                    My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

                    1 Reply Last reply
                    0
                    • C Constantin Iacobescu
                      8 Feb 2018, 17:04

                      I see that after 1 year still not any good answer.
                      Me I try to compile Qt 5.10 static for iOS and here is my command line I use.

                      ./configure
                      -static
                      -debug
                      -commercial
                      -confirm-license
                      -prefix /Users/Constantin/Development/Qt/5.10.0/ios_static
                      -xplatform macx-ios-clang
                      -c++std c++11
                      --disable-rpath
                      -appstore-compliant
                      -sdk iphoneos
                      -nomake tests
                      -nomake examples
                      -qt-doubleconversion
                      -qt-pcre
                      -qt-zlib
                      -qt-freetype
                      -qt-harfbuzz
                      -qt-xcb
                      -qt-xkbcommon-x11
                      -qt-libpng
                      -qt-libjpeg
                      -qt-sqlite
                      -sql-sqlite
                      -skip qt3d
                      -skip qtactiveqt
                      -skip qtcanvas3d
                      -skip qtcharts
                      -skip qtdatavis3d
                      -skip qtdeclarative
                      -skip qtdoc
                      -skip qtgamepad
                      -skip qtpurchasing
                      -skip qtquickcontrols
                      -skip qtquickcontrols2
                      -skip qtserialbus
                      -skip qtserialport
                      -skip qttranslations
                      -skip qtwebchannel
                      -skip qtwebengine
                      -skip qtwebglplugin
                      -skip qtwebsockets
                      -skip qtwebview
                      -skip qtwinextras
                      -no-warnings-are-errors
                      -verbose

                      But when I try to use the sqlite in my program is not working when I add to my code

                      Q_IMPORT_PLUGIN(qsqlite)
                      

                      I receive the same error

                      Undefined symbols for architecture arm64:
                        "qt_static_plugin_qsqlite()", referenced from:
                            StaticqsqlitePluginInstance::StaticqsqlitePluginInstance()
                      

                      First of all which is the correct configure command?
                      Here they say this http://doc.qt.io/qt-5/sql-driver.html
                      -plugin-sql-sqlite (build as a plugin) or -qt-sql-sqlite (linked directly into the Qt library)
                      but no one is working. WTF?
                      And as you see I use the commercial trial license so please give me a reason to buy it after all.
                      Please update your documentation and spare our frustration of throwing the money out the window.
                      Thank you

                      Y Offline
                      Y Offline
                      Yuri Epstein
                      wrote on 19 May 2019, 14:13 last edited by
                      #10

                      @Constantin-Iacobescu
                      I've recently faced the same problem with Qt 5.12.2 on MacOS in my CMake project and solved it.
                      Also got the "undefined qt_static_plugin_qsqlite()" error.
                      The root cause is the wrong name used in Q_IMPORT_PLUGIN statement. After looking into the sqlite plugin library symbols, I found that it must be "QSQLiteDriverPlugin".

                      So this worked for me:

                      1. Build Qt with -plugin-sql-sqlite -qt-sqlite options.
                      2. CMakeLists.txt:
                        add_definitions("-DQT_STATICPLUGIN")
                        target_link_libraries(... /usr/local/Qt-5.12.2/plugins/sqldrivers/libsqlite${DEBUG_TYPE}.a ...)
                      3. main.cpp:
                        Q_IMPORT_PLUGIN(QSQLiteDriverPlugin)
                      1 Reply Last reply
                      1

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved