Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?).

like image 569
Ryan M Avatar asked Apr 03 '14 17:04

Ryan M


People also ask

How do I know if C compiler is installed on my Mac?

The name of the C compiler (that was installed along with the command line tools) is gcc. To check that this is now successfully installed, enter "gcc --version" at the prompt.

Does macOS have C compiler?

Xcode) to write C code and a compiler to compile the written code. C code can be compiled by different compilers like clang, gcc, llvm, and CDT plugin of Eclipse in Mac. Mac C compilers compile C code and creates an executable file (.exe) that can be run directly.

What is default C compiler on Mac?

Clang, the default compiler for macOS, supports only C, C++, Objective-C and Objective-C++.

How do I run C executable on Mac?

To run the C program in MacOS we need a code editor and code compiler. The Code editor is used to write source code while the code compiler converts the source code into executable files. To write the source code Microsoft Visual Studio Code is used while to convert it into executable files we use command-line tools.


1 Answers

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.

like image 105
GeneralBecos Avatar answered Sep 26 '22 01:09

GeneralBecos