xcode 构建qt项目时“没有这样的sysroot目录”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52385658/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:46:26  来源:igfitidea点击:

"no such sysroot directory" while building qt project

xcodemacosqt

提问by Arseniy Spiridonov

MacOS MojaveVersion 10.14 (18A389).

MacOS Mojave版本 10.14 (18A389)。

Today I updated Xcode to version 10.0 (10A255). End when I try to build my Qt project I get an error:

今天我将 Xcode 更新到版本 10.0 (10A255)。当我尝试构建 Qt 项目时结束,出现错误:

clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk' [-Wmissing-sysroot]
In file included from ../greed/timediagram.cpp:1:
In file included from ../../../Qt/5.9.1/clang_64/lib/QtGui.framework/Headers/QtGui:3:
In file included from /Users/arsenyspiridonov/Qt/5.9.1/clang_64/lib/QtGui.framework/Headers/QtGuiDepends:3:
In file included from /Users/arsenyspiridonov/Qt/5.9.1/clang_64/lib/QtCore.framework/Headers/QtCore:4:
In file included from ../../../Qt/5.9.1/clang_64/lib/QtCore.framework/Headers/qglobal.h:47:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/utility:202:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:61:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string.h:61:15: fatal error: 'string.h' file not found
#include_next <string.h>
              ^~~~~~~~~~
1 error generated.
make: *** [timediagram.o] Error 1
16:13:47: Процесс ?/usr/bin/make? завершился с кодом 2.
Ошибка при сборке/установке проекта greed (комплект: Desktop Qt 5.9.1 clang 64bit)
Во время выполнения этапа ?Сборка?

What's the problem? How to fix it?

有什么问题?如何解决?

回答by sellen

add 'QMAKE_MAC_SDK = macosx10.14' to your .pro file, and manually delete .qmake.stash from your build directory (or directories).

将 'QMAKE_MAC_SDK = macosx10.14' 添加到您的 .pro 文件,并从您的构建目录(或多个目录)中手动删除 .qmake.stash。

回答by ZLNK

In my case I updated xcode to the last version, so instead of have on the folder the version 10.13, I had MacOSX10.14.sdk ( that is a symbolic link to the folder MacOSX.sdk)

就我而言,我将 xcode 更新到了最新版本,因此我在文件夹中没有使用 10.13 版本,而是使用 MacOSX10.14.sdk(这是 MacOSX.sdk 文件夹的符号链接)

so, you can solve the problem with this code on terminal:

因此,您可以在终端上使用此代码解决问题:

sudo ln -s MacOSX.sdk/ MacOSX10.13.sdk

positioned on the current folder.

位于当前文件夹中。

I hope it helps.

我希望它有帮助。

回答by Arseniy Spiridonov

I just reinstalled Qt. All is Ok now

我刚刚重新安装了Qt。现在一切都好

回答by rsp1984

This helped me:

这帮助了我:

  1. Close the project in Qt Creator.
  2. Delete the .pro.userfile in your codedirectory.
  3. Add QMAKE_MAC_SDK = macosx10.14and QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14to your .pro file in a text editor (not in Qt Creator). Replace 10.14with whatever MacOS version you want to build for.
  4. Re-open the project in Qt Creator. It will reconfigure.
  5. Build.
  1. 在 Qt Creator 中关闭项目。
  2. 删除代码目录中的.pro.user文件。
  3. 在文本编辑器(而不是 Qt Creator)中将QMAKE_MAC_SDK = macosx10.14和添加QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14到您的 .pro 文件。替换10.14为您要为其构建的任何 MacOS 版本。
  4. 在 Qt Creator 中重新打开项目。它会重新配置。
  5. 建造。