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
Qt 6.11 is out! See what's new in the release blog

Static build for SQL plugin

Scheduled Pinned Locked Moved General and Desktop
69 Posts 3 Posters 45.9k 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
    #1

    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.

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

      Hi,

      You need to have the dev files from Postgresql installed

      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
        #3

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

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

          IIRC you just have to add the include and lib path when calling configure (-I and -L)

          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
            #5

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

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

              @
              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

              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
                #7

                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 2

                C:\Qt-5.1.0-Static-Win32\qtbase>[/code]

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

                  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.

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

                    Did you use a capital i for the include line ?

                    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
                      #10

                      [quote]
                      Did you use a capital i for the include line ?
                      [/quote]
                      Yes, I used your suggestion literally

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

                        Strange... Try editing the plugin pro file and add the paths there

                        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
                          #12

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

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

                            Can you run the configure script with -v to see if something comes up in there ?

                            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
                              #14

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

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

                                Sure there is. It's --verbose or -v

                                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
                                  #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

                                          • Login

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