gcc 操作系统X 10.9.2:检查C编译器是否正常工作...否

ubbxdtey  于 2022-11-12  发布在  其他
关注(0)|答案(9)|浏览(369)

我正在尝试安装texinfo 5.2,在运行./configure时遇到了一些问题,我认为这些问题与C编译器有关。当我从Snow Leopard升级时,我没有执行干净安装,所以这可能是问题的一部分。无论如何,我得到了以下结果:

ryansmacbook:texinfo-5.2 ryan$ sudo ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64"                  CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64"                  CPP="gcc -E" CXXCPP="g++ -E"
Password:
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/gmkdir -p
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether UID '0' is supported by ustar format... yes
checking whether GID '0' is supported by ustar format... yes
checking how to create a ustar tar archive... gnutar
checking for perl... /usr/bin/perl
checking Perl version and Encode module... yes
checking for gawk... (cached) awk
checking for gcc... gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64
checking whether the C compiler works... no
configure: error: in `/Users/ryan/Downloads/texinfo-5.2':
configure: error: C compiler cannot create executables
See `config.log' for more details

我已经阅读了与此相关的其他一些问题,因此我尝试安装命令行工具。

ryansmacbook:~ ryan$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

所以看起来它们没有安装,尽管我运行的是从App Store安装的Xcode 5.1。据我所知,命令行工具 * 应该 * 安装,但我已经尝试过了

$ xcode-select --install

无论如何,当我告诉它安装时,会弹出一条消息,说“无法安装软件,因为软件更新服务器当前无法提供该软件”。
我在http://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/中找到了我认为可能的解决方法,因此我执行了以下操作:

ryansmacbook:Tools ryan$ brew install coreutils
Warning: It appears you have MacPorts or Fink installed.
Software installed with other package managers causes known problems for
Homebrew. If a formula fails to build, uninstall MacPorts/Fink and try again.
==> Downloading http://ftpmirror.gnu.org/coreutils/coreutils-8.22.tar.xz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/coreutils/8.22 --program-prefix=g --w
==> make install
==> Caveats
All commands have been installed with the prefix 'g'.

If you really need to use these commands with their normal names, you
can add a "gnubin" directory to your PATH from your bashrc like:

    PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"

Additionally, you can access their man pages with normal names if you add
the "gnuman" directory to your MANPATH from your bashrc as well:

    MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"

/usr/local/share/info/dir: Permission denied
==> Summary
🍺  /usr/local/Cellar/coreutils/8.22: 211 files, 10M, built in 2.4 minutes

但是我仍然有./configure的问题。
作为参考,

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.1.0
Thread model: posix

虽然前几天我确实尝试安装了gcc-4.7,但它目前位于

/usr/gcc-4.7.2/bin/gcc-4.7

我不太清楚如何从命令行将其作为命令运行,因为

$ gcc-4.7 --version
-bash: gcc-4.7: command not found

是我现在得到的,但这可能不是这里也不是那里。
edit:因为这并没有直接回答我关于检查C编译器是否工作的问题,所以我不会提交这个作为答案。我只是尝试了brew install texinfo,它工作得很好。在这一点上,我真的不记得我为什么要从源代码安装texinfo,也不记得我需要它做什么(可能是GNU Make相关的或Emacs相关的?)

hvvq6cgz

hvvq6cgz1#

我在安装xcode后也遇到了同样的问题;我所要做的就是运行GCC。然后它要求我接受XCode许可证。之后,它就工作得很好。
希望这能帮助到一些人。

55ooxyrt

55ooxyrt2#

我真的不能把答案归功于我,但是同样的事情发生在我身上。我试图得到一个ruby-1.9.3 ruby。RVM获取gcc 46并告诉homebrew安装它。但是随后rvm install命令不喜欢这样。所以brew uninstall gcc46brew install apple-gcc42工作得很好。

rwqw0loc

rwqw0loc3#

对我来说,问题是我没有参加
xcode-select --install
一旦我这么做了,一切都好了

inn6fuwd

inn6fuwd4#

sudo ln -s \ 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ \
/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain
tsm1rwdh

tsm1rwdh5#

我在设置React Native项目时遇到了这个问题。这个solution工作正常。

sudo xcode-select --switch /Applications/Xcode.app
wgxvkvu9

wgxvkvu96#

sudo gcc --version

同意Xcode/iOS许可证需要管理员权限,请通过sudo以root用户身份重新运行。

smdncfj3

smdncfj37#

我在我的约塞米蒂Mac中遇到了类似的“检查C编译器是否工作...没有”的问题。
我检查了一些东西:

$ which gcc
gcc: aliased to nocorrect gcc
$ ll /usr/bin/gcc
-rwxr-xr-x  1 root  wheel    14K 27 Sep 04:06 /usr/bin/gcc
$ gcc
gcc: fatal error: no input files
compilation terminated.
$ gcc --version
gcc: warning: couldn't understand kern.osversion '14.0.0
gcc (GCC) 4.8.3
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

然后我安装它做:

$ brew install gcc
Error: You must `brew link cloog' before gcc can be installed
$ brew link cloog
Linking /usr/local/Cellar/cloog/0.18.1... 8 symlinks created
$ brew install gcc
Error: gcc-4.8.3 already installed
To install this version, first `brew unlink gcc'
$ brew unlink gcc
Unlinking /usr/local/Cellar/gcc/4.8.3... 39 symlinks removed
$ brew install gcc
....

它起作用了:

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.51) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
kwvwclae

kwvwclae8#

类似的问题,而安装python3。我的家酿是过时的。我只是更新我的家酿实用程序。

d8tt03nd

d8tt03nd9#

我也面临着类似的问题,但我的情况不同。
我让Xcode的应用程序名称中有空格,删除这些空格修复了问题:

sudo xcode-select --switch /Applications/Xcode14.0.app

相关问题