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. How to Build the QSQLITE Plugin
Qt 6.11 is out! See what's new in the release blog

How to Build the QSQLITE Plugin

Scheduled Pinned Locked Moved Solved General and Desktop
20 Posts 6 Posters 4.1k Views 3 Watching
  • 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.
  • Christian EhrlicherC Online
    Christian EhrlicherC Online
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on last edited by
    #3

    Why do you want to build the sqlite plugin? Normally this is shipped with your Qt installation and when you build Qt from sources it's also build by default.

    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
    Visit the Qt Academy at https://academy.qt.io/catalog

    T 1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher

      Why do you want to build the sqlite plugin? Normally this is shipped with your Qt installation and when you build Qt from sources it's also build by default.

      T Offline
      T Offline
      tmfjr
      wrote on last edited by
      #4

      @Christian-Ehrlicher We added an encryption piece and need to use our custom version.

      Christian EhrlicherC 1 Reply Last reply
      0
      • Pablo J. RoginaP Pablo J. Rogina

        @tmfjr said in How to Build the QSQLITE Plugin:

        qmake -- -system-sqlite SQLITE3_PREFIX=${SQL_DIR}

        It looks like you're not doing proper variable assignment...

        T Offline
        T Offline
        tmfjr
        wrote on last edited by
        #5

        @Pablo-J-Rogina How so? I am just following the provided instructions. My ${SQL_DIR} variable is a proper value.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Bonnie
          wrote on last edited by
          #6

          As I checked the result of debug level, it should be SQLITE_PREFIX.
          And you should have include and lib folder in ${SQL_DIR}.

          T 1 Reply Last reply
          1
          • T tmfjr

            @Christian-Ehrlicher We added an encryption piece and need to use our custom version.

            Christian EhrlicherC Online
            Christian EhrlicherC Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #7

            @tmfjr said in How to Build the QSQLITE Plugin:

            We added an encryption piece and need to use our custom version.

            Then why do you add '-system-sqlite'?
            Take a look into config.log as described in the documentation to see why the sqlite libs/headers are not found.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            T 1 Reply Last reply
            1
            • B Bonnie

              As I checked the result of debug level, it should be SQLITE_PREFIX.
              And you should have include and lib folder in ${SQL_DIR}.

              T Offline
              T Offline
              tmfjr
              wrote on last edited by
              #8

              @Bonnie Right, thanks!

              1 Reply Last reply
              0
              • Christian EhrlicherC Christian Ehrlicher

                @tmfjr said in How to Build the QSQLITE Plugin:

                We added an encryption piece and need to use our custom version.

                Then why do you add '-system-sqlite'?
                Take a look into config.log as described in the documentation to see why the sqlite libs/headers are not found.

                T Offline
                T Offline
                tmfjr
                wrote on last edited by
                #9

                @Christian-Ehrlicher Good catch, thanks! Here is the solution that seems to build correctly now:

                export SQL_DIR=/data/DEPS_ROOT/SQLite
                export QTSRC=/data/Qt/5.14.2/Src
                export QTDIR=/data/Qt/5.14.2/gcc_64
                export PATH=${QTDIR}/bin:${PATH}

                cd ${QTSRC}/qtbase/src/plugins/sqldrivers/
                qmake -- SQLITE_PREFIX=${SQL_DIR}
                make sub-sqlite

                Pablo J. RoginaP 1 Reply Last reply
                2
                • T tmfjr

                  @Christian-Ehrlicher Good catch, thanks! Here is the solution that seems to build correctly now:

                  export SQL_DIR=/data/DEPS_ROOT/SQLite
                  export QTSRC=/data/Qt/5.14.2/Src
                  export QTDIR=/data/Qt/5.14.2/gcc_64
                  export PATH=${QTDIR}/bin:${PATH}

                  cd ${QTSRC}/qtbase/src/plugins/sqldrivers/
                  qmake -- SQLITE_PREFIX=${SQL_DIR}
                  make sub-sqlite

                  Pablo J. RoginaP Offline
                  Pablo J. RoginaP Offline
                  Pablo J. Rogina
                  wrote on last edited by
                  #10

                  @tmfjr if your issue is solved, please don't forget to mark your post as such!

                  Upvote the answer(s) that helped you solve the issue
                  Use "Topic Tools" button to mark your post as Solved
                  Add screenshots via postimage.org
                  Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                  T 1 Reply Last reply
                  1
                  • Pablo J. RoginaP Pablo J. Rogina

                    @tmfjr if your issue is solved, please don't forget to mark your post as such!

                    T Offline
                    T Offline
                    tmfjr
                    wrote on last edited by
                    #11

                    @Pablo-J-Rogina It looks like it it not solved. Although it compiles without error, it is not using the version of SQLite I provide. In the build log, there is no -I or -L path to my version of SQLite.

                    B 1 Reply Last reply
                    0
                    • T tmfjr

                      @Pablo-J-Rogina It looks like it it not solved. Although it compiles without error, it is not using the version of SQLite I provide. In the build log, there is no -I or -L path to my version of SQLite.

                      B Offline
                      B Offline
                      Bonnie
                      wrote on last edited by
                      #12

                      @tmfjr
                      I think you was right to use "-system-sqlite", maybe try to add that back?

                      T 1 Reply Last reply
                      1
                      • B Bonnie

                        @tmfjr
                        I think you was right to use "-system-sqlite", maybe try to add that back?

                        T Offline
                        T Offline
                        tmfjr
                        wrote on last edited by
                        #13

                        @Bonnie I tried adding it back, but I get this:

                        ERROR: Feature 'system-sqlite' was enabled, but the pre-condition 'features.sql-sqlite && libs.sqlite3' failed.

                        B 1 Reply Last reply
                        0
                        • T tmfjr

                          @Bonnie I tried adding it back, but I get this:

                          ERROR: Feature 'system-sqlite' was enabled, but the pre-condition 'features.sql-sqlite && libs.sqlite3' failed.

                          B Offline
                          B Offline
                          Bonnie
                          wrote on last edited by Bonnie
                          #14

                          @tmfjr
                          What's your config.log saying?
                          And what do you have in ${SQL_DIR}/include and ${SQL_DIR}/lib?

                          T 1 Reply Last reply
                          0
                          • B Bonnie

                            @tmfjr
                            What's your config.log saying?
                            And what do you have in ${SQL_DIR}/include and ${SQL_DIR}/lib?

                            T Offline
                            T Offline
                            tmfjr
                            wrote on last edited by
                            #15

                            @Bonnie It looks like it is finding the library, but seems to not like that it is static.

                            • cd /data/Qt/5.14.2/Src/config.tests/sqlite3 && MAKEFLAGS= /opt/rh/devtoolset-8/root/usr/bin/gmake

                            g++ -c -pipe -O2 -w -fPIC -I. -I/data/DEPS_ROOT/SQLite/include -I/data/Qt/5.14.2/Src/qtbase/mkspecs/linux-g++ -o main.o main.cpp
                            g++ -Wl,-O1 -o sqlite3 main.o -L/data/DEPS_ROOT/SQLite/lib -lsqlite3 -lz
                            /data/DEPS_ROOT/SQLite/lib/libsqlite3.a(see-sqlite3.o): In function pthreadMutexAlloc': see-sqlite3.c:(.text+0x3e32): undefined reference to pthread_mutexattr_init'
                            see-sqlite3.c:(.text+0x3e43): undefined reference to pthread_mutexattr_settype' see-sqlite3.c:(.text+0x3e62): undefined reference to pthread_mutexattr_destroy'
                            /data/DEPS_ROOT/SQLite/lib/libsqlite3.a(see-sqlite3.o): In function pthreadMutexTry': see-sqlite3.c:(.text+0x3f17): undefined reference to pthread_mutex_trylock'
                            /data/DEPS_ROOT/SQLite/lib/libsqlite3.a(see-sqlite3.o): In function sqlite3ThreadCreate': see-sqlite3.c:(.text+0x7e0b): undefined reference to pthread_create'
                            /data/DEPS_ROOT/SQLite/lib/libsqlite3.a(see-sqlite3.o): In function sqlite3ThreadJoin': see-sqlite3.c:(.text+0x7ea0): undefined reference to pthread_join'
                            /data/DEPS_ROOT/SQLite/lib/libsqlite3.a(see-sqlite3.o): In function unixDlOpen': see-sqlite3.c:(.text+0xf680): undefined reference to dlopen'
                            /data/DEPS_ROOT/SQLite/lib/libsqlite3.a(see-sqlite3.o): In function unixDlError': see-sqlite3.c:(.text+0xf69f): undefined reference to dlerror'
                            /data/DEPS_ROOT/SQLite/lib/libsqlite3.a(see-sqlite3.o): In function unixDlSym': see-sqlite3.c:(.text+0xf6ee): undefined reference to dlsym'
                            /data/DEPS_ROOT/SQLite/lib/libsqlite3.a(see-sqlite3.o): In function unixDlClose': see-sqlite3.c:(.text+0xf724): undefined reference to dlclose'
                            collect2: error: ld returned 1 exit status
                            gmake: *** [Makefile:67: sqlite3] Error 1
                            => source failed verification.

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #16

                              Hi,

                              Does your custom SQLite library have dependencies ?
                              Are the missing symbols coming from them ?

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              T 1 Reply Last reply
                              0
                              • SGaistS SGaist

                                Hi,

                                Does your custom SQLite library have dependencies ?
                                Are the missing symbols coming from them ?

                                T Offline
                                T Offline
                                tmfjr
                                wrote on last edited by
                                #17

                                @SGaist It seems all dependent libraries need to be listed when configuring. Instead of following the instructions noted initially, which are incorrect, I configured like this:

                                ./configure -I ${SQL_DIR}/include -L ${SQL_DIR}/lib -system-sqlite SQLITE_PREFIX=${SQL_DIR} SQLITE_INCDIR=${SQL_DIR}/include SQLITE_LIBDIR=${SQL_DIR}/lib SQLITE_LIBS="-lsqlite3 -lpthread -ldl" -prefix /data/Qt_build

                                This got me past the configure errors. Some of this may be redundant, but my config.log is now clean.

                                g++ -c -pipe -O2 -w -fPIC -I. -I/data/DEPS_ROOT/SQLite/include -I/data/DEPS_ROOT/SQLite/include -I/data/DEPS_ROOT/SQLite/include -I/data/Qt/5.14.2/Src/qtbase/mkspecs/linux-g++ -o main.o main.cpp

                                g++ -Wl,-O1 -o sqlite3 main.o -L/data/DEPS_ROOT/SQLite/lib -lsqlite3 -lpthread -ldl -lz
                                => source accepted.
                                test config.qtbase_sqldrivers.libraries.sqlite3 succeeded

                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #18

                                  The tripled include statement looks like overkill in the test :-D
                                  But other than than that, yes, you need to list everything that is used and not "hidden" in the implementation itself.

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  A 1 Reply Last reply
                                  1
                                  • SGaistS SGaist

                                    The tripled include statement looks like overkill in the test :-D
                                    But other than than that, yes, you need to list everything that is used and not "hidden" in the implementation itself.

                                    A Offline
                                    A Offline
                                    AMGAMG
                                    wrote on last edited by AMGAMG
                                    #19

                                    @SGaist: I've read this thread as I'm trying to do exactly the same - i.e. build a SQLite driver using the encryption extension.

                                    I have downloaded the sources for sqlite into a directory and defined %SQLITE_DIR% to point to it.

                                    I am having a problem with configure.

                                    With this configure command:

                                    CALL configure -prefix %CD%\qtbase -nomake tests -nomake examples -system-sqlite -opensource -confirm-license SQLITE_PREFIX=%SQLITE_DIR%
                                    

                                    I see this error, from configure:

                                    Project ERROR: Unknown feature object datestring in expression 'features.datestring && libs.odbc'.
                                    

                                    Before reading this thread, I had -sql-sqlite in the configure command rather than -system-sqlite and, while configure completed successfully, I later saw the same error when I executed qmake.

                                    I appreciate that I have omitted several arguments that @tmfr had included on the configure command and I expect to have to tackle them once I've got configure to complete successfully once more.

                                    I can't see anything helpful in config.log. In particular it does not include any reference to datestring. How should I continue?

                                    Apologies

                                    The above transcript comes from a run where I executed configure ... -sql-sqlite.... I know this is wrong. I still have errors with configure ... -system-sqlite ... but I will try to resolve them myself before posting any further questions.

                                    SGaistS 1 Reply Last reply
                                    0
                                    • A AMGAMG

                                      @SGaist: I've read this thread as I'm trying to do exactly the same - i.e. build a SQLite driver using the encryption extension.

                                      I have downloaded the sources for sqlite into a directory and defined %SQLITE_DIR% to point to it.

                                      I am having a problem with configure.

                                      With this configure command:

                                      CALL configure -prefix %CD%\qtbase -nomake tests -nomake examples -system-sqlite -opensource -confirm-license SQLITE_PREFIX=%SQLITE_DIR%
                                      

                                      I see this error, from configure:

                                      Project ERROR: Unknown feature object datestring in expression 'features.datestring && libs.odbc'.
                                      

                                      Before reading this thread, I had -sql-sqlite in the configure command rather than -system-sqlite and, while configure completed successfully, I later saw the same error when I executed qmake.

                                      I appreciate that I have omitted several arguments that @tmfr had included on the configure command and I expect to have to tackle them once I've got configure to complete successfully once more.

                                      I can't see anything helpful in config.log. In particular it does not include any reference to datestring. How should I continue?

                                      Apologies

                                      The above transcript comes from a run where I executed configure ... -sql-sqlite.... I know this is wrong. I still have errors with configure ... -system-sqlite ... but I will try to resolve them myself before posting any further questions.

                                      SGaistS Offline
                                      SGaistS Offline
                                      SGaist
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #20

                                      @AMGAMG there's no need to rebuild all of Qt only to build one of the SQL plugins. There are instructions in the documentation for that.

                                      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
                                      0

                                      • Login

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