我有一个应用程序,我正在使用Qt 4.7.4在osx雪豹下构建并运行良好,但该macbook已经死了。我现在正在建立一个运行山狮(10.8.2)和Qt 4.8.3的新macbook。我可以构建我的应用程序,但是当我尝试在Qt Creator 2.6.0中运行它时,我得到此运行时错误:
dyld: Library not loaded: ../lib/libicudata.46.1.dylib
Referenced from: /Users/david/dev/svn/map_creator/karte-build-Desktop-Debug/debug/MapCreator.app/Contents/MacOS/MapCreator
Reason: image not found
The program has unexpectedly finished.
我从Finder运行它时遇到类似的错误。
otool给了我:
Davids-MacBook-Pro:map_creator david$ otool -L karte-build-Desktop-Debug/debug/MapCreator.app/Contents/MacOS/MapCreator
karte-build-Desktop-Debug/debug/MapCreator.app/Contents/MacOS/MapCreator:
../lib/libicudata.46.1.dylib (compatibility version 46.0.0, current version 46.1.0)
libicui18n.46.dylib (compatibility version 46.0.0, current version 46.1.0)
libicuuc.46.dylib (compatibility version 46.0.0, current version 46.1.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 945.11.0)
/System/Library/Frameworks/Security.framework/Versions/A/Security (compatibility version 1.0.0, current version 55179.1.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1187.34.0)
/Users/david/dev/qt483/lib/QtSvg_fmosoft.framework/Versions/4/QtSvg_fmosoft (compatibility version 4.8.0, current version 4.8.3)
/Users/david/dev/qt483/lib/QtGui_fmosoft.framework/Versions/4/QtGui_fmosoft (compatibility version 4.8.0, current version 4.8.3)
/Users/david/dev/qt483/lib/QtCore_fmosoft.framework/Versions/4/QtCore_fmosoft (compatibility version 4.8.0, current version 4.8.3)
/Users/david/dev/qt483/lib/QtXmlPatterns_fmosoft.framework/Versions/4/QtXmlPatterns_fmosoft (compatibility version 4.8.0, current version 4.8.3)
/Users/david/dev/qt483/lib/QtNetwork_fmosoft.framework/Versions/4/QtNetwork_fmosoft (compatibility version 4.8.0, current version 4.8.3)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1669.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 744.12.0)
从雪豹到山狮,或从Qt 4.7.4到4.8.3,是否有什么变化导致了这个问题?或者也许我错过了在我的新Macbook上设置所有内容的步骤?我还在学习 - 真的只是Qt和Mac的新手,试图在主要开发人员离开后维护这个项目。
谢谢, 大卫
答案 0 :(得分:17)
在Qt项目设置中,在运行时设置下,您必须添加已编译的ICU库的路径。有一个网格,您可以在其中设置环境变量等。您想要的是DYLD_LIBRARY_PATH
,并设置(或追加)ICU库的路径。
这将使Qt能够将../lib/libicudata.46.1.dylib
解析为实际的库文件。
答案 1 :(得分:0)
Qt 5.2.0离线安装程序中存在一个错误,导致可执行文件在根路径中搜索Qt库而不是安装位置。
示例错误:
dyld: Library not loaded: /usr/local/Qt-5.2.0/lib/QtGui.framework/Versions/5/QtGui
Referenced from: /Users/JRP/Dropbox/STANFORD/CS106B/HW1/build-Life-Desktop_Qt_5_2_0_clang_64bit-Debug/Life.app/Contents/MacOS/Life
Reason: image not found
The program has unexpectedly finished.
修正:
鉴于Qt安装路径,您应该运行:
sudo ln -s /Users/$USER/Qt5.2.0/5.2.0/clang_64/ /usr/local/Qt-5.2.0
或者
sudo ln -s /Users/ito/Qt/5.2.0/clang_64/ /usr/local/Qt-5.2.0
我想到了你的想法。它只是创建一个从qt安装位置到它正在寻找的位置的链接。
答案 2 :(得分:0)
在Qt var client = new XMLHttpRequest();
client.open("GET", "unicorns-are-teh-awesome.txt", true);
client.send();
client.onreadystatechange = function() {
if(this.readyState == this.HEADERS_RECEIVED) {
var contentType = client.getResponseHeader("Content-Type");
if (contentType != my_expected_type) {
client.abort();
}
}
}
上,我重新启动 QtCreator,问题已解决!