Build Qt 5.0.1 with PostgreSQL 9.2.2 - problem!

  • Hello! Sorry for my bad English, I use a translator. It's all my fault.

    Problem: Build Qt 5.0.1 with PostgreSQL 9.2.2

    Made in the following order:

    1. Download Qt SDK -
    2. Download Qt sources -
    3. Download PostgreSQL -
    4. Download Perl -
    5. Download Python -

    Install to:

    1. C:\Qt
    2. C:\Qt\qt-everywhere-opensource-src-5.0.1
    3. С:\PgSQL-9.2
    4. C:\Perl
    5. C:\Python27

    Add to PATH:



    cd C:\Qt\qt-everywhere-opensource-src-5.0.1
    configure.bat -debug-and-release -opensource -plugin-sql-psql -opengl desktop -no-icu -platform win32-g++ -I C:\PgSQL-9.2\include -L C:\PgSQL-9.2\lib




    In file included from c:\qt\qt5.0.1\tools\mingw\bin../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/i686-w64-mingw32/bits/
    from c:\qt\qt5.0.1\tools\mingw\bin../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/i686-w64-mingw32/bits/
    from c:\qt\qt5.0.1\tools\mingw\bin../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/ext/atomicity.h:34,
    from c:\qt\qt5.0.1\tools\mingw\bin../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/bits/basic_string.h:41
    from c:\qt\qt5.0.1\tools\mingw\bin../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/string:54,
    from c:\qt\qt5.0.1\tools\mingw\bin../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/random:41,
    from c:\qt\qt5.0.1\tools\mingw\bin../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/bits/stl_algo.h:67,
    from c:\qt\qt5.0.1\tools\mingw\bin../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/algorithm:63,
    from ......\include/QtCore/../../src/corelib/global/qglobal.h:80,
    from ......\include/QtCore/qglobal.h:1,
    from ......\include/QtCore/../../src/corelib/tools/qchar.h:45,
    from ......\include/QtCore/qchar.h:1,
    from ......\include/QtCore/../../src/corelib/tools/qstring.h:45,
    from ......\include/QtCore/qstring.h:1,
    from ......\include/QtCore/../../src/corelib/codecs/qtextcodec.h:45,
    from ......\include/QtCore/qtextcodec.h:1,
    from ....\corelib\codecs\qlatincodec_p.h:56,
    from ....\corelib\codecs\qlatincodec.cpp:42:
    C:\PgSQL-9.2\include/pthread.h:307:8: error: redefinition of 'struct timespec'

    What am I doing wrong???

  • I came to that error too, I just commented out the struct definition (I probably should not do that, but since the ifndef does not work as it should) and since the struct is already defined, I suppose there will not be any problem.

    struct timespec {
    long tv_sec;
    long tv_nsec;

    // This is in your C:\PgSQL-9.2\include/pthread.h file.

  • I think that header from PostgreSQL is with conflict with pthread from Qt or mingw or something. Try make plugin to PostgreSQL after compilation Qt.

  • Well, of what I know:
    The #ifndef means that the following code (the definition of timespec struct) should be compiled if and only if the HAVE_STRUCT_TIMESPEC token was not set to 1.

    I do not know who did the mistake (maybe changed the name of the token or whatever) but since the struct is defined there should be no problem.... unless timespec struct of postgresql pthread.h has two long numbers and the allready defined has only one, or the names of the long numbers are not the ones that postgresql pthread.h has.

    I managed to produce the plugin and connect it to QtCreator (but I have not tested it by selecting something from any table).

  • I checked my installation of PostgreSQL on Windows and Linux and on both I don't have a pthread.h file. I think there should not be a pthread.h in PG includes.

  • Hello;
    I get headache with it but ultimately compiled and build it;

    Your problem is this:
    1- libpq.a is wrong -> libpq.lib is ok
    2- i renamed pthread to a temp name so that it worked

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.