Static build for SQL plugin
-
Howdy,
How can I build Qt statically under Windows with -qt-sql-psql parameter (I always get error because of missing Postgresql paths)?
P.S. I successfully built static edition of Qt with -qt-sql-psql parameter under Ubuntu.
-
Hi,
You need to have the dev files from Postgresql installed
-
[quote]You need to have the dev files from Postgresql installed[/quote]
As I mentioned before I already installed Postgresql so all dev files already exist but Qt can't find the right paths for that files.Note:
"Qt documentation describes":https://qt-project.org/doc/qt-5.1/qtsql/sql-driver.html#qpsql that I've to point to Postgresql dev files during Plugin build but it doesn't mention anything about how to point those paths for static build. -
IIRC you just have to add the include and lib path when calling configure (-I and -L)
-
[quote]IIRC you just have to add the include and lib path when calling configure (-I and -L)[/quote]
May you please give me an example?I use the following:
[code]configure -no-warnings-are-errors -qt-pcre -qt-libpng -ltcg -release -developer-build -static -qt-sql-sqlite -qt-sql-psql -qt-zlib -qt-libjpeg -opengl desktop -nomake examples -nomake tests[/code]Postgresql paths:
[code]C:/PostgreSQL/9.1/include
C:/PostgreSQL/9.1/lib/libpq.lib[/code] -
@
configure -no-warnings-are-errors -qt-pcre -qt-libpng -ltcg -release -developer-build -static -qt-sql-sqlite -qt-sql-psql -qt-zlib -qt-libjpeg -opengl desktop -nomake examples -nomake tests -I C:/PostgreSQL/9.1/include -L C:/PostgreSQL/9.1/lib/
@
And you should be good to go -
It still gives same error message! nothing changed!
[code]release_static" -I"." -I"C:\Qt-5.1.0-Static-Win32\qtbase\mkspecs\win32-g++" -o .
obj\release_static\qsql_psql.o drivers\psql\qsql_psql.cpp
drivers\psql\qsql_psql.cpp:59:22: fatal error: libpq-fe.h: No such file or direc
tory
#include <libpq-fe.h>
^
compilation terminated.
Makefile.Release:3319: recipe for target '.obj/release_static/qsql_psql.o' faile
d
mingw32-make[3]: *** [.obj/release_static/qsql_psql.o] Error 1
mingw32-make[3]: Leaving directory 'C:/Qt-5.1.0-Static-Win32/qtbase/src/sql'
Makefile:34: recipe for target 'release' failed
mingw32-make[2]: *** [release] Error 2
mingw32-make[2]: Leaving directory 'C:/Qt-5.1.0-Static-Win32/qtbase/src/sql'
Makefile:207: recipe for target 'sub-sql-make_first' failed
mingw32-make[1]: *** [sub-sql-make_first] Error 2
mingw32-make[1]: Leaving directory 'C:/Qt-5.1.0-Static-Win32/qtbase/src'
makefile:40: recipe for target 'sub-src-make_first' failed
mingw32-make: *** [sub-src-make_first] Error 2C:\Qt-5.1.0-Static-Win32\qtbase>[/code]
-
BTW, I looked for libpq-fe.h manually and I found it in C:/PostgreSQL/9.1/include; So I doubt that -I C:/PostgreSQL/9.1/include -L C:/PostgreSQL/9.1/lib/ are incorrect parameters.
-
Did you use a capital i for the include line ?
-
[quote]
Did you use a capital i for the include line ?
[/quote]
Yes, I used your suggestion literally -
Strange... Try editing the plugin pro file and add the paths there
-
[quote]
Strange… Try editing the plugin pro file and add the paths there
[/quote]I got same exact result although I start a complete new build!
C:/Qt/Qt5.1.0-static/qtbase/src/plugins/sqldrivers/psql/psql.pro content
[code]TARGET = qsqlpsql
SOURCES = main.cpp
OTHER_FILES += psql.json
include(../../../sql/drivers/psql/qsql_psql.pri)PLUGIN_CLASS_NAME = QPSQLDriverPlugin
include(../qsqldriverbase.pri)LIBS += -LC:/PostgreSQL/9.1/lib -lpq
INCLUDEPATH += C:/PostgreSQL/9.1/include
[/code] -
Can you run the configure script with -v to see if something comes up in there ?
-
[quote]
Can you run the configure script with -v to see if something comes up in there ?
[/quote]
There is no such option in configure script! -
Sure there is. It's --verbose or -v
-
[quote]
Sure there is. It’s —verbose or -v
[/quote]
This is incorrect, down below you can see the output of configure script![code]C:\Qt\Qt5.1.0-static\qtbase>configure -no-warnings-are-errors -qt-pcre -qt-libpn
g -ltcg -release -developer-build -static -qt-sql-sqlite -qt-sql-psql -qt-zlib -
qt-libjpeg -opengl desktop -nomake examples -nomake tests -verbose
Unknown option ?verbose
Usage: configure [options]Installation options:
These are optional, but you may specify install directories.[/code]
-
--verbose with two -
-
[quote]—verbose with two –
[/quote]
Still incorrect![code]C:\Qt\Qt5.1.0-static\qtbase>configure -no-warnings-are-errors -qt-pcre -qt-libpn
g -ltcg -release -developer-build -static -qt-sql-sqlite -qt-sql-psql -qt-zlib -
qt-libjpeg -opengl desktop -nomake examples -nomake tests --verbose
Unknown option -?verbose
Usage: configure [options]Installation options:
These are optional, but you may specify install directories.
-prefix <dir> ...... This will install everything relative to <dir>[/code]
-
Then it's not the configure script... It's the configure.exe you are using. Which indeed does not have a verbose output...
Then check the Makefile generated for the PostgreSql plugin to see if it contains the paths you've added
-
[quote]Then it’s not the configure script… It’s the configure.exe you are using. Which indeed does not have a verbose output…[/quote]
No, it's the script. Any way to be sure that I called the right script I added .bat (as you can see below); I still get same error![code]C:\Qt\Qt5.1.0-static\qtbase>configure.bat -no-warnings-are-errors -qt-pcre -qt-l
ibpng -ltcg -release -developer-build -static -qt-sql-sqlite -qt-sql-psql -qt-zl
ib -qt-libjpeg -opengl desktop -nomake examples -nomake tests --verbose
Unknown option -?verbose
Usage: configure [options]Installation options:
These are optional, but you may specify install directories.
-prefix <dir> ...... This will install everything relative to <dir>[/code]
[quote]Then check the Makefile generated for the PostgreSql plugin to see if it contains the paths you’ve added[/quote]
I looked into MakeFile where configure.bat exists but I couldn’t find any mentioning to "postgresql" or "psql"P.S.
- May you please take a look to the generated MakeFile and the modified Postgresql .pro file from:
http://mbnoimi.me/tmp/Makefile
http://mbnoimi.me/tmp/psql.pro
I created MakeFile by using:
[code]C:\Qt\Qt5.1.0-static\qtbase>configure.bat -no-warnings-are-errors -qt-pcre -qt-libpng -ltcg -release -developer-build -static -qt-sql-sqlite -qt-sql-psql -qt-zlib -qt-libjpeg -opengl desktop -nomake examples -nomake tests[/code] - Because --verbose option not recognized by configure.bat
- May you please take a look to the generated MakeFile and the modified Postgresql .pro file from: