我正在尝试安装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

这就是我现在要得到的,但这可能不在这里或那里。

编辑:因为这不能直接回答我有关检查C编译器是否正常工作的问题,所以我没有将其提交为答案。我刚刚尝试了brew install texinfo,它就像一个魅力。在这一点上,我真的不记得为什么我试图从源代码安装texinfo,也不记得我需要什么(也许是GNU Make相关的或Emacs相关的?)。

最佳答案

安装xcode后,我也遇到了同样的问题;我要做的就是运行gcc。然后,这要求我接受xcode许可证。之后,它运行良好。

希望这对某人有帮助。

07-27 13:21