Results 1 to 15 of 15

Thread: PostgreSQL driver support

Hybrid View

Previous Post Previous Post   Next Post Next Post
  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)

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.