Static build for SQL plugin
-
[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:
-
The pro file seems ok
You need to look at the Makefile from the folder of the PostgreSql plugin
-
[quote]You need to look at the Makefile from the folder of the PostgreSql plugin[/quote]
I couldn’t find Makefile in Postgresql plugin!c:/Qt/Qt5.1.0-static/qtbase/src/plugins/sqldrivers/psql content
@main.cpp
psql.json
psql.pro
psql.pro.user
README@ -
The Makefile should have been generated in a subfolder in the build directory
-
[quote]
The Makefile should have been generated in a subfolder in the build directory
[/quote]
Where can I find build directory? -
BTW, May I suggest to test your suggestions or at least read about them before posting from your memory.
It seems you're mixing between Windows & Linux configurations. -
I found this link which it talks about static building but unfortunately it done with Qt4 which isn't work perfectly with Qt5.
The issue still on how to add Postgresql paths to configure.bat to be able to add them during make process mingw32-make
-
Sorry I forgot to add the link:
http://www.qtcentre.org/threads/5781-Want-a-static-database-plugin-tried-a-lot-but-have-still-DLL-dependecies -
SGaist, thanks a lot for your effort in helping me :)
Voila, I successfully built Qt statically with Postgresql plugin option as following (it was stupid Windows issue so after formatting Windows the problem solved):
[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/[/code]But Qt it self coudln't link pg libratry for usual Qt projects. In the following .pro of test project uses QPSQL:
[code]QT += core sql
QT -= gui
TARGET = TestSSLConnection
CONFIG += console
CONFIG -= app_bundleTEMPLATE = app
SOURCES += main.cpp
win32 {
LIBS += -LC:/PostgreSQL/9.1/lib -lpg
PRE_TARGETDEPS += C:/PostgreSQL/9.1/lib/pq.lib
QMAKE_LFLAGS += -static -static-libgcc -static-libstdc++ -lpthread
}[/code]It generates the following error on building process:
[code]mingw32-make[1]: Leaving directory 'F:/build-TestSSLConnection-Satic_postgresql-Release'
mingw32-make[1]: *** No rule to make target 'C:/PostgreSQL/9.1/lib/pq.lib', needed by 'release\TestSSLConnection.exe'. Stop.
makefile:34: recipe for target 'release' failed
mingw32-make: *** [release] Error 2
16:08:31: The process "C:\Qt\Qt5.1.1\Tools\mingw48_32\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project TestSSLConnection (kit: Satic-postgresql)
When executing step 'Make'
16:08:31: Elapsed time: 00:14.[/code]How can I fix this issue?
-
BTW, Do I've to use libpq.lib OR pq.lib in:
[code]PRE_TARGETDEPS += C:/PostgreSQL/9.1/lib/pq.lib[/code]OR
[code]PRE_TARGETDEPS += C:/PostgreSQL/9.1/lib/libpq.lib[/code]
-
You should not need the PRE_TARGETDEPS in this case (unless you are working on the postgresql library and generating the static library yourself)
-
[quote]You should not need the PRE_TARGETDEPS in this case[/quote]
I commented this related line(s) but I still get an error!
[code]QT += core sqlQT -= gui
TARGET = TestSSLConnection
CONFIG += console
CONFIG -= app_bundleTEMPLATE = app
SOURCES += main.cpp
win32 {
LIBS += -LC:/PostgreSQL/9.1/lib -lpgPRE_TARGETDEPS += C:/PostgreSQL/9.1/lib/pq.lib
QMAKE_LFLAGS += -static -static-libgcc -static-libstdc++ -lpthread
}[/code]
[code]g++ -static -static-libgcc -static-libstdc++ -lpthread -Wl,-s -Wl,-subsystem,console -mthreads -o release\TestSSLConnection.exe release/main.o -LC:/PostgreSQL/9.1/lib -lpg -LC:/Qt/Qt5.1.1-static-sqlite-pgsql/qtbase/lib -lQt5Sql -lpq -lQt5Core -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32
c:/qt/qt5.1.1/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lpg
Makefile.Release:77: recipe for target 'release\TestSSLConnection.exe' failed
mingw32-make[1]: Leaving directory 'F:/Snippets/build-TestSSLConnection-Static_pg2-Release'
makefile:34: recipe for target 'release' failed
c:/qt/qt5.1.1/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lpq
collect2.exe: error: ld returned 1 exit status
mingw32-make[1]: *** [release\TestSSLConnection.exe] Error 1
mingw32-make: *** [release] Error 2
12:27:50: The process "C:\Qt\Qt5.1.1\Tools\mingw48_32\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project TestSSLConnection (kit: Static-pg2)
When executing step 'Make'
12:27:50: Elapsed time: 00:24.[/code] -
Are you sure that your Postgresql install is a mingw build ?
-
[quote]
Are you sure that your Postgresql install is a mingw build ?
[/quote]
I'm not sure what if Postgresql built by MinGW but I'm using the official installer of Postgresql (postgresql-9.1.3-1-windows.exe)