由于缺少ICU库,在将webkitwidgets模块构建到自编Qt5时出现“未定义的引用”?

由于缺少ICU库,在将webkitwidgets模块构建到自编Qt5时出现“未定义的引用”?,qt,qtwebkit,icu,Qt,Qtwebkit,Icu,我已经将Qt5库从源代码构建到Ubuntu12.04中,并制作了一个Qt测试应用程序。在.pro文件中,我编写了QT+=核心gui webkitwidgets,以便在测试项目中使用Qwebview 但当我在Qt creator中运行qmake时,它会给我错误: Unknown module(s) in QT: webkitwidgets 当我从源代码构建Qt5libs时,我认为webkit或webkitwidgets模块不是按源代码构建的 因此,我已经从源代码构建了qtwebkit或webki

我已经将Qt5库从源代码构建到Ubuntu12.04中,并制作了一个Qt测试应用程序。在.pro文件中,我编写了QT+=核心gui webkitwidgets,以便在测试项目中使用Qwebview

但当我在Qt creator中运行qmake时,它会给我错误:

Unknown module(s) in QT: webkitwidgets
当我从源代码构建Qt5libs时,我认为webkit或webkitwidgets模块不是按源代码构建的

因此,我已经从源代码构建了qtwebkit或webkitwdgtes模块,如下所示

cd qtwebkit    
qmake    
make -jX 
其中X是芯数*2+1

但当我运行make命令时,我得到了以下错误

StringImpl.cpp:(.text+0x64ad): undefined reference to u_strToUpper_51'
StringImpl.cpp:(.text+0x6636): undefined reference to u_toupper_51'
DatePrototype.cpp:(.text+0x328): undefined reference to udat_open_51'
DatePrototype.cpp:(.text+0x366): undefined reference to udat_close_51'
JSGlobalObjectFunctions.cpp:(.text+0x99f): undefined reference tou_charType_51'
StringImpl.cpp:(.text+0xa00): undefined reference tou_foldCase_51'
CollatorICU.cpp:(.text+0x1f1): undefined reference to ucol_getLocaleByType_51' CollatorICU.cpp:(.text+0x20f): undefined reference toucol_getAttribute_51'
CollatorICU.cpp:(.text+0x25b): undefined reference to ucol_open_51'
CollatorICU.cpp:(.text+0x27f): undefined reference toucol_open_51'
CollatorICU.cpp:(.text+0x2a4): undefined reference to ucol_setAttribute_51'
还有更多未定义的引用错误

我还发现qtwebkit模块使用了我的机器上缺少的ICU库


那么,我如何将ICU库构建到Ubuntu中,以便qtwebkit模块能够引用符合要求的ICU库,并且我能够修复这些引用错误并成功构建qtwebkit。

尝试使用apt get安装软件包:

sudo apt-get install libqt5webkit5-dev

通过从Qt/lib文件夹中删除ICU库,我修复了一个类似的错误。 如果操作系统libs上安装了另一个版本的ICU,则会产生冲突。

您尝试过这个吗?:

然而,即使在我为我的项目工作时,webkit也会带来更多的问题,比如在UI工具栏中丢失,或者在将程序发布到应用商店时没有编译。我建议研究其他解决方案,如
.

我已经做了同样的事情,但仍然遇到同样的问题。有没有理由不使用Ubuntu自己的Qt版本?谢谢你的评论。我已经从源代码构建了icu LIB,如下所示。cd source&&./configure-prefix=/usr&&make并通过make-install安装相同的文件,现在我可以在路径/usr/lib/上获得icu libs,但是当我从源代码构建qtwebkit模块时,仍然会得到相同的未定义的引用错误。仅供参考,我在默认情况下获得与Qt 4.8.1兼容的文件。因此,Ubuntu 12.04中路径/usr/lib/i386 linux gnu/上的libs。但是我想把Qt5.2.1应用程序的deb放到Ubuntu12.04中。因此,我已经将Qt5.2.1安装程序安装到Ubuntu12.04中,然后我能够在QtCreator中成功运行Qt5应用程序。但当我尝试为同一个应用程序制作deb时,它引用了机器的qt5库,而不是我从安装程序安装的qt5。这就是为什么我从源代码构建QT 5.2.1,但当我使用从源代码构建的QT 5.2.1将我的应用程序运行到QT creator时,我遇到了关于webkitwidget的问题。然后我尝试构建QtWebKIT,得到了我在帖子中提到的未定义的引用错误。你不考虑使用VM或者升级系统吗?
RESOURCES += \
    resources.qrc

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets webkit webkitwidgets