本文介绍了通过Homebrew的MacOS叮当声在Mojave`wchar.h`下破裂的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不足为奇的是,OSX Mojave的新更新中断了我在Homebrew中的llvm安装,这些是我尝试的步骤:

Unsurprisingly the new update of OSX Mojave broke my llvm installation in Homebrew, these are the steps I tried:

xcode-select --install # Complained, so I installed commandLineTools from here https://developer.apple.com/download/more/
xcode-select -p /Library/Developer/CommandLineTools
xcode-select --install # Now says installed
sudo xcodebuild -license # Fails, as it says I only have CommandLineTools installed in /Library/Developer/CommandLineTools not xcode

# Try something else (all versions)
brew uninstall --force llvm
brew install llvm # yay v7 how exciting

# Only it still don't work
clang++ -std=c++17 foo.cpp -o f
In file included from foo.cpp:1:
In file included from /usr/local/Cellar/llvm/7.0.0/include/c++/v1/iostream:38:
In file included from /usr/local/Cellar/llvm/7.0.0/include/c++/v1/ios:215:
In file included from /usr/local/Cellar/llvm/7.0.0/include/c++/v1/iosfwd:90:
/usr/local/Cellar/llvm/7.0.0/include/c++/v1/wchar.h:119:15: fatal error: 'wchar.h' file not found
#include_next <wchar.h>
              ^~~~~~~~~
1 error generated.

有什么想法吗?我尝试在网上找到的上半部分内容,但主要是用于MacOS的较旧更新,也许Mojave以一种新的且不可预测的方式破坏了这些内容.

Any ideas? The first half of the things I tried I found online but mostly for older updates of MacOS, maybe Mojave broke things in a new and unpredictable way.

推荐答案

考虑到我有书面截止日期,这是我解决的方法,这是我最少的担心:

Here's how I solved it, given I have paper deadlines and this is the least of my worries:

  1. 在Mac上禁用了SIP
  2. 在POSIX环境中,
  3. /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include链接到/usr/include.
  4. 重新启用SIP.
  1. Disabled SIP on my Mac
  2. Symlinked /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include to /usr/include as is expected in POSIX environments.
  3. Re-enabled SIP.

现在,每次新的OSX更新发布时,我都必须记下重新进行此操作.这并没有破坏Xcode,clang(来自brew)等任何东西,所以我会保留它.但请注意,这可能会损坏您的东西.

Now I got to make a note to re-do this everytime a new OSX update comes out. This has not broken anything wrt Xcode, clang (from brew) etc so I'll keep it. Be advised though, this might break your stuff.

这篇关于通过Homebrew的MacOS叮当声在Mojave`wchar.h`下破裂的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 00:26