Home > other >  Qt 6.3 Configure has enabled PostgreSQL undesiredly
Qt 6.3 Configure has enabled PostgreSQL undesiredly

Time:08-08

After downloading qt-everywhere-src-6.3.1 I configured the build with

$ ../qt-everywhere-src-6.3.1/configure -qt-zlib -qt-libjpeg -qt-libpng -qt-freetype -qt-pcre -qt-harfbuzz -sql-sqlite -prefix <myPath>/qt_6.3.1_install

The output shows

 The following packages have been found:

[...]
 * WrapOpenGL
 * PostgreSQL
 * ODBC
[...]

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

I do not have PostgreSQL installed, neither I want to.

When I build with

cmake --build . --parallel

The build fails with

[1335/9292] Linking CXX shared module qtbase\plugins\sqldrivers\qsqlpsql.dll
FAILED: qtbase/plugins/sqldrivers/qsqlpsql.dll qtbase/src/plugins/sqldrivers/psql/QPSQLDriverPlugin.version C:/Data/programs/qt_6.3.1_build/qtbase/src/plugins/sqldrivers/psql/QPSQLDriverPlugin.version
cmd.exe /C "cmd.exe /C "cd /D C:\Data\programs\qt-everywhere-src-6.3.1\qtbase\src\plugins\sqldrivers\psql && "C:\Program Files\Git\usr\bin\perl.exe" C:/Data/programs/qt-everywhere-src-6.3.1/qtbase/mkspecs/features/data/unix/findclasslist.pl < C:/Data/programs/qt_6.3.1_build/qtbase/src/plugins/sqldrivers/psql/QPSQLDriverPlugin.version.in > C:/Data/programs/qt_6.3.1_build/qtbase/src/plugins/sqldrivers/psql/QPSQLDriverPlugin.version && cd C:\Data\programs\qt_6.3.1_build" && C:\Data\programs\mingw64\bin\c  .exe -DNDEBUG -O2  -Wl,--no-undefined -Wl,--version-script,C:/Data/programs/qt_6.3.1_build/qtbase/src/plugins/sqldrivers/psql/QPSQLDriverPlugin.version -shared -o qtbase\plugins\sqldrivers\qsqlpsql.dll -Wl,--major-image-version,0,--minor-image-version,0 qtbase/src/plugins/sqldrivers/psql/CMakeFiles/QPSQLDriverPlugin.dir/QPSQLDriverPlugin_autogen/mocs_compilation.cpp.obj qtbase/src/plugins/sqldrivers/psql/CMakeFiles/QPSQLDriverPlugin.dir/main.cpp.obj qtbase/src/plugins/sqldrivers/psql/CMakeFiles/QPSQLDriverPlugin.dir/qsql_psql.cpp.obj qtbase/src/plugins/sqldrivers/psql/CMakeFiles/QPSQLDriverPlugin.dir/QPSQLDriverPlugin_resource.rc.obj  C:/Strawberry/c/lib/libpq.a  qtbase/lib/libQt6Sql.a  qtbase/lib/libQt6Core.a  -lmpr  -luserenv  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
C:/Data/programs/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: qtbase/src/plugins/sqldrivers/psql/CMakeFiles/QPSQLDriverPlugin.dir/qsql_psql.cpp.obj:qsql_psql.cpp:(.text 0xb7): undefined reference to `PQgetisnull'
C:/Data/programs/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: qtbase/src/plugins/sqldrivers/psql/CMakeFiles/QPSQLDriverPlugin.dir/qsql_psql.cpp.obj:qsql_psql.cpp:(.text 0x230): undefined reference to `PQstatus'
C:/Data/programs/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: qtbase/src/plugins/sqldrivers/psql/CMakeFiles/QPSQLDriverPlugin.dir/qsql_psql.cpp.obj:qsql_psql.cpp:(.text 0x311): undefined reference to `PQcmdTuples'
[...]

As far as I understand this issue, the linker is missing the PostgreSQL libraries. What do I need to do to disable the PostregSQL?

CodePudding user response:

The documentation ./configure -h gives you following information about the sql drivers:

Database options:

  -sql-<driver> ........ Enable SQL <driver> plugin. Supported drivers:
                         db2 ibase mysql oci odbc psql sqlite
                         [all auto]
  -sqlite .............. Select used sqlite [system/qt]

With too much try and error I finally understood that you can prefix most flags with no. To disable PostgreSQL you can use -no-sql-psql. My complete command line to configure and build Qt was:

  ../src/configure -qt-zlib -qt-libjpeg -qt-libpng -qt-freetype -qt-pcre -qt-harfbuzz -qt-sqlite -no-sql-psql -qt-tiff -qt-webp -no-ssl -skip qtopcua -prefix ../install
  • Related