Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-116572

build failure about ‘sqlite3_filename’ has not been declared

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • 6.7.0 FF
    • 6.7, dev
    • SQL Support, sqlite
    • None
    • Linux/X11
    • 50f24f715 (dev)

    Description

      Got build failure like

      [719/1622] Building CXX object src/plugins/sqldrivers/sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/qsql_sqlite_vfs.cpp.o
      FAILED: src/plugins/sqldrivers/sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/qsql_sqlite_vfs.cpp.o 
      /run/ccache/bin/c++ -DQSQLiteDriverPlugin_EXPORTS -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_UP_TO=0x050000 -DQT_EXPLICIT_QFILE_CONSTRUCTION_FROM_PATH -DQT_LEAN_HEADERS=1 -DQT_NO_AS_CONST -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_CONTEXTLESS_CONNECT -DQT_NO_DEBUG -DQT_NO_EXCEPTIONS -DQT_NO_FOREACH -DQT_NO_JAVA_STYLE_ITERATORS -DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_NO_QEXCHANGE -DQT_PLUGIN -DQT_SQL_LIB -DQT_USE_QSTRINGBUILDER -DQT_WARN_DEPRECATED_UP_TO=0x070000 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/run/build-runtime/qt6-qtbase/src/plugins/sqldrivers/sqlite/QSQLiteDriverPlugin_autogen/include -I/run/build-runtime/qt6-qtbase/src/plugins/sqldrivers/sqlite -I/run/build-runtime/qt6-qtbase/include -I/run/build-runtime/qt6-qtbase/include/QtCore -I/run/build-runtime/qt6-qtbase/mkspecs/linux-g++ -I/run/build-runtime/qt6-qtbase/src/corelib -I/run/build-runtime/qt6-qtbase/include/QtCore/6.7.0 -I/run/build-runtime/qt6-qtbase/include/QtCore/6.7.0/QtCore -I/run/build-runtime/qt6-qtbase/src/sql -I/run/build-runtime/qt6-qtbase/include/QtSql/6.7.0 -I/run/build-runtime/qt6-qtbase/include/QtSql/6.7.0/QtSql -I/run/build-runtime/qt6-qtbase/include/QtSql -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -DNDEBUG -O2 -std=c++17 -fPIC -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -fno-exceptions -fPIC -Wsuggest-override -fcf-protection=full -MD -MT src/plugins/sqldrivers/sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/qsql_sqlite_vfs.cpp.o -MF src/plugins/sqldrivers/sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/qsql_sqlite_vfs.cpp.o.d -o src/plugins/sqldrivers/sqlite/CMakeFiles/QSQLiteDriverPlugin.dir/qsql_sqlite_vfs.cpp.o -c /run/build-runtime/qt6-qtbase/src/plugins/sqldrivers/sqlite/qsql_sqlite_vfs.cpp
      /run/build-runtime/qt6-qtbase/src/plugins/sqldrivers/sqlite/qsql_sqlite_vfs.cpp:115:30: error: ‘sqlite3_filename’ has not been declared
        115 | int xOpen(sqlite3_vfs *svfs, sqlite3_filename zName, sqlite3_file *sfile,
            |                              ^~~~~~~~~~~~~~~~
      /run/build-runtime/qt6-qtbase/src/plugins/sqldrivers/sqlite/qsql_sqlite_vfs.cpp: In function ‘int {anonymous}::xOpen(sqlite3_vfs*, int, sqlite3_file*, int, int*)’:
      /run/build-runtime/qt6-qtbase/src/plugins/sqldrivers/sqlite/qsql_sqlite_vfs.cpp:148:53: error: no matching function for call to ‘QString::fromUtf8(int&)’
        148 |     file->pFile = new File::QtFile(QString::fromUtf8(zName), bool(flags & SQLITE_OPEN_DELETEONCLOSE));
            |                                    ~~~~~~~~~~~~~~~~~^~~~~~~
      In file included from /run/build-runtime/qt6-qtbase/include/QtCore/qstring.h:1,
                       from /run/build-runtime/qt6-qtbase/include/QtCore/../../src/corelib/kernel/qobject.h:11,
                       from /run/build-runtime/qt6-qtbase/include/QtCore/qobject.h:1,
                       from /run/build-runtime/qt6-qtbase/include/QtCore/../../src/corelib/io/qiodevice.h:10,
                       from /run/build-runtime/qt6-qtbase/include/QtCore/qiodevice.h:1,
                       from /run/build-runtime/qt6-qtbase/include/QtCore/../../src/corelib/io/qfiledevice.h:7,
                       from /run/build-runtime/qt6-qtbase/include/QtCore/qfiledevice.h:1,
                       from /run/build-runtime/qt6-qtbase/include/QtCore/../../src/corelib/io/qfile.h:8,
                       from /run/build-runtime/qt6-qtbase/include/QtCore/qfile.h:1,
                       from /run/build-runtime/qt6-qtbase/include/QtCore/QFile:1,
                       from /run/build-runtime/qt6-qtbase/src/plugins/sqldrivers/sqlite/qsql_sqlite_vfs.cpp:6:
      /run/build-runtime/qt6-qtbase/include/QtCore/../../src/corelib/text/qstring.h:588:27: note: candidate: ‘template<class&gt; static QString QString::fromUtf8(const QByteArray&)’
        588 |     static inline QString fromUtf8(const QByteArray &ba) { return fromUtf8(QByteArrayView(ba)); }
            |                           ^~~~~~~~
      /run/build-runtime/qt6-qtbase/include/QtCore/../../src/corelib/text/qstring.h:588:27: note:   template argument deduction/substitution failed:
      /run/build-runtime/qt6-qtbase/src/plugins/sqldrivers/sqlite/qsql_sqlite_vfs.cpp:148:54: note:   cannot convert ‘zName’ (type ‘int’) to type ‘const QByteArray&’
        148 |     file->pFile = new File::QtFile(QString::fromUtf8(zName), bool(flags & SQLITE_OPEN_DELETEONCLOSE));
            |                                                      ^~~~~
      /run/build-runtime/qt6-qtbase/include/QtCore/../../src/corelib/text/qstring.h:586:20: note: candidate: ‘static QString QString::fromUtf8(QByteArrayView)’
        586 |     static QString fromUtf8(QByteArrayView utf8);
            |                    ^~~~~~~~
      /run/build-runtime/qt6-qtbase/include/QtCore/../../src/corelib/text/qstring.h:586:44: note:   no known conversion for argument 1 from ‘int’ to ‘QByteArrayView’
        586 |     static QString fromUtf8(QByteArrayView utf8);
            |                             ~~~~~~~~~~~~~~~^~~~
      /run/build-runtime/qt6-qtbase/include/QtCore/../../src/corelib/text/qstring.h:589:27: note: candidate: ‘static QString QString::fromUtf8(const char*, qsizetype)’
        589 |     static inline QString fromUtf8(const char *utf8, qsizetype size)
            |                           ^~~~~~~~
      /run/build-runtime/qt6-qtbase/include/QtCore/../../src/corelib/text/qstring.h:589:27: note:   candidate expects 2 arguments, 1 provided
      /run/build-runtime/qt6-qtbase/src/plugins/sqldrivers/sqlite/qsql_sqlite_vfs.cpp: In function ‘void register_qt_vfs()’:
      /run/build-runtime/qt6-qtbase/src/plugins/sqldrivers/sqlite/qsql_sqlite_vfs.cpp:230:17: error: invalid conversion from ‘int (*)(sqlite3_vfs*, int, sqlite3_file*, int, int*)’ to ‘int (*)(sqlite3_vfs*, const char*, sqlite3_file*, int, int*)’ [-fpermissive]
        230 |     vfs.xOpen = &xOpen;
            |                 ^~~~~~
            |                 |
            |                 int (*)(sqlite3_vfs*, int, sqlite3_file*, int, int*)
      [726/1622] Automatic MOC for target Gui
      

      And find out in my /usr/include/sqlite3.h , there is no definition of sqlite3_filename

      https://github.com/sqlite/sqlite/commit/52d5d474f5497a34e6167b9aeee9ad1e47588da3 , in Nov. 2022, it's very new.

      https://codereview.qt-project.org/c/qt/qtbase/+/484651 should have some detection for different versions of sqlite3.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-116572
          # Subject Branch Project Status CR V

          Activity

            People

              chehrlic Christian Ehrlicher
              liaqi Liang Qi
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes