昨晚(2018年11月)我更新到macOS Mojave,
今天早上我在MacBook pro的Command line中导航到我的工作代码库,
在repo中键入"git status"并收到错误:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Run Code Online (Sandbox Code Playgroud) 在使用XCode 6.0.1的OS X 10.9.5下,当我尝试make从终端运行时,我遇到了以下问题:
fatal error: 'wchar.h' file not found
Run Code Online (Sandbox Code Playgroud)
最近升级到Mavericks之前没有发生过这个问题.
升级到Mojave后,还有一个问题不能在Mac上编译C程序,而该问题的答案已涵盖了发生问题的大多数变体。
现在-从2019年10月7日星期一开始-您可以升级到macOS Catalina 10.15。再次,在升级过程中/usr/include,即使在从Mojave 10.14.6升级到Catalina之前安装了XCode 11.0 ,该目录也被更新所破坏。因此,编译器期望没有/usr/include目录就不再起作用。
建议的解决Mojave问题的主要步骤-使用以下命令:
Run Code Online (Sandbox Code Playgroud)open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
由于目录/Library/Developer/CommandLineTools/Packages/不存在(因此尚无.pkg要打开的文件),因此无法正常工作。
有没有一种好的(官方)方法来创建和填充目录/usr/include?
在重新安装OS X 10.14 Mojave和XCode命令行工具之后,我正在尝试为旧项目安装旧的gem版本.我正在尝试安装的gem是scrypt,版本1.2.1,这是authlogic的依赖.
gem install scrypt -v = 1.2.1
返回以下错误:
Building native extensions. This could take a while...
ERROR: Error installing scrypt:
ERROR: Failed to build gem native extension.
current directory: /Users/chris/.rvm/gems/ruby-2.4.4@rails5/gems/scrypt-1.2.1/ext/scrypt
/Users/chris/.rvm/rubies/ruby-2.4.4/bin/ruby -rrubygems /Users/chris/.rvm/gems/ruby-2.4.4@global/gems/rake-12.0.0/exe/rake RUBYARCHDIR=/Users/chris/.rvm/gems/ruby-2.4.4@rails5/extensions/x86_64-darwin-18/2.4.0/scrypt-1.2.1 RUBYLIBDIR=/Users/chris/.rvm/gems/ruby-2.4.4@rails5/extensions/x86_64-darwin-18/2.4.0/scrypt-1.2.1
mkdir -p x86_64-darwin
gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -msse -msse2 -arch x86_64 -arch i386 -o x86_64-darwin/crypto_scrypt-sse.o -c ./crypto_scrypt-sse.c
gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -msse -msse2 -arch x86_64 -arch i386 -o x86_64-darwin/memlimit.o -c ./memlimit.c
gcc -fexceptions -O -fno-omit-frame-pointer -fno-strict-aliasing -Wall -msse …Run Code Online (Sandbox Code Playgroud) 在Mac OS X上安装mysql gem需要什么?我收到错误"无法构建原生扩展".
我知道这个问题:macOS'wchar.h'文件未找到, 但它没有帮助我.我尝试重新安装xcode,重新安装命令行工具,重新启动系统.wchar.h文件已就绪,但编译器无法找到它.我还能尝试什么?也许它与sysroot有关?有办法解决这个问题吗?
macbooks-MacBook-Pro:Rack euphorbium$ sudo make
c++ -Iinclude -Idep/include -Idep/lib/libzip/include -DVERSION=dev -MMD -O3 -march=core2 -ffast-math -g -Wall -DARCH_MAC -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -DAPPLE -stdlib=libc++ -std=c++11 -stdlib=libc++ -c -o build/src/app.cpp.o src/app.cpp
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk' [-Wmissing-sysroot]
In file included from src/app.cpp:1:
In file included from include/app.hpp:2:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/vector:265:
In file included from /Library/Developer/CommandLineTools/usr/include/c++/v1/iosfwd:90:
/Library/Developer/CommandLineTools/usr/include/c++/v1/wchar.h:119:15: fatal error:
'wchar.h' file not found
#include_next <wchar.h>
^~~~~~~~~
1 error generated.
make: *** [build/src/app.cpp.o] Error 1
Run Code Online (Sandbox Code Playgroud)
因为wchar.h同时存在于xcode应用程序中,并且/Library/Developer/CommandLineTools我认为它在一些完全不相关的文件夹中查找它.
在OSX上,当我使用外部提供的编译器(例如gcc-4.8)时,我无法从命令行编译简单程序.limits.h无法找到系统标头.
示例错误消息:
fatal error: limits.h: No such file or directory
Run Code Online (Sandbox Code Playgroud)
要么:
fatal error: stdio.h: No such file or directory
Run Code Online (Sandbox Code Playgroud)
等等.
怎么了?
我对MacOS环境还很陌生,以前在编译C脚本时遇到一些问题。我有以下问题:
fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
Run Code Online (Sandbox Code Playgroud)
我尝试重新安装,xcode-select --install但一直告诉我
xcode-select:错误:命令行工具已经安装,请使用“软件更新”来安装更新
我什么都没更新。显然是因为我没有/usr/includes文件。我找到了一种使用来编译软件的方法
/Library/Developer/CommandLineTools/usr/bin/g++ XXXX.cpp
不过,现在我想./compile和make其他软件,但我不知道如何在默认情况下使用该GCC解释。当我尝试./configure时出现此错误
配置:错误:无法运行C编译程序。如果您打算交叉编译,请使用'--host'。有关更多详细信息,请参见“ config.log”
所以当我调查config.log:
configure:3224: checking for gcc
configure:3240: found /usr/local/bin/gcc
configure:3251: result: gcc
configure:3282: checking for C compiler version
configure:3291: gcc --version >&5
gcc (GCC) 4.9.2 20141029 (prerelease)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 macOS 上从源代码安装 Riak ( https://docs.riak.com/riak/kv/2.2.3/setup/installing/mac-osx.1.html#installing-from-source )。
有一个注释:
Riak 不会使用 Clang 进行编译。请确保您的默认 C/C++ 编译器是 GCC
如何找出默认编译器以及如何更改它?
macOS Catalina (10.15.4),该命令打印:
$ which clang
/usr/bin/clang
$ which gcc
/usr/bin/gcc
Run Code Online (Sandbox Code Playgroud) 我正在使用Mac版本10.13.6。
我想通过终端编译C程序。我已经下载了Xcode和命令行工具。当我clang --version在终端中键入时,收到以下两个错误消息:
clang:错误:无法找到xcodebuild,请确保正确设置了Xcode文件夹的路径!
clang:错误:您可以使用/ usr / bin / xcode-select -switch设置Xcode文件夹的路径
我做了一些谷歌搜索,然后在这里找到了解决方法。解决方案是在终端中运行以下行:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
我做到了 但是当我clang --version这样做之后进入时,我会得到完全相同的两个错误。这是怎么回事?
注意:这是非常新的内容,因此在回答时请记住这一点!干杯