Error building Qt 4.8.0 windows 7 minGW

  • I'm attempting to build Qt from source on windows 7 using the latest minGW compiler(4.6.2?) it gets pretty far along (about 3 hours compile time) before running into this ld.exe error:

    Configure options:
    -platform win32-g++-4.6 -opensource
    -debug -debug-and-release
    -nomake examples
    -nomake demos
    -plugin-sql-psql -qt-zlib -qt-gif -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg
    -qt-sql-odbc -qt-sql-sqlite -plugin-sql-odbc -plugin-sql-sqlite
    -no-opengl -no-openvg -no-incredibuild-xge

    c:/qt/mingw32_x86/mingw/bin/../lib/gcc/mingw32/4.6.2./../../../../mingw32/bin/ld.exe cannot find -lQtWebKitd
    collect2: ld returned 1 exit status
    mingw32-make[3]: ***[..............\imports\QtWebKit\qmlwebkitplugind.dll] Error 1

    Any help is greatly appreciated, thanks!

    Edit: source file =

  • Moderators

    welcome to devnet

    Did you "see and follow this": guide?

    MinGW is not the latest version. Newest at the time 4.7.2. Personally I consider it a bit confusing when installing through the official MinGW page. If you do not update, you will install the older version 4.6.2. During installation you need to select update of db for the newer version. In addition you will get only the 32 bit version from there.
    In the above mentioned wiki-page you will find a reference to the recommended MinGW distro. This might make live a bit easier.
    In addition I would recommend to compile Qt 4.8.4.

    Following the information on the wiki page I could successfully compile Qt 4.8.4 with MinGW 4.7.2 (64 bit) on windows 7 64 bit.
    Hope this helps.

  • I'm actually running into the same issue with minGW compiler bundled with qt 5.0.1 SDK and, using the same guide from above. I'm trying to compile Qt with postgresql support which I think may be the issue, any workarounds you know of?

    edit: full context of error below

    g++ -Wl, -s -mthreads -shared -Wl, --out-implib,c:\Qt\4.8.4-qt-x86-build\imports\QtWebKit\libqmlwebkitplugin.a -o ..............\imports\QtWebkit\qmlwebkitplugin.dll tmp/obj/release_shared/qdeclarativewebview.o tmp/obj/release_shared/plugin.o tmp/obj/release_shared/moc_qdeclarativewebview_p.o -L"c:\Qt\4.8.4-qt-x86-build\lib" -L"c:\Qt\4.8.4-qt-x86-build\lib" -LC:\Qt\PostgreSQL\lib -lQtDeclarative4 -lQtWebKit -lQtGui4 -lQtCore4
    c:/qt/mingw32_x86/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../..../i686-w64-mingw32/bin/ld.exe: cannot find -lQtWebKit
    collect2.exe: error: ld returned 1 exit status
    jom: C:\Qt\4.8.4-qt-x86-build\src\3rdparty\webkit\Source\WebKit\qt\declarative\Makefile.WebKit.Release [..............\imports\QtWebKit\qmlwebkitplugin.dll] Error 1
    jom: C:\Qt\4.8.4-qt-x86-build\src\3rdparty\webkit\Source\Webkit\qt\declarative\Makefile.WebKit [release-all] Error 2
    jom: C:\Qt\4.8.4-qt-x86-build\src\3rdparty\webkit\Source\Makefile.Webkit [sub-WebKit-qt-declartive-make_default-ordered] Error 2
    jom: C:\Qt\4.8.4-qt-x86-build\Makefile [sub-webkit-make_default-ordered] Error 2

  • Moderators

    Before I was posting before I had checked that I did not exclude QWebkit in my builds.

    Did you check if the lib is available?

    Since I did not build with postgresql support, i do not know if there is an issue.

  • Just posting back but I wasn't able to get around this using the minGW compiler. Although, I did successfully install qt using the 1.2.1 sdk and 4.8.1 sources to satisfy my needs, thanks again for the help.

  • Your make most likely created QtWebKit4. Unfortunately, the Makefile is saying: include QtWebKit. Change the Makefiles manually and that should solve this particular problem. However, you might still not be able to compile the whole WebKit.

  • Moderators

    I've hit the same problem with the following config: Qt 4.8.4, MinGW 4.8.0 32bit, Windows 8.
    I got it to build with webkit though. As Ethicius said the problem is missing "4" in the Makefiles.

    • Go to the <build dir>\src\3rdparty\webkit\Source\WebKit\qt\declarative\
    • Depending on your configure options you'll have Makefile.WebKit.Release or Makefile.WebKit.Debug or both there.
    • Open them and find the line that starts with "LIBS =", should be near the top.
    • Change -lQtWebKit to -lQtWebKit4 (for release makefile) or -lQtWebKitd to -lQtWebKitd4 (for debug makefile)
    • Run jom or mingw32-make again, it should build now

  • Hi,

    I just got the same error:
    x86_64-w64-mingw32/bin/ld.exe: cannot find -lQtWebKitd

    I was being compiling Qt 4.8.4 in 64bits using the recommanded MinGW ( "": )

    Refer to this page for more details about the recommanded MinGW:

    The solution of Chris Kawa worked for me.

    @Chris Kawa: Maybe can you tell us why we have to do that? Where does the issue comes from?


  • Moderators

    My guess would be it's because there's a bug in the Qt buildsystem (duh...) ;)
    I switched to Qt5 so I don't need it anymore, but maybe it's fixed in 4.8.5. Have you checked?

  • [quote author="Chris Kawa" date="1379777936"]My guess would be it's because there's a bug in the Qt buildsystem (duh...) ;)
    I switched to Qt5 so I don't need it anymore, but maybe it's fixed in 4.8.5. Have you checked?[/quote]

    No i didn't check if the issue has been fixed. Your workaround works perfectly, so it doesn't matter if it has been fixed or not.


  • Quite late reply, but I had the same problem with Qt 4.8.6. Patched qt_functions.prf:

    < win32:LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}d

           win32:LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}d$${QT_MAJOR_VERSION}@



Log in to reply

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