Static build for SQL plugin
-
[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) -
Guys this thread took a long discussion. Does any one built Qt statically with one of SQL plugins (except sqlite)?
-
[quote author="mbnoimi" date="1379676626"]Guys this thread took a long discussion. Does any one built Qt statically with one of SQL plugins (except sqlite)?[/quote]
When your postgresql plugin isn't built with the same compiler it maybe that i can't load the symbols from the DLL.
Thus to make sure you can try to build it yourself and retry it then.
Read "this":https://wiki.postgresql.org/wiki/Building_With_MinGW and "this":http://qt-project.org/forums/viewthread/16639. -
Also, don't forget the licensing issues with static linking to Qt "explanation here":http://www.slideshare.net/qtbynokia/qt-licensing-explained
-
[quote author="raven-worx" date="1379677488"]Thus to make sure you can try to build it yourself and retry it then.
Read "this":https://wiki.postgresql.org/wiki/Building_With_MinGW and "this":http://qt-project.org/forums/viewthread/16639.[/quote]
I followed up the pointed wiki page by downloading Postgresql from "this link":http://ftp.postgresql.org/pub/source/v9.1.9/postgresql-9.1.9.tar.bz2 then used the following options:
[code]$ ./configure --without-zlib --with-openssl --with-includes=C:/OpenSSL-Win32/include --with-libraries=C:/OpenSSL-Win32/lib
/MinGW [/code]but I got error during configure process:
[code]checking openssl/ssl.h usability... no
checking openssl/ssl.h presence... no
checking for openssl/ssl.h... no
configure: error: header file <openssl/ssl.h> is required for OpenSSL [/code]Do you've an idea how to fix this issue?
P.S. "Some guy faced it before":http://web.archiveorange.com/archive/v/V95x82sNS8lCeW2yiGEY but he couldn't find any response :(
-
Are you sure the --with-includes and --with-libraries options are valid ? AFAIK it should be -I and -L when calling configure
-
[quote author="SGaist" date="1379794681"]Are you sure the --with-includes and --with-libraries options are valid ? AFAIK it should be -I and -L when calling configure[/quote]
AFAIK these two options used in Postgresql configure file while -l -L used for Qt.
Any way, I'll try to use -l & -L to se if they will affect or not.