View Full Version : QT4 and Postgresql driver

26th February 2006, 17:17
Hi guys,

i'have tried to compile QT with option -qt-sql-psql or -plugin-sql-psql but each time it fails!
I am using QT 4.1.0 on a win XP box, Postgresql 8.0.6, and MinGW as a compiler.

first i run :
configure -I C:\psql\8.0\include -qt-sql-psql

and it works fine! (at least without any error)

and then i run :
mingw32-make (to start compiling QT)

after several minutes it shows this error :
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\ mingw32\bin\ld.exe: cannot find -lpq
collect2: ld returned 1 exit status
mingw32-make[3]: *** [..\..\lib\QtSqld4.dll] Error 1

can anyone help me?

26th February 2006, 17:21
Try: configure -I C:\psql\8.0\include -L C:\psql\8.0\lib -qt-sql-psql

27th February 2006, 12:58
thanks a lot, it worked fine (compiling and acces to database either localhost and remotehost).

I have one (or two) more questions:

Q1 : My application must be installed in another box (win XP), how can put the plugin with, in order to access to the database from that box?

Q2 : I have tried to compile Qt with -plugin-sql-psql option, it worked fine and it generated 2 DLLs qsqlpsql.dll and qsqlpsqld.dll, i put them in my application rootdir, but no success, the message displayed in QSqlError.text() is "Driver not loaded Driver not loaded" :confused:
How can i use the plugin to access to Postgresql?

thanks a lot

sorry if my questions aren't interesting

27th February 2006, 14:03
Look here
same problem (http://www.qtcentre.org/forum/showthread.php?t=730&highlight=loaded)

27th February 2006, 15:21
thank u zlatko, i have already read this thread.
let me explain what problem i currently have :

first i ran :
configure -I c:\psql\8.0\include -L c:\psql\8.0\lib -qt-sql-psql (thanks to Jacek)
then minwg32-make
this worked fine and i can connect to database without any problem

second in another box(same configuration) i ran :
configure -I c:\psql\8.0\include -L c:\psql\8.0\lib -plugin-sql-psql
then minwg32-make.
no error after compiling, but when i launch the application QSqlError.text() has : "Driver not loaded Driver not loaded"

in the thread u quoted, raphael could make his application run with the plugin.

i hope this explaination is clear to you.

27th February 2006, 15:32
If you create folder sqldrivers and put it driver dll he must be loaded, else i dont know how i can help you....becose this thread repeated in forum more times

27th February 2006, 15:50
no error after compiling, but when i launch the application QSqlError.text() has : "Driver not loaded Driver not loaded"
Where did that plugin land? In %QTDIR%/plugins/sqldrivers? Where are PostgreSQL DLLs*? Did you try to copy them to the same directory where the executable is?

* AFAIR you need at least libpq.dll, iconv.dll, ssleay.dll and crypto.dll (names could be slightly different, as I don't remeber them well). Use try the Dependency Walker (http://www.dependencywalker.com) it will show you if your program can't find some libraries.