Rebuild of QtSql*
-
Hi all,
I had assumed that this question had been asked many times before but searching finds nothing, either that or my search criterion is wrong, so my apologies in advance if this is the case.
I want to add PostgreSQL support to my QtSql* libraries but don't want (nor need) to rebuild all of the others is there a way this library can be rebuilt in a stand-alone manner?
--
William -
You can build only the Postgres driver by opening a command prompt and going to
yourQtVersion/plugins/sqldrivers/psql
and typing
qmake
nmake (if using visual studio) -
Sorry Sigrid I don't have a psql directory in /Qt/4.7.2/plugins/sqldrivers/ or any other for that matter all I have is qsqlite* files. Or am I missing something?
My present QtSql is built using x64 Intel compiler with qsqlite and odbc support I simply want to add psql to this as well.
--
William -
Sorry, the path should be
yourQtVersion/SRC/plugins/sqldrivers/psql
-
Thanks Sigrid. I have that path, but of course it still does not answer my original question as this will build a plugin and I don't use plugins, hence my need to rebuild the QtSql library.
--
William -
QtSql uses plugins by default. Did you change this?
-
Yes I did. I used -qt-sql-odbc -qt-sql-sqlite in my config.cache file.
-
So you will have to reconfigure Qt and add -qt-sql-psql to the configure line and recompile Qt.
-
Yes, I am aware of this, but that will rebuild everything won't it? I don't really want (or think I need) to do this. I was simply wanting to rebuild the QtSql library with psql support. Are you telling me there is no way to rebuild a single library and I have to rebuild all?
-
I'm not sure if it rebuilds everything, you'll have to try, sorry :-/
-
I will, and thank you both for your time. And for those interested I'll post the outcome over the weekend.
-
You can also try the following, hopefully that allows you to only rebuild the QtSql library with psql support:
Go to the src\sql directory and type:
@qmake "sql-drivers += psql"
nmake@Does that work?
-
Hi Sigrid,
I tried your suggestion and it looked promising but compilation stopped saying it cannot find "pg_config.h" and on searching the hard disk the only files I have are:
"pg_config.h.in" and "pg_config.h.win32" in the postgresql-9.0.4/src/include directories.
So I now have a ! above my head.
Of course it may help if I actually build the client first.
-
Well I am still no further forward with this, as I can't build the PostgreSQL client / library using my compiler (Intel) nor with Visual Studio 2010 as there is no support, so I guess this one goes on the back burner for now.
-
The error you are receiving:
@cannot find “pg_config.h@
seems to indicate that you don't have the prebuilt version of psql installed. Is that the case? If so, you could try replacing the package with the prebuilt version of psql to see if that helps.
-
It's not enough to install PostgreSQL and then call the nmake. You have to tell the compiler where PostGreSQL has its header and libs.
Install http://www.postgresql.org/download/windows "One click installer" to any 64 Bit Windows machine, it includes libs and headers. Extract the lib and include folders to your dev machine. Then run configure again and add -qt-sql-psql and the include/lib pathes.
Configure created the missing qmake files, there is no need to run all again, go to /%qtdir%/src/plugins/sqldrivers/psql and run "nmake", now your 64 Bit Plugins should be created...And it works with VS 2010 ! You only have to set the correct mkdefs....
Regards,
Peter -
Hi,
Well I downloaded the installer as suggested by peter999 and I used the
@
qmake "sql-drivers += psql"
nmake
@ as suggested by Sigrid and all went well I got a new QtSql4 .dll and .lib files however when I rebuilt an existing application that uses this library it crashed at startup! I've since done the reverse of Sigrid's suggestion and again rebuilt the application, this time it ran as expected.I don't want to waste anyones time with this it can wait until I upgrade to a new SDK.