[SOLVED] Qt v4.8.4 static build (Windows 7 x64): undefined reference to `pthread_testcancel'



  • Hi there!

    I've read a lot of articles about static build of Qt, and I faild to find somebody else, who are faced with the same problem.

    I downloaded Qt v4.8.4 and build it in according to "these instructions":http://qt-project.org/wiki/How_to_build_a_static_Qt_version_for_Windows_with_gcc.

    After that I created the simple Qt GUI project with only window, corrected the project file in according to the same instructions, added CONFIG+=STATIC additional qmake argument. But when I try to compile the project, the following error occurs on the linking step:

    @g++ -static -static-libgcc -Wl,-s -mthreads -Wl,-subsystem,windows -o release\Test1s.exe release/main.o release/mainwindow.o release/moc_mainwindow.o -L"e:\Distors\Programming\Qt\qt-everywhere-opensource-src-4.8.4\lib" -lmingw32 -lqtmain -lQtGui -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lz
    e:\Distors\Programming\Qt\qt-everywhere-opensource-src-4.8.4\lib\libQtCore.a(qdatetime.o):qdatetime.cpp:(.text+0x35a8): undefined reference to `pthread_testcancel'@

    If somebody was faced with such problem, please, let me know how you fixed it.

    Thank you.

    P.S. I do not provide the source code, because it's default simple GUI project, created by QtCreator 2.7.0.



  • ok, it was my typo: I specified in the QTDIR the path to Qt v5.x directory, instead of Qt v4.8.4.

    Corrected. But now when I try to coplite the project the following error occurs:

    @g++ -static -static-libgcc -Wl,-s -Wl,-subsystem,windows -o release\Test1s.exe release/main.o release/mainwindow.o release/moc_mainwindow.o -L"e:\Distors\Programming\Qt\qt-everywhere-opensource-src-4.8.4\lib" -lmingw32 -lqtmain -lQtGui -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32
    release/main.o:main.cpp:(.text+0x28): undefined reference to `QApplication::QApplication(int&, char**, int)'@


  • Lifetime Qt Champion

    Hi,

    Did you do a clean before recompiling ? You might have now a mix of object linked to your two Qt



  • Hi!

    Yes, sure.



  • OK, I've fixed it. The problem was caused the in the different versions of MinGW for x32 and x64 architectures. It seems, QT v4.8.4 was complied by x64 MinGW and the project - by x64 one.


Log in to reply
 

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