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. [SOLVED]can't find the "src" directory to build my QPSQL driver
QtWS25 Last Chance

[SOLVED]can't find the "src" directory to build my QPSQL driver

Scheduled Pinned Locked Moved General and Desktop
63 Posts 3 Posters 28.4k Views
  • 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.
  • K Offline
    K Offline
    k_arnaud
    wrote on 10 Apr 2014, 08:18 last edited by
    #1

    Hi,
    i've a problem with my Qt application when trying to use a PostgreSQL database. here is the error message i'm getting: QSqlDatabase: QPSQL driver not loaded
    QSqlDatabase: available drivers: QSQLITE QMYSQL QMYSQL3 QODBC QODBC3 QPSQL QPSQL7
    .
    i've found "here":http://qt-project.org/doc/qt-4.8/sql-driver.html#qpsql a way to build a QPSQL driver but, i don't have any directory named "src" in my Qt installed directory.
    can someone help me.
    Thanks!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 10 Apr 2014, 08:46 last edited by
      #2

      Hi and welcome to devnet,

      It's because you didn't installed the sources. You can grab them from the download page. Just ensure that it matches your current installed Qt.

      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
      • K Offline
        K Offline
        k_arnaud
        wrote on 10 Apr 2014, 08:49 last edited by
        #3

        ok, thanks but i download Qt with the installer, how can i get sources

        1 Reply Last reply
        0
        • C Offline
          C Offline
          clochydd
          wrote on 10 Apr 2014, 08:55 last edited by
          #4

          Hi, you can download the sources "here: ":http://qt-project.org/downloads

          1 Reply Last reply
          0
          • K Offline
            K Offline
            k_arnaud
            wrote on 10 Apr 2014, 09:03 last edited by
            #5

            ok thanks! i'm downloading the sources, how can install them or i have to copy the src directory in my Qt installed directory ?

            1 Reply Last reply
            0
            • C Offline
              C Offline
              clochydd
              wrote on 10 Apr 2014, 09:23 last edited by
              #6

              Maybe "this ":http://qt-project.org/forums/viewthread/34609/ will help you.

              1 Reply Last reply
              0
              • C Offline
                C Offline
                clochydd
                wrote on 10 Apr 2014, 09:52 last edited by
                #7

                Hi k_arnaud,

                I wrote a small tutorial for setting up Qt5.2.1/mingw + PostgreSQL 32-Bit on Win7 - hope it will help:

                1. Prepare compiling of the plugin (Lets assume we install Qt + Sources to C:\Qt, PostgresSQL to C:\Programs(86x)):

                2. Download Qt 5.2.1 32-bit: http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-windows-x86-mingw48_opengl-5.2.1.exe

                3. Run the .exe, install to C:\Qt\Qt5.2.1

                4. Download sources: http://download.qt-project.org/official_releases/qt/5.2/5.2.1/single/qt-everywhere-opensource-src-5.2.1.zip

                5. Extract zip to C:\Qt\Qt5.2.1

                6. Download PostGreSQL 32-bit: http://www.enterprisedb.com/postgresql-932-1-installers-win32?ls=Crossover&type=Crossover

                7. Modify PATH:
                  set QTSDK_SQLDRIVERS_PATH=C:\Qt\Qt5.2.1\5.2.1\mingw48_32\plugins\sqldrivers
                  set QT_SRC_PATH=C:\Qt\Qt5.2.1\5.2.1\Src\qtbase
                  set POSTGRES32=C:\Progra~2\PostgreSQL\9.3 (USE Progra~2 FOR Programs(86x)!)

                8. cd QT_SRC_PATH\src\plugins\sqldrivers\psql

                9. add permanently to PATH (Control Panel): C:\Qt\Qt5.2.1\Tools\mingw48_32\bin

                10. modify C:\Progra~2\PostgreSQL\9.3\include\pthread.h (multiple definitions of struct timespec):
                  replace: #ifndef HAVE_STRUCT_TIMESPEC
                  with: #if ((!defined(_TIMESPEC_DEFINED)) && (!defined(HAVE_STRUCT_TIMESPEC)))

                11. start building the plugins:
                  C:\Qt\Qt5.2.1\5.2.1\mingw48_32\bin\qmake “INCLUDEPATH+=%POSTGRES32%\include” “LIBS+=%POSTGRES32%\lib\libpq.lib” psql.pro
                  mingw32-make debug
                  mingw32-make release

                12. copy the newly created plugins to C:\Qt\Qt5.2.1\5.2.1\mingw48_32\plugins\sqldrivers:
                  copy release\libqsqlpsql.a QTSDK_SQLDRIVERS_PATH
                  copy release\qsqlpsql.dll QTSDK_SQLDRIVERS_PATH
                  copy debug\libqsqlpsqld.a QTSDK_SQLDRIVERS_PATH
                  copy debug\qsqlpsqld.dll QTSDK_SQLDRIVERS_PATH

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  k_arnaud
                  wrote on 10 Apr 2014, 10:10 last edited by
                  #8

                  ok thank Clochydd Clochydd i'll try, but i've a Windows 8 64 bit and PostgreSQL9.3 64 bits. I do hope it will work.
                  thank !

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    clochydd
                    wrote on 10 Apr 2014, 10:14 last edited by
                    #9

                    Then you can only use this tutorial as a very rough guide as you do not work with the 32-Bit mingw, too.

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      k_arnaud
                      wrote on 11 Apr 2014, 10:56 last edited by
                      #10

                      Hi Clochydd Clochydd
                      i downloaded PostgreSQL 32 bit and i tried to follow what you've written. but i can't undersdands the #7, when you say . " Modify PATH:
                      set QTSDK_SQLDRIVERS_PATH=C:\Qt\Qt5.2.0\5.2.1\mingw48_32\plugins\sqldrivers
                      set QT_SRC_PATH=C:\Qt\Qt5.2.1\5.2.1\Src\qtbase
                      set POSTGRES32=C:\Progra~2\PostgreSQL\9.3 (USE Progra~2 FOR Programs(86x)!)" and more of the following

                      when you asked me to run the .exe installed in Qt installed dir, did you mean Qt creator ? if not which .exe i should run ? thanks

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        clochydd
                        wrote on 11 Apr 2014, 11:12 last edited by
                        #11

                        Hi k_arnaud,
                        sorry, I made a mistake: It should read "Modify environment" as the variables have to be added. You should set these entries in the CMD-window and have a look at the correct paths - relating to your system.

                        1 Reply Last reply
                        0
                        • K Offline
                          K Offline
                          k_arnaud
                          wrote on 11 Apr 2014, 12:21 last edited by
                          #12

                          ok, but when you said run the .exe, do you mean Qt creator ?

                          1 Reply Last reply
                          0
                          • C Offline
                            C Offline
                            clochydd
                            wrote on 11 Apr 2014, 12:30 last edited by
                            #13

                            I'm sorry but I do not understand. What do you mean with run the .exe?

                            1 Reply Last reply
                            0
                            • K Offline
                              K Offline
                              k_arnaud
                              wrote on 11 Apr 2014, 14:34 last edited by
                              #14

                              about the #11 i've installed Qt with msvc2010 not mingw32

                              1 Reply Last reply
                              0
                              • C Offline
                                C Offline
                                clochydd
                                wrote on 11 Apr 2014, 14:57 last edited by
                                #15

                                If you have installed with msvc2010 you cannot work with the 32-Bit postgres. I never worked with msvc2010.

                                1 Reply Last reply
                                0
                                • K Offline
                                  K Offline
                                  k_arnaud
                                  wrote on 11 Apr 2014, 15:37 last edited by
                                  #16

                                  ok i'll try with mingw32. thanks

                                  1 Reply Last reply
                                  0
                                  • K Offline
                                    K Offline
                                    k_arnaud
                                    wrote on 12 Apr 2014, 09:12 last edited by
                                    #17

                                    Hi Clochydd, i've downloaded Qt with mingw32...
                                    About the #11 here is the error message i get: "cannot find file psql.pro"

                                    1 Reply Last reply
                                    0
                                    • C Offline
                                      C Offline
                                      clochydd
                                      wrote on 12 Apr 2014, 10:10 last edited by
                                      #18

                                      Hi k_arnaud, the message says that the project file for building the plugin cannot be found.
                                      Did you go to the plugins directory:
                                      8. cd QT_SRC_PATH\src\plugins\sqldrivers\psql
                                      If so, does the psql.pro exist here?

                                      1 Reply Last reply
                                      0
                                      • K Offline
                                        K Offline
                                        k_arnaud
                                        wrote on 12 Apr 2014, 11:09 last edited by
                                        #19

                                        after entering mingw32-make debug , in the unreadable message i get, i can see makefile:48: recipe for target 'debug' failed and i get the same with release

                                        1 Reply Last reply
                                        0
                                        • C Offline
                                          C Offline
                                          clochydd
                                          wrote on 12 Apr 2014, 11:19 last edited by
                                          #20

                                          You should check your pathnames again - it seems that dependencies cannot be found. If you cannot find a fault: What is the unreadable message?

                                          1 Reply Last reply
                                          0

                                          3/63

                                          10 Apr 2014, 08:49

                                          topic:navigator.unread, 60
                                          • Login

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