Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Error with sqldrivers, qsql_mysql, while building Qt on MacOS



  • I have been trying to build ParaView to test the Qt custom apps examples here (https://gitlab.kitware.com/paraview/paraview/tree/master/Examples/CustomApplications) on MacOS, to see if it's possible to build a Qt desktop app that uses the ParaView framework and if everything works buy the Qt license and start building.

    I have followed the site instructions for the superbuild here (https://gitlab.kitware.com/paraview/paraview-superbuild)

    I have had several problems with the Qt build, after some tweaking here is the result

    These are the steps I have done:

    $ mkdir pv
    $ cd pv
    $ git clone https://gitlab.kitware.com/paraview/paraview-superbuild.git
    $ cd paraview-superbuild
    $ git fetch origin # ensure you have the latest state from the main repo
    $ git submodule update
    
    $ cd ..
    $ mkdir paraview_build
    $ cd paraview_build
    $ cmake ../paraview-superbuild
    $ ccmake -DCMAKE_OSX_SDK=macosx10.14 ../paraview-superbuild
    

    I enabled the CMake variables:

    ENABLE_qt5
    ENABLE_python
    ENABLE_python2
    

    Then ran:

    $ make
    

    First, I got the error

    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm:833:20: error: qualified reference to 'QFixed' is a constructor name rather than a type in this context
        return QFixed::QFixed(int(CTFontGetUnitsPerEm(ctfont)));
    

    Which was solved by going to the file

    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/platformsupport/fontdatabases/mac/qfontengine_coretext.mm
    

    and remove QFixed:: prefix in line 833

    After that, I re run make and got a lot more errors

     ~ cd Desktop/dev/pv
    ➜  pv ls
    paraview-superbuild paraview_build
    ➜  pv cd paraview_build
    ➜  paraview_build clear
    ➜  paraview_build ls
    CMakeCache.txt        CTestCustom.cmake     DartConfiguration.tcl Testing               cpack                 install               tests
    CMakeFiles            CTestTestfile.cmake   Makefile              cmake_install.cmake   downloads             superbuild
    ➜  paraview_build make
    [  3%] Built target cxx11_check
    [ 14%] Built target szip
    [ 24%] Built target zlib
    [ 37%] Built target hdf5
    [ 46%] Built target cxx11
    [ 56%] Built target nlohmannjson
    [ 67%] Built target python2
    [ 79%] Built target python
    [ 80%] Performing build step for 'qt5'
    Makefile:2392: warning: overriding commands for target `../../lib/QtGui.framework/Versions/5/Headers/QGenericPlugin'
    Makefile:2024: warning: ignoring old commands for target `../../lib/QtGui.framework/Versions/5/Headers/QGenericPlugin'
    Makefile:2396: warning: overriding commands for target `../../lib/QtGui.framework/Versions/5/Headers/QGenericPluginFactory'
    Makefile:2020: warning: ignoring old commands for target `../../lib/QtGui.framework/Versions/5/Headers/QGenericPluginFactory'
    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp:235:9: error: unknown type name 'my_bool'
            my_bool nullIndicator;
            ^
    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp:986:13: error: use of undeclared identifier 'my_bool'
        QVector<my_bool> nullVector;
                ^
    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp:1000:9: error: use of undeclared identifier 'nullVector'
            nullVector.resize(values.count());
            ^
    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp:1007:13: error: use of undeclared identifier 'nullVector'
                nullVector[i] = static_cast<my_bool>(val.isNull());
                ^
    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp:1007:41: error: unknown type name 'my_bool'
                nullVector[i] = static_cast<my_bool>(val.isNull());
                                            ^
    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp:1008:34: error: use of undeclared identifier 'nullVector'; did you mean 'nullptr'?
                currBind->is_null = &nullVector[i];
                                     ^~~~~~~~~~
                                     nullptr
    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp:1008:33: error: cannot take the address of an rvalue of type 'nullptr_t'
                currBind->is_null = &nullVector[i];
                                    ^~~~~~~~~~~
    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp:1104:9: error: unknown type name 'my_bool'
            my_bool update_max_length = true;
            ^
    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp:1315:5: error: unknown type name 'my_bool'
        my_bool reconnect=false;
        ^
    In file included from /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp:47:
    In file included from /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/include/QtSql/qsqlindex.h:1:
    In file included from /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/include/QtSql/../../src/sql/kernel/qsqlindex.h:46:
    In file included from /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/include/QtCore/qvector.h:1:
    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/include/QtCore/../../src/corelib/tools/qvector.h:415:24: error: too many arguments to function call, expected single argument 'sz', have 3 arguments
        reallocData(asize, newAlloc, opt);
        ~~~~~~~~~~~        ^~~~~~~~~~~~~
    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp:399:12: note: in instantiation of member function 'QVector<QMYSQLResultPrivate::QMyField>::resize' requested here
        fields.resize(mysql_num_fields(meta));
               ^
    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/include/QtCore/../../src/corelib/tools/qvector.h:296:5: note: 'reallocData' declared here
        void reallocData(const int sz) { reallocData(sz, d->alloc); }
        ^
    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/include/QtCore/../../src/corelib/tools/qvector.h:296:54: error: too many arguments to function call, expected single argument 'sz', have 2 arguments
        void reallocData(const int sz) { reallocData(sz, d->alloc); }
                                         ~~~~~~~~~~~     ^~~~~~~~
    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/include/QtCore/../../src/corelib/tools/qvector.h:415:5: note: in instantiation of member function 'QVector<QMYSQLResultPrivate::QMyField>::reallocData' requested here
        reallocData(asize, newAlloc, opt);
        ^
    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/src/plugins/sqldrivers/mysql/qsql_mysql.cpp:399:12: note: in instantiation of member function 'QVector<QMYSQLResultPrivate::QMyField>::resize' requested here
        fields.resize(mysql_num_fields(meta));
               ^
    /Users/username/Desktop/dev/pv/paraview_build/superbuild/qt5/src/qtbase/include/QtCore/../../src/corelib/tools/qvector.h:296:5: note: 'reallocData' declared here
        void reallocData(const int sz) { reallocData(sz, d->alloc); }
        ^
    11 errors generated.
    make[8]: *** [.obj/qsql_mysql.o] Error 1
    make[7]: *** [sub-mysql-make_first] Error 2
    make[6]: *** [sub-sqldrivers-make_first] Error 2
    make[5]: *** [sub-plugins-make_first] Error 2
    make[4]: *** [sub-src-make_first] Error 2
    make[3]: *** [module-qtbase-make_first] Error 2
    CMake Error at /Users/username/Desktop/dev/pv/paraview_build/superbuild/sb-qt5-build.cmake:47 (message):
      Failed with exit code 2
    
    
    make[2]: *** [superbuild/qt5/stamp/qt5-build] Error 1
    make[1]: *** [superbuild/CMakeFiles/qt5.dir/all] Error 2
    make: *** [all] Error 2
    

    It seems to be a problem with qsql_mysql.

    Ho do I solve this?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What version of Qt is it ?
    Why not use a prebuilt version ?



  • The paraview-superbuild was suppose to install all the dependencies. I wanted to know if this was a fixable thing. Otherwise, the other option I have is install everything.. Where can i get the prebuilt version?


  • Lifetime Qt Champion

    You can find the online installer here



  • @SGaist

    I'm following your advice and use a prebuild version of Qt.
    What do you think I need? Because everything is really heavy

    Have in mind that I not only need to build paraview with enable_qt5= on but later I'm going to use Qt Creator to create my own app that uses the paraview framework

    Screen Shot 2019-12-09 at 4.23.35 PM.png

    Thanks!


  • Lifetime Qt Champion

    Then go with only the latest LTS currently the 5.12 series.



  • Thanks, @SGaist!

    I'm going to try this.

    One last question, when building ParaView, in cmake-gui I have to specify Qt5 path.
    I have installed Qt with the installer at /Applications/Qt/. Where can I find this folders?

    Screen Shot 2019-12-09 at 5.21.41 PM.png


  • Lifetime Qt Champion

    /Application/Qt/5.X.Y/clang_64/lib/cmake



  • @SGaist said in Error with sqldrivers, qsql_mysql, while building Qt on MacOS:

    /Application/Qt/5.X.Y/clang_64/lib/cmake

    Thanks! This finally worked!


Log in to reply