Results 1 to 6 of 6

Thread: Cannot build PostgreSQL driver

  1. #1
    Join Date
    Jun 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Cannot build PostgreSQL driver

    Hi Everybody,

    I am trying to build the QPSQL driver plugin on Windows using MinGW.
    I have followed the instruction at this link:
    http://www.qtcentre.org/wiki/index.p...ws_using_MinGW
    but unfortunately with no success.

    I have generated libpq.a file using reimp and dlltool
    and I have run the following qmake command:
    Qt Code:
    1. qmake -o Makefile "INCLUDEPATH+=C:\Programmi\PostgreSQL\8.4\include" "LIBS+=C:\Programmi\PostgreSQL\8.4\lib\libpq.a" psql.pro
    To copy to clipboard, switch view to plain text mode 
    When I run mingw32-make I get the following output:

    Qt Code:
    1. C:\Qt\2010.04\qt\src\plugins\sqldrivers\psql>mingw32-make
    2. mingw32-make -f Makefile.Debug all
    3. mingw32-make[1]: Entering directory `C:/Qt/2010.04/qt/src/plugins/sqldrivers/psq
    4. l'
    5. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
    6. DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -
    7. DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\i
    8. nclude\QtSql" -I"..\..\..\..\include" -I"c:\Programmi\PostgreSQL\8.4\include" -I
    9. "..\..\..\..\include\ActiveQt" -I"tmp\moc\debug_shared" -I"..\..\..\..\mkspecs\w
    10. in32-g++" -o tmp\obj\debug_shared\main.o main.cpp
    11. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
    12. DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -
    13. DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\i
    14. nclude\QtSql" -I"..\..\..\..\include" -I"c:\Programmi\PostgreSQL\8.4\include" -I
    15. "..\..\..\..\include\ActiveQt" -I"tmp\moc\debug_shared" -I"..\..\..\..\mkspecs\w
    16. in32-g++" -o tmp\obj\debug_shared\qsql_psql.o ..\..\..\sql\drivers\psql\qsql_psq
    17. l.cpp
    18. C:\Qt\2010.04\qt\bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_CAST_TO_AS
    19. CII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -DQT
    20. _THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\include\QtSql" -I"
    21. ..\..\..\..\include" -I"c:\Programmi\PostgreSQL\8.4\include" -I"..\..\..\..\incl
    22. ude\ActiveQt" -I"tmp\moc\debug_shared" -I"..\..\..\..\mkspecs\win32-g++" -D__GNU
    23. C__ -DWIN32 ..\..\..\sql\drivers\psql\qsql_psql.h -o tmp\moc\debug_shared\moc_qs
    24. ql_psql.cpp
    25. g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -
    26. DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_DLL -DQT_PLUGIN -DQT_SQL_LIB -
    27. DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"..\..\..\..\include\QtCore" -I"..\..\..\..\i
    28. nclude\QtSql" -I"..\..\..\..\include" -I"c:\Programmi\PostgreSQL\8.4\include" -I
    29. "..\..\..\..\include\ActiveQt" -I"tmp\moc\debug_shared" -I"..\..\..\..\mkspecs\w
    30. in32-g++" -o tmp\obj\debug_shared\moc_qsql_psql.o tmp\moc\debug_shared\moc_qsql_
    31. psql.cpp
    32. windres -i qsqlpsqld_resource.rc -o tmp\obj\debug_shared\qsqlpsqld_resource_res.
    33. o --include-dir=.
    34. g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel
    35. oc -mthreads -Wl -shared -Wl,--out-implib,c:\Qt\2010.04\qt\plugins\sqldrivers\li
    36. bqsqlpsqld4.a -o ..\..\..\..\plugins\sqldrivers\qsqlpsqld4.dll tmp/obj/debug_sha
    37. red/main.o tmp/obj/debug_shared/qsql_psql.o tmp/obj/debug_shared/moc_qsql_psql.o
    38. -L"c:\Qt\2010.04\qt\lib" -L"c:\Programmi\SQLXML 4.0\bin\" -L"c:\Qt\2010.04\qt\
    39. lib" tmp\obj\debug_shared\qsqlpsqld_resource_res.o C:\Programmi\PostgreSQL\8.4\l
    40. ib\libpq.a -lQtSqld4 -lQtCored4
    41. Creating library file: c:\Qt\2010.04\qt\plugins\sqldrivers\libqsqlpsqld4.a
    42. tmp/obj/debug_shared/main.o: In function `QPSQLDriverPlugin':
    43. C:\Qt\2010.04\qt\src\plugins\sqldrivers\psql/main.cpp:58: undefined reference to
    44. `_imp___ZN16QSqlDriverPluginC2EP7QObject'
    45. C:\Qt\2010.04\qt\src\plugins\sqldrivers\psql/main.cpp:58: undefined reference to
    46. `_imp___ZN16QSqlDriverPluginC2EP7QObject'
    47. tmp/obj/debug_shared/main.o:C:\Qt\2010.04\qt\src\plugins\sqldrivers\psql/main.cp
    48. p:64: undefined reference to `_imp___ZNK7QStringeqERK13QLatin1String'
    49. tmp/obj/debug_shared/main.o:C:\Qt\2010.04\qt\src\plugins\sqldrivers\psql/main.cp
    50. p:64: undefined reference to `_imp___ZNK7QStringeqERK13QLatin1String'
    51. tmp/obj/debug_shared/main.o: In function `QString':
    52. C:\Qt\2010.04\qt\src\plugins\sqldrivers\psql/../../../../include/QtCore/../../sr
    53. c/corelib/tools/qstring.h:683: undefined reference to `_imp___ZN7QString17fromLa
    54. tin1_helperEPKci'
    55. C:\Qt\2010.04\qt\src\plugins\sqldrivers\psql/../../../../include/QtCore/../../sr
    56. c/corelib/tools/qstring.h:715: undefined reference to `_imp___Z9qt_assertPKcS0_i
    57. '
    58. tmp/obj/debug_shared/main.o: In function `~QString':
    59. C:\Qt\2010.04\qt\src\plugins\sqldrivers\psql/../../../../include/QtCore/../../sr
    60. c/corelib/tools/qstring.h:869: undefined reference to `_imp___ZN7QString4freeEPN
    61. S_4DataE'
    62. tmp/obj/debug_shared/main.o: In function `QList':
    63. C:\Qt\2010.04\qt\src\plugins\sqldrivers\psql/../../../../include/QtCore/../../sr
    64. c/corelib/tools/qlist.h:113: undefined reference to `_imp___ZN9QListData11shared
    65. _nullE'
    66.  
    67. .......
    68.  
    69.  
    70. tmp/obj/debug_shared/moc_qsql_psql.o:moc_qsql_psql.cpp:(.rdata$_ZTV11QPSQLDriver
    71. [vtable for QPSQLDriver]+0x20): undefined reference to `QObject::eventFilter(QOb
    72. ject*, QEvent*)'
    73. tmp/obj/debug_shared/moc_qsql_psql.o:moc_qsql_psql.cpp:(.rdata$_ZTV11QPSQLDriver
    74. [vtable for QPSQLDriver]+0x24): undefined reference to `QObject::timerEvent(QTim
    75. erEvent*)'
    76. tmp/obj/debug_shared/moc_qsql_psql.o:moc_qsql_psql.cpp:(.rdata$_ZTV11QPSQLDriver
    77. [vtable for QPSQLDriver]+0x28): undefined reference to `QObject::childEvent(QChi
    78. ldEvent*)'
    79. tmp/obj/debug_shared/moc_qsql_psql.o:moc_qsql_psql.cpp:(.rdata$_ZTV11QPSQLDriver
    80. [vtable for QPSQLDriver]+0x2c): undefined reference to `QObject::customEvent(QEv
    81. ent*)'
    82. tmp/obj/debug_shared/moc_qsql_psql.o:moc_qsql_psql.cpp:(.rdata$_ZTV11QPSQLDriver
    83. [vtable for QPSQLDriver]+0x30): undefined reference to `QObject::connectNotify(c
    84. har const*)'
    85. tmp/obj/debug_shared/moc_qsql_psql.o:moc_qsql_psql.cpp:(.rdata$_ZTV11QPSQLDriver
    86. [vtable for QPSQLDriver]+0x34): undefined reference to `QObject::disconnectNotif
    87. y(char const*)'
    88. tmp/obj/debug_shared/moc_qsql_psql.o:moc_qsql_psql.cpp:(.rdata$_ZTV11QPSQLDriver
    89. [vtable for QPSQLDriver]+0x5c): undefined reference to `QSqlDriver::sqlStatement
    90. (QSqlDriver::StatementType, QString const&, QSqlRecord const&, bool) const'
    91. tmp/obj/debug_shared/moc_qsql_psql.o:moc_qsql_psql.cpp:(.rdata$_ZTV11QPSQLDriver
    92. [vtable for QPSQLDriver]+0x74): undefined reference to `QSqlDriver::setOpen(bool
    93. )'
    94. tmp/obj/debug_shared/moc_qsql_psql.o:moc_qsql_psql.cpp:(.rdata$_ZTV11QPSQLDriver
    95. [vtable for QPSQLDriver]+0x78): undefined reference to `QSqlDriver::setOpenError
    96. (bool)'
    97. tmp/obj/debug_shared/moc_qsql_psql.o:moc_qsql_psql.cpp:(.rdata$_ZTV11QPSQLDriver
    98. [vtable for QPSQLDriver]+0x7c): undefined reference to `QSqlDriver::setLastError
    99. (QSqlError const&)'
    100. collect2: ld returned 1 exit status
    101. mingw32-make[1]: *** [..\..\..\..\plugins\sqldrivers\qsqlpsqld4.dll] Error 1
    102. mingw32-make[1]: Leaving directory `C:/Qt/2010.04/qt/src/plugins/sqldrivers/psql
    103. '
    To copy to clipboard, switch view to plain text mode 

    The libqsqlpsqld4.a is generated but there is no dll.
    I went through these steps several times but I cannot figure out how to solve this problem. I have also followed the instructions at this link where they seem to have the same problem:
    http://www.qtcentre.org/threads/1899...Database/page2 but it didn't work.
    This is my configuration: WINXP SP2 / QT 4.6.3 (qt-sdk-win-opensource-2010.04) / PostgreSQL 8.4

    Does anybody know how to solve this issue? Is there any other way to get this driver?
    Thank you very much for your help

    Regards
    Daniel

  2. #2
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: Cannot build PostgreSQL driver

    This is how i build postgresql plugin:

    Qt Code:
    1. qmake "INCLUDEPATH+=C:\Programs\PostgreSQL\8.4\include" "LIBS+=C:\Programs\PostgreSQL\8.4\lib\libpq.lib" psql.pro
    2. qmake
    3. mingw32-make debug
    4. mingw32-make release
    To copy to clipboard, switch view to plain text mode 

    I don't use reimp and dlltool, but it works.

  3. #3
    Join Date
    Jun 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Cannot build PostgreSQL driver

    Thank you for your answer. I have tried your suggestion but I am getting the same error.
    I think something is not right with my qt, I am getting "undefined reference" even for QString.
    Could this be a problem of environment variables? I installed the sdk (qt-sdk-win-opensource-2010.04)
    but I didn't set any environment variables, instead I am working from the Qt Command Prompt that automatically set the followings variables:
    -- QTDIR set to C:\Qt\2010.04\qt
    -- PATH set to C:\Qt\2010.04\qt\bin
    -- Adding C:\Qt\2010.04\bin to PATH
    -- Adding C:\WINDOWS\System32 to PATH
    -- QMAKESPEC set to win32-g++
    Is this correct?

    Thanks again

    Regards
    Daniel

  4. #4
    Join Date
    Jun 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Cannot build PostgreSQL driver

    After several attempts I was able to solve the problem.
    The problem was that my environment variables INCLUDE and LIB were not set.
    In order to build the entire Qt library or just a part of it (like my case building QPSQL plugin)
    besides extending the "path" variable it is also necessary to set the "include" and "lib" variables with the right paths.
    If those two variables are not present, they need to be created.
    Here is how I have set my variables:

    Created the following new variables:
    QTDIR=C:\Qt\4.6.3
    MINGW=C:\mingw

    Extended "path" variable adding the following paths:
    %QTDIR%\bin
    %MINGW%\bin

    Created "lib" variable with the following paths
    %QTDIR%\lib
    %MINGW%\lib

    Created "include" variable with the following paths
    %QTDIR%\include
    %MINGW%\include

    Please notice I am compiling with MinGW on WINXP, I don't know about other platforms but I imagine it will be somewhat similar.

    I hope this will help anybody else having a similar problem.

  5. #5
    Join Date
    Aug 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Cannot build PostgreSQL driver

    same thing for me,
    with reimp dlltool make, the build seem works but when i print QSqlDatabase:rivers in another project, there don't have psql driver

    QtCreator 2010.04, QT 4.6.3, GCC 4.4, OS 7

  6. #6
    Join Date
    Aug 2010
    Location
    Poland - Koszalin/Poznań
    Posts
    3
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Cannot build PostgreSQL driver

    I find out that compiling plugin with libraries from postgressql 8.4 fail, but with version 8.3 works as described on wiki.

Similar Threads

  1. PostgreSQL driver support
    By treyhaslem in forum Newbie
    Replies: 14
    Last Post: 26th October 2010, 10:01
  2. POSTGRESQL driver for windows
    By drave in forum Newbie
    Replies: 2
    Last Post: 2nd April 2010, 13:44
  3. PostgreSQL driver and Window 7
    By lasher in forum Installation and Deployment
    Replies: 0
    Last Post: 6th October 2009, 17:51
  4. PostgreSQL driver
    By clusty in forum Qt Programming
    Replies: 1
    Last Post: 21st August 2008, 01:55
  5. QT4 and Postgresql driver
    By alphaqt in forum Installation and Deployment
    Replies: 6
    Last Post: 27th February 2006, 16:50

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.