Problems with configuring SQL when building Qt 5.8 from source



  • 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?


  • Moderators

    @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.



  • 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
    

  • Moderators

    @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.


  • Moderators

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



  • 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



  • 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]
    

  • Lifetime Qt Champion

    Hi,

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


  • Moderators

    @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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.