Big Sur lang语“无效版本"由于MACOSX_DEPLOYMENT_TARGET而导致的错误 [英] Big Sur clang "invalid version" error due to MACOSX_DEPLOYMENT_TARGET
问题描述
我认为由于大苏尔(Big Sur)正在为新操作系统提供新的修补程序的事实.尝试安装使用 clang
进行编译的模块时,会引发以下错误:
clang:错误:'MACOSX_DEPLOYMENT_TARGET = 11.0'中的无效版本号
当前正在运行:
- Mac OS Big Sur,11.0 Beta版
- 英特尔 CPU(i386) 通过
- Python 3.8.0
pyenv
安装的多个模块具有 clang
依赖性,因此看来此错误非常普遍.一个例子:
pip install multidict
安装较旧版本的命令行工具(例如11.5)无法正常工作.
找出问题所在.
以前,我是从App Store(11.7)安装 XCode
并将其SDK设置为默认的:
sudo xcode-select --switch/Applications/Xcode.app/
但是,这似乎带有 clang
的不受支持的版本:
λclang --versionApple clang版本11.0.3(clang-1103.0.32.62)目标:x86_64-apple-darwin20.1.0螺纹型号:posixInstalledDir:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
通过以下方式将 xcode-select
设置为最新版本:
sudo xcode-select --switch/Library/Developer/CommandLineTools
编辑(2020年11月15日)
尝试上述更改时,您可能会收到错误消息:
xcode-select:错误:无效的开发人员目录'/Library/Developer/CommandLineTools'
要解决此问题,必须从Apple官方网站
因此,确保您的 SDK 是默认开箱即用的,而不是 XCode 的新 SDK 应该足以让系统在需要时切换上下文(并且似乎与
pip
一起工作正常)+clang
).I assume due to the fact Big Sur is sparkling new hotfixes for the new OS have not yet happen. When attempting to install modules that use
clang
for compilation, the following error is thrown:clang: error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=11.0'
Currently running:
- Mac OS Big Sur, 11.0 Beta
- Intel CPU (i386)
- Python 3.8.0 installed via
pyenv
Multiple modules have
clang
dependencies, and so it seems this error is quite common. An example:pip install multidict
Installing older versions of Command Line Tools (e.g. 11.5) does not work as well.
解决方案Figure out the issue on my end.
Previously I had installed
XCode
from the App Store (11.7) and set its SDKs as my default:sudo xcode-select --switch /Applications/Xcode.app/
However, it seems this come with an unsupported version of
clang
:λ clang --version Apple clang version 11.0.3 (clang-1103.0.32.62) Target: x86_64-apple-darwin20.1.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Setting the
xcode-select
to the latest version via:sudo xcode-select --switch /Library/Developer/CommandLineTools
EDIT (11/15/2020)
You might receive an error when attempting the above change:
xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools'
To fix this, you must install the latest Command Line Tools from the official Apple website here. At the time of writting this edit, I installed the Command Line Tools for Xcode 12.3 beta.
Changes
clang
to a working version:λ clang --version Apple clang version 12.0.0 (clang-1200.0.32.2) Target: x86_64-apple-darwin20.1.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin
The built-in Big Sur SDK is version
10.15
, which seems to work without an issue:λ ls /Library/Developer/CommandLineTools/SDKs MacOSX.sdk MacOSX10.15.sdk
After the switch,
multidict
was installed successfully.λ pip install multidict Collecting multidict Downloading multidict-4.7.6-cp38-cp38-macosx_10_14_x86_64.whl (48 kB) |████████████████████████████████| 48 kB 589 kB/s Installing collected packages: multidict Successfully installed multidict-4.7.6
Further investigation seems to indicate this is a design choice by Apple (source):
Therefore, ensuring your SDK is the default out-of-the-box as opposed to XCode's new SDK should be enough for the system to switch context when needed (and seems to work fine with
pip
+clang
).这篇关于Big Sur lang语“无效版本"由于MACOSX_DEPLOYMENT_TARGET而导致的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!