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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #54

    Did you also add
    @QTPLUGIN += qsqlmysql@
    to your pro file ?
    and
    @Q_IMPORT_PLUGIN( qsqlmysql )@
    to your main.cpp ?

    EDIT: corrected macro

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

      After adding the lines you've mentioned I got this error:
      [code]..\test\main.cpp:5:17: error: expected constructor, destructor, or type conversion before '(' token
      QT_IMPORT_PLUGIN( qsqlpsql )[/code]

      BTW, I never find any *.dll or *.a inside Qt folder where I built it statically!!! so I wonder how these line will link qsqlpsql?

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

        Did you build Qt with qt-sql-psql ? (Not -plugin-sql-psql)

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

          [quote author="SGaist" date="1380279497"]Did you build Qt with qt-sql-psql ? (Not -plugin-sql-psql)[/quote]

          Yes; I built using:
          [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.9/src/include -L C:/postgresql-9.1.9/src/interfaces/libpq -I C:/postgresql-9.1.9/src/interfaces/libpq[/code]

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

            Sorry, I made a typo for the import macro... I've corrected the post

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

              [quote author="SGaist" date="1380405617"]Sorry, I made a typo for the import macro... I've corrected the post[/quote]

              Thanks for correction. Now Qt gave me a new error message about missing qsqlpsql as following:
              [code]c:/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lqsqlpsql
              collect2.exe: error: ld returned 1 exit status
              Makefile.Release:82: recipe for target 'release\test.exe' failed
              mingw32-make[1]: *** [release\test.exe] Error 1
              mingw32-make[1]: Leaving directory 'C:/Users/mbnoimi/Desktop/build-test-Static_PG-Release'
              makefile:34: recipe for target 'release' failed
              mingw32-make: *** [release] Error 2
              17:07:16: The process "C:\mingw48_32\bin\mingw32-make.exe" exited with code 2.
              Error while building/deploying project test (kit: Static PG)
              When executing step 'Make'
              17:07:16: Elapsed time: 00:13.[/code]

              For fixing this issue I tried to find the missing library but unfortunately I couldn't find it!

              NOTE: Qt built successfully and it didn't show any error message (by using "the above options":https://qt-project.org/forums/viewreply/144398/)

              [code]
              C:\Qt>dir *.a /s /p /w /b
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\lib\libQt5Bootstrap.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\lib\libQt5Concurrent.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\lib\libQt5Core.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\lib\libQt5Gui.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\lib\libQt5Network.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\lib\libQt5OpenGL.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\lib\libQt5OpenGLExtensions.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\lib\libQt5PlatformSupport.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\lib\libQt5PrintSupport.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\lib\libQt5Sql.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\lib\libQt5Test.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\lib\libQt5Widgets.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\lib\libQt5Xml.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\lib\libqtmain.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\plugins\accessible\libqtaccessiblewidgets.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\plugins\bearer\libqgenericbearer.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\plugins\bearer\libqnativewifibearer.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\plugins\imageformats\libqico.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\plugins\platforms\libqminimal.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\plugins\platforms\libqoffscreen.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\plugins\platforms\libqwindows.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\plugins\printsupport\libwindowsprintersupport.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\tests\auto\corelib\io\qdir\types\a.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\tests\auto\corelib\io\qdir\types\b.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\tests\auto\corelib\io\qdir\types\c.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\tests\auto\corelib\io\qdir\types\d.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\tests\auto\corelib\io\qdir\types\e.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtbase\tests\auto\corelib\io\qdir\types\f.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtwebkit\WebKitLibraries\libWebCoreSQLite3.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtwebkit\WebKitLibraries\libWebKitSystemInterfaceLion.a
              C:\Qt\Qt5.1.1-static-sqlite-pgsql\qtwebkit\WebKitLibraries\libWebKitSystemInterfaceMountainLion.a
              C:\Qt>
              [/code]

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

                You won't have any plugin lib since they are built in Qt's sql library, did you add qsqlpsql in your pro file ?

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

                  [quote author="SGaist" date="1380487767"]You won't have any plugin lib since they are built in Qt's sql library, did you add qsqlpsql in your pro file ?[/quote]

                  test.pro
                  [code]QT += core gui sql

                  greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                  TARGET = test
                  TEMPLATE = app

                  SOURCES += main.cpp
                  mainwindow.cpp

                  HEADERS += mainwindow.h

                  FORMS += mainwindow.ui

                  QTPLUGIN += qsqlpsql

                  QMAKE_LFLAGS += -static -static-libgcc -static-libstdc++ -lpthread

                  LIBS += -LC:/postgresql-9.1.9/src/interfaces/libpq -lpq
                  [/code]

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

                    main.cpp
                    [code]#include "mainwindow.h"
                    #include <QApplication>
                    #include <QtPlugin>

                    Q_IMPORT_PLUGIN( qsqlpsql )

                    int main(int argc, char *argv[])
                    {

                    QApplication a(argc, argv);
                    MainWindow w;
                    w.show();
                    
                    return a.exec&#40;&#41;;
                    

                    }
                    [/code]

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

                      Just thought that since you have all sql plugins built in you might not need the QTPLUGIN line from the pro file

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

                        [quote author="SGaist" date="1380528900"]Just thought that since you have all sql plugins built in you might not need the QTPLUGIN line from the pro file[/quote]

                        Unfortunately it didn't fix the issue and generated ton of errors as shown in full log of build process: http://paste.kde.org/p96ac01e7

                        I'm really frustrated; The hardest step done (building Postgresql with MinGW) while the supposed easy one delays the success!!!

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

                          Looks like it needs postgresql symbol, you have to add the link information to postgresql

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

                            [quote author="SGaist" date="1380785713"]Looks like it needs postgresql symbol, you have to add the link information to postgresql[/quote]

                            How can I do it?

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

                              Add the same -l and -L to LIBS that you used to build Qt with postgresql

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

                                [quote author="SGaist" date="1380805190"]Add the same -l and -L to LIBS that you used to build Qt with postgresql[/quote]

                                I already added them as mentioned in "a reply before":https://qt-project.org/forums/viewreply/144622/.

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

                                  Is there any new idea guys? The recent result I got was:
                                  https://qt-project.org/forums/viewreply/144622/
                                  https://qt-project.org/forums/viewreply/144623/

                                  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