Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
634 views
in Technique[技术] by (71.8m points)

macos - OS X 10.9.2: checking whether the C compiler works... no

I'm attempting to install texinfo 5.2, and I'm running into some issues during ./configure, which I believe are related to the C compiler. When I upgraded from Snow Leopard, I didn't perform a clean install, so perhaps that's part of the problem. Anyway, here's what I've got:

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

I've read some of the other questions related to this, so I attempted to install Command Line Tools.

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

So it seems they're not installed, although I'm running Xcode 5.1 installed from the App Store. From what I've read, Command Line Tools should be installed, but I've tried

$ xcode-select --install

anyway, and when I tell it to install, a message pops up saying "Can't install software because it is not currently available from the Software Update server."

I found what I thought might be a work-around at http://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/, so I did the following:

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

But I still have the ./configure issue.

For reference,

$ 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

Although I did attempt to install gcc-4.7 the other day, and it's currently living at

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

I'm not quite sure how to get it to run as a command from the command line because

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

is what I'm getting now, but that may be neither here nor there.

edit: Since this doesn't directly answer my question about checking whether the C compiler works, I'm not submitting this as an answer. I just tried brew install texinfo, and that worked like a charm. At this point, I can't really remember why I was trying to install texinfo from source nor can I remember what I needed it for (maybe something GNU Make-related or Emacs-related?).

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I faced this same problem after installing xcode; All I had to do was run gcc. This then asked me to accept the xcode license. After, it just worked fine.

Hope this helps someone.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...