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 - http://releases.qt-project.org/qt5/5.0.1/qt-windows-opensource-5.0.1-mingw47_32-x86-offline.exe
    2. Download Qt sources - http://releases.qt-project.org/qt5/5.0.1/single/qt-everywhere-opensource-src-5.0.1.zip
    3. Download PostgreSQL - http://get.enterprisedb.com/postgresql/postgresql-9.2.2-1-windows.exe
    4. Download Perl - http://downloads.activestate.com/ActivePerl/releases/5.16.2.1602/ActivePerl-5.16.2.1602-MSWin32-x86-296513.msi
    5. Download Python - http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi

    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:

    PATH=C:\Qt\Qt5.0.1\5.0.1\mingw47_32\bin;C:\Qt\Qt5.0.1\Tools\MinGW\bin;C:\Perl\site\bin;C:\Perl\bin;C:\Python27;C:\PgSQL-9.2\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem

    Сonfiguration:

    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

    Build:

    mingw32-make

    Result:

    ...
    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/
    gthr-default.h:41:0,
    from c:\qt\qt5.0.1\tools\mingw\bin../lib/gcc/i686-w64-mingw32/4.7.2/include/c++/i686-w64-mingw32/bits/
    gthr.h:150,
    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'
    ...
    ...
    Error!

    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.

    #ifndef HAVE_STRUCT_TIMESPEC
    #define HAVE_STRUCT_TIMESPEC 1
    struct timespec {
    long tv_sec;
    long tv_nsec;
    };
    #endif

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