123*_*123 117 c++ macos xcode qt qt-creator
我刚刚安装了Qt 5.5并且在OS X上第一次使用Qt Creator.当我第一次安装Qt时,它给了我一条错误消息'Xcode 5 not installed'我觉得很奇怪,(我有Xcode 7测试版) ,但安装成功完成.
现在,当我启动或打开一个项目时,我收到错误:
项目错误:Xcode未正确设置.您可能需要通过运行/ usr/bin/xcodebuild来确认许可协议.
当我/usr/bin/xcodebuild在终端运行时,我得到以下内容:
xcode-select:错误:工具'xcodebuild'需要Xcode,但是活动的开发人员目录'/ Library/Developer/CommandLineTools'是一个命令行工具实例
我不确定Xcode与Qt Creator有什么关系,除非它与访问库以实现跨平台兼容性有关,但有没有办法解决这个问题?
123*_*123 271
> = Xcode 8
在Xcode 8中,正如布鲁斯所说,当Qt试图找到xcrun它应该寻找的时候会发生这种情况xcodebuild.
打开文件:
Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf
Run Code Online (Sandbox Code Playgroud)
更换:
isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null")))
Run Code Online (Sandbox Code Playgroud)
附:
isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")))
Run Code Online (Sandbox Code Playgroud)
〜> Xcode 8
在Xcode 8之前,在安装Xcode之后安装命令行工具时会出现此问题.发生的事情是Xcode-select指向开发人员目录/Library/Developer/CommandLineTools.
Xcode-select使用以下命令指向正确的Xcode Developer目录:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Run Code Online (Sandbox Code Playgroud)
使用以下命令确认许可协议:
sudo xcodebuild -license
Run Code Online (Sandbox Code Playgroud)
这将提示您阅读许可协议.
输入agree接受条款.
Rud*_*ski 79
如果你更改了内容,Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf
那么它只适用于桌面工具包,而不适用于ex.模拟器.
更好的方法是创建符号链接:
cd /Applications/Xcode.app/Contents/Developer/usr/bin/
sudo ln -s xcodebuild xcrun
Run Code Online (Sandbox Code Playgroud)
所以你不必为所有目标更改.prf文件.
Shn*_*hnd 25
这样就可以了:
#sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Run Code Online (Sandbox Code Playgroud)
在终端中运行此命令.
Bru*_*uce 11
对于Xcode 8的用户,还有另一个问题.在Qt 5.7.1发布之前,请参见此处获取临时解决方案:
https://forum.qt.io/topic/71119/project-error-xcode-not-set-up-properly
总结一下:
Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf在文本编辑器中打开,并替换为:
isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))))
Run Code Online (Sandbox Code Playgroud)
有了这个:
isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")))
Run Code Online (Sandbox Code Playgroud)
小智 5
如果您使用 XCode 8.x 从源代码构建 Qt,则必须更改第qt-everywhere-enterprise-src-5.7.0/qtbase/configure551 行文件中的“-find”参数,使其看起来像:
if ! /usr/bin/xcrun -find xcodebuild >/dev/null 2>&1; then
Run Code Online (Sandbox Code Playgroud)