Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Static build PostgreSQL in app
QtWS25 Last Chance

Static build PostgreSQL in app

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
postgresql
4 Posts 2 Posters 1.9k Views
  • 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.
  • A Offline
    A Offline
    Artmetic
    wrote on 11 Mar 2017, 12:53 last edited by A Former User 3 Nov 2017, 16:02
    #1

    I have problem to static link my postgress plugin to app. The output compilation fault is that:

    undefined reference to `qt_static_plugin_qsqlpsql()'
    ./release\managament_plugin_import.o:managament_plugin_import.cpp:(.text.startup+0x26): undefined reference to `qt_static_plugin_QPSQLDriverPlugin()'
    

    This is my pro file:

    QT += core gui sql
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    #CONFIG += plugin static
    
    CONFIG += c++11 static
    QTPLUGIN += qsqlpsql
    
    #include(psql/qsql_psql.pri)
    #PLUGIN_TYPE = sqldrivers
    #load(qt_plugin)
    DEFINES += HAVE_STRUCT_TIMESPEC
    #INCLUDEPATH += C:\PostgreSQL\9.2\include
    #DEFINES += STATIC QT_STATIC
    #DEFINES += QT_STATICPLUGIN
    #PRE_TARGETDEPS += C:\Qt\5.5\Src\qtbase\plugins\sqldrivers\libpq.dll
    #LIBS += -L$$PWD\sqldrivers\qsqlpsql.dll
    #LIBS += -LC:\Qt\5.5\Src\qtbase\plugins\sqldrivers\libqsqlpsql.a
    #PRE_TARGETDEPS += C:\Qt\5.5\Src\qtbase\plugins\sqldrivers\libpq.dll
    #QMAKE_LFLAGS += -static -static-libgcc -static-libstdc++ -lpthread
    

    as you see I try many ways to do this. I don know what is wrong because I added to my main.cpp:

    #include <QSqlDriverPlugin>
    #include <QtCore/QtPlugin> 
    
    Q_IMPORT_PLUGIN(qsqlpsql)
    

    I don't know should I add -qt-sql-<driver> and how. because If I add to makefile.release nothing change?
    Please help, I try do this cople days and nothing change.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 11 Mar 2017, 23:16 last edited by
      #2

      Hi,

      Did you compile Qt statically ?

      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
      • A Offline
        A Offline
        Artmetic
        wrote on 13 Mar 2017, 14:44 last edited by
        #3

        Yes I compile qt staticly.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 13 Mar 2017, 21:29 last edited by
          #4

          Did you build the PostgreSQL plugin as part of your build ?
          If not then follow the documentation about QtSQL plugin build.

          Otherwise, rebuild Qt and include the driver directly but you'll have to do it from a clean 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

          3/4

          13 Mar 2017, 14:44

          • Login

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