Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Static build for SQL plugin
Forum Updated to NodeBB v4.3 + New Features

Static build for SQL plugin

Scheduled Pinned Locked Moved General and Desktop
69 Posts 3 Posters 41.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mbnoimi
    wrote on last edited by
    #16

    [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]

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #17

      --verbose with two -

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mbnoimi
        wrote on last edited by
        #18

        [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]
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #19

          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

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mbnoimi
            wrote on last edited by
            #20

            [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
            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #21

              The pro file seems ok

              You need to look at the Makefile from the folder of the PostgreSql plugin

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • M Offline
                M Offline
                mbnoimi
                wrote on last edited by
                #22

                [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@

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #23

                  The Makefile should have been generated in a subfolder in the build directory

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mbnoimi
                    wrote on last edited by
                    #24

                    [quote]
                    The Makefile should have been generated in a subfolder in the build directory
                    [/quote]
                    Where can I find build directory?

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mbnoimi
                      wrote on last edited by
                      #25

                      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.

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        mbnoimi
                        wrote on last edited by
                        #26

                        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

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          mbnoimi
                          wrote on last edited by
                          #27

                          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

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            mbnoimi
                            wrote on last edited by
                            #28

                            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_bundle

                            TEMPLATE = 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?

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              mbnoimi
                              wrote on last edited by
                              #29

                              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]

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #30

                                You should not need the PRE_TARGETDEPS in this case (unless you are working on the postgresql library and generating the static library yourself)

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                0
                                • M Offline
                                  M Offline
                                  mbnoimi
                                  wrote on last edited by
                                  #31

                                  [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 sql

                                  QT -= gui

                                  TARGET = TestSSLConnection
                                  CONFIG += console
                                  CONFIG -= app_bundle

                                  TEMPLATE = 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]

                                  [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]

                                  1 Reply Last reply
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #32

                                    Are you sure that your Postgresql install is a mingw build ?

                                    Interested in AI ? www.idiap.ch
                                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                    1 Reply Last reply
                                    0
                                    • M Offline
                                      M Offline
                                      mbnoimi
                                      wrote on last edited by
                                      #33

                                      [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)

                                      1 Reply Last reply
                                      0
                                      • M Offline
                                        M Offline
                                        mbnoimi
                                        wrote on last edited by
                                        #34

                                        Guys this thread took a long discussion. Does any one built Qt statically with one of SQL plugins (except sqlite)?

                                        1 Reply Last reply
                                        0
                                        • raven-worxR Offline
                                          raven-worxR Offline
                                          raven-worx
                                          Moderators
                                          wrote on last edited by
                                          #35

                                          [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.

                                          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                                          If you have a question please use the forum so others can benefit from the solution in the future

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved