【发布时间】:2014-05-15 16:31:10
【问题描述】:
我正在尝试安装 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 相关?)。
【问题讨论】:
-
我刚才遇到了类似的错误。我似乎已经修复了它,所以这可能会对你有所帮助。我通过自制软件安装了 gcc46。这似乎是我问题的根源。我卸载了它并安装了 apple-gcc42,现在一切似乎都正常了。不过,我建造的东西和你不一样。
-
命令行工具包含在 Xcode 包中。那里有一个 gcc 可执行文件。只需在命令行中尝试
gcc --version即可查看是否有任何结果。我不确定它是否是一个真正的 gcc 编译器,它可能只是 llvm 编译器的别名。 -
通过 brew 安装 apple-gcc42 为我解决了这个问题。谢谢!
-
好的。那行得通。除了需要更新的编译器的东西......例如,我们如何编译 libv8? 4.2 好像不行。
-
不要运行
configure和sudo...你在想什么?
标签: macos gcc xcode5 osx-mavericks texinfo