Important: Please read the Qt Code of Conduct -

[Solved] Linker problems when building QtWebKit (inside of Qt 5.0.1 ) on osx.

  • Hi All,

    I need to have Qt 5.0.1 with QtWebkit compiled from source. Unfortunately I'm running into the following problem:

    clang++ -headerpad_max_install_names -mmacosx-version-min=10.6 -single_module -dynamiclib -compatibility_version 5.0 -current_version 5.0.1 -install_name /Users/mike/src/qt5/qtbase/lib/QtWebKit.framework/Versions/5/QtWebKit -o QtWebKit .obj/release-shared/.rcc/release-shared/qrc_WebCore.o .obj/release-shared/.rcc/release-shared/qrc_WebKit.o .obj/release-shared/.rcc/release-shared/qrc_InspectorBackendCommands.o -F/Users/mike/src/qt5/qtbase/lib -framework QtNetwork -L/opt/local/lib -framework QtCore -framework QtGui -framework Carbon -framework AppKit -L/opt/local/lib -Wl,-force_load,/Users/mike/src/qt5/qtwebkit/Source/WebKit/release/libWebKit1.a -L/Users/mike/src/qt5/qtwebkit/Source/WebKit/release -Wl,-force_load,/Users/mike/src/qt5/qtwebkit/Source/WebKit2/release/libWebKit2.a -L/Users/mike/src/qt5/qtwebkit/Source/WebKit2/release -Wl,-force_load,/Users/mike/src/qt5/qtwebkit/Source/WebCore/release/libWebCore.a -L/Users/mike/src/qt5/qtwebkit/Source/WebCore/release -lz -framework AudioUnit -framework AudioToolbox -framework CoreAudio -framework QuartzCore -framework QTKit -framework Security -framework IOKit /Users/mike/src/qt5/qtwebkit/WebKitLibraries/libWebKitSystemInterfaceMountainLion.a -framework IOSurface -framework CoreFoundation -lsqlite3 -Wl,-force_load,/Users/mike/src/qt5/qtwebkit/Source/ThirdParty/ANGLE/release/libANGLE.a -L/Users/mike/src/qt5/qtwebkit/Source/ThirdParty/ANGLE/release -Wl,-force_load,/Users/mike/src/qt5/qtwebkit/Source/JavaScriptCore/release/libJavaScriptCore.a -L/Users/mike/src/qt5/qtwebkit/Source/JavaScriptCore/release -Wl,-force_load,/Users/mike/src/qt5/qtwebkit/Source/WTF/release/libWTF.a -L/Users/mike/src/qt5/qtwebkit/Source/WTF/release -licucore -framework QtQuick -F/Users/mike/src/qt5/qtbase/lib -framework QtQml -framework QtNetwork -framework QtCore -framework QtGui -framework QtSql -framework OpenGL -framework AGL
    Undefined symbols for architecture x86_64:
    "_xmlByteConsumed", referenced from:
    WebCore::XMLDocumentParser::appendFragmentSource(WTF::String const&) in libWebCore.a(XMLDocumentParserLibxml2.o)
    "_xmlCreateMemoryParserCtxt", referenced from:
    WebCore::XMLParserContext::createMemoryParser(_xmlSAXHandler*, void*, WTF::CString const&) in


    Ok, the error is quite clear the architecture of _xmlByteConsumed (used from inside of XMLDocumentParserLibxml2.o) is not x86_64 compatible. My problem is now, which of the used object files or libraries is offering the function? The function is for example provided by the libxml2.dylib library (which can be found on different places), but the ones I checked with the
    otool (otool -vf libxml2.dylib) are all x86_64 compatible.

    Does anyone has an suggestion how to go on, and how to find the library which clang is trying to link with QtWebkit?


    I was able to find out why he couldn't find libxml2.
    Actually he said he had a wrong architecture, but I guess having no architecture is also
    the wrong one …. anyway….

    The problem lied in @qt5/qtwebkit/Source/WebCore/WebCore.pri@


    enable?(XSLT) {
    use?(LIBXML2) {
    mac {
    INCLUDEPATH += /usr/include/libxml2
    LIBS += -lxml2 -lxslt
    } else {
    PKGCONFIG += libxslt
    } else {
    QT *= xmlpatterns

    The include and the lib was not used. After removing enable? and use?
    Qt 5.0.1 was compiling and building.

    And now new question. How is the intended way to switch XSLT and LIBXML2 on?

    Thanks for your help.


  • I also posted the problem in an other "subforum":, but didn't got any answer. But finally today I had some time to dig deeper in the build scripts....

    Fortunately, I was able to solve the problem. It was the missing library libxslt, which caused the problem. After installing it with macports, the problem vanished. :-) I also suggested to change the
    requirement section "here": .



Log in to reply