Problems with Open-Source Downloads read and

Build static Qt 5.3 with mingw-w64 4.9 fails

  • Hi,
    I followed "these instructions": for building Qt from source (search for "Prerequisites" on the page, that is where I started).
    I did not include WebKit or ICU. When configuring I added "-static".
    But during make, following error occurs:

    @.obj/debug/positioning_cppsnippet_plugin_import.o: In function StaticPollPositi onPluginPluginInstance::StaticPollPositionPluginPluginInstance()': C:\Qt5\qtlocation\src\positioning\doc\snippets\cpp/positioning_cppsnippet_plugin _import.cpp:4: undefined reference toqt_static_plugin_PollPositionPlugin()'
    collect2.exe: error: ld returned 1 exit status
    Makefile.Debug:81: recipe for target 'debug\positioning_cppsnippet.exe' failed
    mingw32-make[5]: *** [debug\positioning_cppsnippet.exe] Error 1
    mingw32-make[5]: Leaving directory 'C:/Qt5/qtlocation/src/positioning/doc/snippe
    Makefile:34: recipe for target 'debug' failed
    mingw32-make[4]: *** [debug] Error 2
    mingw32-make[4]: Leaving directory 'C:/Qt5/qtlocation/src/positioning/doc/snippe
    Makefile:38: recipe for target 'sub-cpp-make_first' failed
    mingw32-make[3]: *** [sub-cpp-make_first] Error 2
    mingw32-make[3]: Leaving directory 'C:/Qt5/qtlocation/src/positioning/doc/snippe
    Makefile:92: recipe for target 'sub-positioning-doc-snippets-make_first' failed
    mingw32-make[2]: *** [sub-positioning-doc-snippets-make_first] Error 2
    mingw32-make[2]: Leaving directory 'C:/Qt5/qtlocation/src'
    Makefile:40: recipe for target 'sub-src-make_first' failed
    mingw32-make[1]: *** [sub-src-make_first] Error 2
    mingw32-make[1]: Leaving directory 'C:/Qt5/qtlocation'
    Makefile:344: recipe for target 'module-qtlocation-make_first' failed
    mingw32-make: *** [module-qtlocation-make_first] Error 2@

    Any clues? Or is there maybe another tutorial that covers my needs? The tutorial for "static building of QT": says that you first need to install the pre-build version which exists only in 32-bit for MinGW :(

  • Moderators

    Don't know if this is your problem but when I was building Qt 5.3 with mingw 64 bit I was using multiple jobs and it caused objects not to get included in the resulting Qt libs.

    This of course caused linker errors like the one you are seeing. Although I can't say this is the same thing as I didn't see that specific error.

    Anyway, you can use ar to check what is in a library, and then even if it shows it have the object file (.o) that you are looking for try extracting it and make sure it has symbols. Mine would be empty object files.

    ar t lib_you_want_to_check.a
    ar x object_name.o

    Those are the commands you'll need to check.

    Or more simply, make distclean and rebuild with a single job. It takes a lot longer but I didn't have the linker problems when I did that.

    And another idea is you are not using a compatible version of mingw. There are specific mingw versions that Qt builds with, and others it just doesn't work right without a lot of minor code changes.

    Make sure you are using a mingw from "here": as you will have the best luck. I still went through quite a few mingws before I found one that worked without me having to change Qt source files.

Log in to reply