Results 1 to 15 of 15

Thread: PostgreSQL driver support

  1. #1
    Join Date
    Nov 2009
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default PostgreSQL driver support

    I'm using Qt 4.5 on a Windows XP system. I need to connect to a PostgreSQL database. I've done the configure -plugin-sql-psql command and did a mingw32-make afterwards and got the following errors:

    collect2: ld returned 1 exit status
    mingw32-make[2]: *** [..\..\..\bin\moc.exe] Error 1
    mingw32-make[2]: Leaving directory `C:/Qt/2009.04/qt/src/tools/moc'
    mingw32-make[1]: *** [release] Error 2
    mingw32-make[1]: Leaving directory `C:/Qt/2009.04/qt/src/tools/moc'
    mingw32-make: *** [sub-moc-make_default-ordered] Error 2

    I've also followed the instructions found at http://wiki.qtcentre.org/index.php?t...ws_using_MinGW and got the following errors.

    'C:/Qt/2009.04/qt/bin/moc.exe' is not recognized as an internal or external comm
    and,
    operable program or batch file.
    mingw32-make[1]: *** [tmp/moc/debug_shared/moc_qsql_psql.cpp] Error 1
    mingw32-make[1]: Leaving directory `C:/Qt/2009.04/qt/src/plugins/sqldrivers/psql
    '
    mingw32-make: *** [debug-all] Error 2

    What is going on here???

  2. #2
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: PostgreSQL driver support

    try these instructions instead:
    http://qt.nokia.com/doc/4.0/sql-driver.html#qpsql

    but use mingw32-make instead of nmake... worked for me.

  3. #3
    Join Date
    Nov 2009
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: PostgreSQL driver support

    I did. Still doesn't work

  4. #4
    Join Date
    Oct 2009
    Posts
    364
    Thanks
    10
    Thanked 37 Times in 36 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: PostgreSQL driver support

    you probably are already doing this, but just in case:

    1)you are using the qt command prompt - right?
    2)PostgreSQL dev headers/libraries are installed and added to the path?

    Here are my settings after starting the qt command prompt:

    Setting up a MinGW/Qt only environment...
    -- QTDIR set to C:\Qt\2009.03\qt
    -- PATH set to C:\Qt\2009.03\qt\bin
    -- Adding C:\Qt\2009.03\bin to PATH
    -- Adding C:\WINDOWS\System32 to PATH
    -- QMAKESPEC set to win32-g++

    C:\Qt\2009.03\qt>path
    PATH=C:\Qt\2009.03\qt\bin;C:\Qt\2009.03\bin;C:\Qt\ 2009.03\mingw\bin;C:\WINDOWS\S
    ystem32


    if you still encounter problems, try resetting that psql folder to its initial state, i.e. the folder should only contain:
    main.cpp
    psql.pro
    README

    One more thing... make sure you don't have any spaces in the path when building the plugin. It is best to use the 8.3 file/folder names or alternatively, install psql to some easy location, i.e. c:\psql.
    Last edited by schnitzel; 10th November 2009 at 17:37.

  5. #5
    Join Date
    Nov 2009
    Location
    Laval, France
    Posts
    124
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: PostgreSQL driver support

    Hello,
    I'm on Win XP, using MingW and have spent a day and a half trying to get the
    Qt Postgres driver to work.
    I gave up in disgust. It's some kind of a cruel hoax.
    In less than an hour I had Libpq running fine, so why even bother with this complicated
    system. Life is too short.

  6. #6
    Join Date
    Nov 2009
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: PostgreSQL driver support

    What did you do to get libpq working???

  7. #7
    Join Date
    Feb 2008
    Posts
    50
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PostgreSQL driver support

    Not so hard.. just made a pri file in the C:/psql dir with include and lib something like
    Qt Code:
    1. INCLUDEPATH += $$PWD\include
    2. DEPENDPATH += $$PWD\lib
    To copy to clipboard, switch view to plain text mode 
    then i added libpq.lib into Qt lib`s dir because it couldn`t find it and then i opened a MSVC 2008 Express Command prompt and compiled Qt`s postgresql plugin for a seconds.

  8. #8
    Join Date
    Nov 2009
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: PostgreSQL driver support

    I created the .pri file called psql.pri with the following:

    INCLUDEPATH += $$PWD\include
    DEPENDPATH += $$PWD\lib

    I placed the file into the c:\psql directory. I copied the libpq.lib file to the C:\Qt\2009.04\qt\lib directory. Do I do a configure -plugin-sql-psql or run qmake?

  9. #9
    Join Date
    Feb 2008
    Posts
    50
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PostgreSQL driver support

    Quote Originally Posted by treyhaslem View Post
    I created the .pri file called psql.pri with the following:

    INCLUDEPATH += $$PWD\include
    DEPENDPATH += $$PWD\lib

    I placed the file into the c:\psql directory. I copied the libpq.lib file to the C:\Qt\2009.04\qt\lib directory. Do I do a configure -plugin-sql-psql or run qmake?
    After u made the pri file go to C:\Qt\4.5.3\src\plugins\sqldrivers\psql
    Open psql.pro and add:

    include(C:\psql\psql.pri)

    Then open a command prompt, cd to where psql.pro is, qmake, make/nmake. I don`t remember if u needed to make install, but do it anyway. The libraries will go to Qt`s plugins dir.

  10. #10
    Join Date
    Nov 2009
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: PostgreSQL driver support

    I can make the libraries but Qt still will not list PostgreSQL as an available database.

  11. #11
    Join Date
    Jan 2010
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PostgreSQL driver support

    Quote Originally Posted by treyhaslem View Post
    I can make the libraries but Qt still will not list PostgreSQL as an available database.
    I had this problem before and it was resolved with this three steps
    -In the prompt go to: cd %QTDIR%
    -Then execute the comand: configure -debug-and-release -platform win32-g++ -qt-sql-psql -qt-gif -I C:\PostgreSQL8.1\include -L C:\PostgreSQL8.1\lib
    - Finish with: make (or mingw32-make)

  12. #12
    Join Date
    Feb 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PostgreSQL driver support

    I'm trying to make psql driver available in Qt 4.7 but still no luck.

    I manage to compile the driver and build it, all go well, the driver and the libraries were created, but still isn't in the list of available drivers.

    Then I make a configure -debug-and-release -platform win32-g++ -qt-sql-psql -I C:\PostgreSQL\9.0\include -L C:\PostgreSQL\9.0\lib, and then mingw32-make, using a Qt commanda prompt and all goes well 'till the psql driver compilation, it gave and error.

    I went to the qt\src\plugins\sqldrivers\psql\ and execute mingw32-make Makefile.Debug all (which is exactly where the other make file gave an error) and the make finish ok, the go to qt\ and execute mingw32-make again and this time gave an error on the sqlite driver compìlation; repeat the above steps go to the src\plugins .. and again build ok.

    Execute again mingw32-make in the qt\ directory and gave an error in the bearer\generic plugin, again if I go to the directory and build it, the build goes ok;
    this keep happening to all plugins, i get tired in the imageformats\gif. This are the errors:

    g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
    DQT_DLL -DQT_PLUGIN -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\.
    .\include\QtCore" -I"..\..\..\..\include\QtGui" -I"..\..\..\..\include" -I"c:\Po
    stgreSQL\9.0\include" -I"..\..\..\gui\image" -I"..\..\..\..\include\ActiveQt" -I
    "tmp\moc\debug_shared" -I"..\..\..\..\mkspecs\win32-g++" -o tmp\obj\debug_shared
    \qgifhandler.o ..\..\..\gui\image\qgifhandler.cpp
    g++: CreateProcess: No such file or directory
    mingw32-make[4]: *** [tmp/obj/debug_shared/qgifhandler.o] Error 1
    mingw32-make[4]: Leaving directory `C:/Qt/2010.05/qt/src/plugins/imageformats/gif'
    mingw32-make[3]: *** [debug-all] Error 2
    mingw32-make[3]: Leaving directory `C:/Qt/2010.05/qt/src/plugins/imageformats/gif'
    mingw32-make[2]: *** [sub-gif-make_default] Error 2
    mingw32-make[2]: Leaving directory `C:/Qt/2010.05/qt/src/plugins/imageformats'
    mingw32-make[1]: *** [sub-imageformats-make_default] Error 2
    mingw32-make[1]: Leaving directory `C:/Qt/2010.05/qt/src/plugins'
    mingw32-make: *** [sub-plugins-make_default-ordered] Error 2

    And still the qpsql driver isn't available. Does anybody find a solution for this.

    Thanks.

  13. #13
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: PostgreSQL driver support

    You don't need to build the whole Qt if the only thing you are after is recompilation of one sql plugin. Build the plugin and copy it where it belongs, nothing more.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  14. #14
    Join Date
    Feb 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: PostgreSQL driver support

    Thanks for your reply, it is where it belongs in qt\plugins\sqldrivers\psql; but still don't appear to be available.

    Could it be possible that the plugin do not find the libpq?

  15. #15
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: PostgreSQL driver support

    Yes, it could be possible that it can't find libpq. Use Dependency Walker to see whether its dependencies are met. Also be sure to build the plugin in the right mode (release vs debug).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. PostgreSQL driver and Window 7
    By lasher in forum Installation and Deployment
    Replies: 0
    Last Post: 6th October 2009, 16:51
  2. Qt/X11 source-distro apps corrupting KDE Desktop background
    By wdezell in forum Installation and Deployment
    Replies: 5
    Last Post: 23rd July 2009, 21:10
  3. Qt-4.4.0 installation error in linux
    By babu198649 in forum Installation and Deployment
    Replies: 4
    Last Post: 27th May 2008, 14:35
  4. Access to PostgreSQL DB on a linux server
    By rmagro in forum Qt Programming
    Replies: 28
    Last Post: 13th March 2008, 09:02
  5. QT4 and Postgresql driver
    By alphaqt in forum Installation and Deployment
    Replies: 6
    Last Post: 27th February 2006, 15:50

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.