Build PostgreSQL driver for Qt 4.7.4 on GNU/Linux



  • Hello,
    I'm trying to build the qsql_psql driver on Fedora 15 by following the documentation. First in the src directory, instead of a .pro file, I find qsql_psql.pri. After qmake, I type make, I have the error
    @qsql_psql.cpp:48:23: fatal error: qsqlerror.h: No such file or directory@
    So I add @QT += sql@ in qsql_psql.pri
    But, now when I try to build it I have this error
    @/usr/lib/gcc/i686-redhat-linux/4.6.0/../../../crt1.o: In function _start': (.text+0x18): undefined reference tomain'@
    It's looking for a main method. Why ? How to build it ?
    Thanks.



  • You should look at QtSDK/QtSources/4.7.3/src/plugins/sqldrivers/psql/psql.pro
    You do not have the file?



  • Yes, there is where I looked, but I didn't find it, instead I found qsql_psql.pri



  • I have qsql_psql.pri here: QtSDK/QtSources/4.7.3/src/sql/drivers/psql/qsql_psql.pri



  • I have it too, but when I try to build the driver, I have the errors described in my first post



  • So you have qsql_psql.pri in both location ?

    1. QtSDK/QtSources/4.7.3/src/plugins/sqldrivers/psql
    2. QtSDK/QtSources/4.7.3/src/sql/drivers/psql

    At location 1 should be psql.pro



  • Ok, sorry, you're right.
    I find psql.pro in QtSDK/QtSources/4.7.3/src/plugins/sqldrivers/psql and build the driver.
    Thanks for your help.



  • I 'm know it's old topic.But I have the same problem. So I will be happy. If you tell me what comand You were writing in Yours terminall qmake ??? and make???.But any path??? Like this :

     _cd $QTDIR/src/plugins/sqldrivers/psql
     qmake -o Makefile "INCLUDEPATH+=/usr/include/pgsql" "LIBS+=-L/usr/lib -lpq" psql.pro
     make_


  • Hi
    @
    cd QtSDK/QtSources/4.7.3/src/plugins/sqldrivers/psql
    qmake "INCLUDEPATH+=/usr/include/pgsql" "LIBS+=-L/usr/lib -lpq" psql.pro
    make
    @

    Hope it helps you



  • Hi,thanks.
    But still not working.

    This is my terminal.

    marcin@marcin-K50IN:~$ cd /home/marcin/Pobrane/qt-everywhere-opensource-src-4.7.3/src/plugins/sqldrivers/psql
    marcin@marcin-K50IN:~/Pobrane/qt-everywhere-opensource-src-4.7.3/src/plugins/sqldrivers/psql$ qmake "INCLUDEPATH+=/usr/include/pgsql" "LIBS+=-L/usr/lib -lpq" psql.pro
    marcin@marcin-K50IN:~/Pobrane/qt-everywhere-opensource-src-4.7.3/src/plugins/sqldrivers/psql$ make g++ -c -pipe -O2 -fvisibility=hidden -fvisibility-inlines-hidden -D_REENTRANT -Wall -W -fPIC -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_DEBUG -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtSql -I/usr/include/qt4 -I/usr/include/pgsql -I. -o main.o main.cpp
    main.cpp:42: fatal error: qsqldriverplugin.h: Nie ma takiego pliku ani katalogu(In eng.The directory dosen't exist)
    compilation terminated.
    make: *** [main.o] Błąd 1
    marcin@marcin-K50IN:~/Pobrane/qt-everywhere-opensource-src-4.7.3/src/plugins/sqldrivers/psql$

    Im using Ubuntu 10.10. And I install Qt by website , not source. I should change path for all header files, no way.?!



  • "I just figured this out with MySQL":http://developer.qt.nokia.com/forums/viewthread/8206 but it's the same process. I also compiled the postgresql driver at the same time with success.

    Good luck.



  • Thanks for all. Special thanks for bobby.Great it's working.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.