Qt创建者-项目错误:Xcode设置不正确.您可能需要通过运行/usr/bin/xcodebuild来确认许可协议
Qt Creator - Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild
我刚刚安装了Qt 5.5,这是第一次在OS X上使用Qt Creator。当我第一次安装Qt时,它给了我一条错误消息"Xcode 5未安装",我觉得这很奇怪(我有Xcode 7测试版),但安装无论如何都成功完成了。
现在,当我开始或打开一个项目时,我会收到错误:
项目错误:Xcode设置不正确。您可能需要通过运行/usr/bin/xcodebuild来确认许可协议。
当我在终端中运行/usr/bin/xcodebuild
时,我得到以下内容:
xcode select:error:工具"xcodebuild"需要xcode,但活动的开发人员目录"/Library/developer/CommandLineTools"是命令行工具实例
我不确定Xcode与Qt Creator有什么关系,除非它与访问跨平台兼容性库有关,但有办法解决这个问题吗?
>=Xcode 8
正如Bruce所说,在Xcode 8中,当Qt试图在应该查找xcodebuild
的时候查找xcrun
时,就会发生这种情况。
打开文件:
Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf
替换:
isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null")))
带有:
isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")))
~>Xcode 8
在Xcode 8之前,在安装Xcode之后安装命令行工具时会出现此问题。发生的情况是Xcode-select
开发人员目录指向/Library/Developer/CommandLineTools
。
使用以下命令将Xcode-select
指向正确的Xcode Developer目录:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
使用以下命令确认许可协议:
sudo xcodebuild -license
这将提示您仔细阅读许可协议。
输入agree
以接受条款。
如果更改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
因此,您不必为所有目标更改.prf文件。
这将完成任务:
#sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
在你的终端上运行这个。
对于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"))))
这个:
isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")))
如果使用XCode 8.x从源代码构建Qt,则必须更改文件qt-everywhere-enterprise-src-5.7.0/qtbase/configure
中第551行的"-found"参数,使其看起来像:
if ! /usr/bin/xcrun -find xcodebuild >/dev/null 2>&1; then
设法解决了安装完整版本的Xcode,同意条款,然后使用xcode-select --reset
。
基本上,问题是您指向/Library/Developer/CommandLineTools
的xcode不允许您接受术语&条件所以在安装&重置位置,一切都应该正常
对我来说,正确工作的唯一方法是用'#'注释关于xcrun的行:
# Make sure Xcode is set up properly
#isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null"))):
#error("Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.")
在文件中:Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.pf
只是本着"这对我有用"的精神,在很多旧答案上添加一点我发现,通过启动Xcode,登录我的开发人员帐户(只是一个免费帐户),然后在"位置"中设置命令工具。我可以拿到
"sudo/usr/bin/xcodebuild-license agree"
工作。也就是说,它在命令行中启动了一个同意程序,我在仔细阅读了所有14页的内容后同意了。
我不需要编辑任何内容。
我的系统是Mojave 10.14.6和Xcode 10.3(10G8)。
- 运行同一解决方案的另一个项目的项目
- CMake-按正确顺序将项目与C运行时对象文件链接
- 如何运行位于boost/libs/python/example/tutorial目录中的hello.cpp和Jamfil
- 代码在main()中运行,但在函数中出现错误
- 我在c++代码中生成了一个运行时#3异常
- 如何在linux终端中同时编译和运行c++代码
- 为什么在运行时没有向我们提供有关分段错误的更多信息?
- 如何在运行中期切换GTK CSS style_context
- 如何在MS Visual Studio 2019中运行QT UI
- 如何通过cpp程序运行shell脚本
- IPC使用多个管道和分支进程来运行Python程序
- 删除指向指针的指针是运行时错误吗
- 将 swig2.0 添加到 usr/bin/ 以运行 CMake
- C++ 可执行文件在运行时找不到库,即使它在 /usr/lib 中(在 Linux 上)
- 在 Ubuntu 16.04 的 usr/local/bin 中安装的 c++ 应用程序在从主目录执行时无法正常运行
- /usr/bin/ld:在运行gmock程序时无法在ubuntu上找到-lgmock
- 为什么可以在没有返回类型的情况下运行 /usr/include/c ++/5/bits/fstream.tcc 中
- 当我尝试在 Ubuntu bash 中运行我的程序时,出现此错误:" /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21
- Qt创建者-项目错误:Xcode设置不正确.您可能需要通过运行/usr/bin/xcodebuild来确认许可协议
- Ubuntu16.04 在崇高的文本中运行 pcl 3, "fatal error: usr/include/pcl-1.7/pcl/point_types.h: No such file or di