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

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

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.

I can't really take credit for the answer, but the same things happened to me. I tried to get a ruby-1.9.3 ruby. RVM grabed gcc46 and told homebrew to install it. But then the rvm install command didn't like that. So brew uninstall gcc46 and then brew install apple-gcc42 worked like a charm.

For me the issue was I had not run
xcode-select --install
Once I did that everything ran fine

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

I encountered this while setting up a React Native project. This solution worked.
sudo xcode-select --switch /Applications/Xcode.app

sudo gcc --version
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

I had similar "checking whether the C compiler works... no" problem in my yosemite mac.
I checked some things:
$ 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.
Then I installed it doing:
$ 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
....
And it worked:
$ 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

Similar problem while installing python3. My home brew was out dated. I simply update my home brew utility.

I faced a similar problem but my situation was different.
I had the Xcode with spaces in the app name removing those spaces fixed the problem:
sudo xcode-select --switch /Applications/Xcode14.0.app

Related

gcc-11 from Homebrew Not Found by MacOS - installation and $PATH seem OK

I'm trying to compile a package called Kraken on my M1 Mac running Big Sur.
MacOS fails to compile: clang gets upset. I installed gcc from Homebrew (twice) and $ brew doctor says I'm ready to go.
My path is now:
/usr/local/opt/llvm/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/opt/homebrew/bin.
The gcc-11 etc files exist at /opt/homebrew/bin
But /usr/local/bin does not exist!
MacOS does not update the command alias for gcc:
$ rm gcc
then
$ ln -s /opt/homebrew/bin/gcc-11 gcc
return no error
but then
$ which gcc
returns
/usr/bin/gcc
I'm lost and gather this compiler-pointing has been a mess; is there any new insight here? I've seen a bunch of entries but nothing I've tried has worked.
Hoping this is a stupid newbie (me) problem, I thank you for any help you can give.
Michael
Homebrew avoids linking binaries with the same name as system binaries like gcc(appleclang). ln -s /opt/homebrew/bin/gcc-11 /opt/homebrew/bin/gcc or tell your configurator to explicitly use gcc-11 via CC= etc. and the same for g++-11 if C++ is used.
If it's a ./configure script, you can try calling CC=/opt/homebrew/bin/gcc-11 CXX=/opt/homebrew/bin/g++-11 ./configure
if cmake then use cmake .. -DCMAKE_C_COMPILER=/opt/homebrew/bin/gcc-11 -DCMAKE_CXX_COMPILER=/opt/homebrew/gcc++-11
Also, try seeing where the homebrew gcc link points ls -l /opt/homebrew/bin/gcc

Installing valgrind on Mac OS X Catalina [duplicate]

I tried to install Valgrind with the command "brew install valgrind" and I get a message that says:
"valgrind: This formula either does not compile or function as expected on macOS versions newer than Sierra due to an upstream incompatibility. Error: An unsatisfied requirement failed this build."
I also tried to "brew edit valgrind" and replace "sourceware.org/git/valgrind.git" with "git://sourceware.org/git/valgrind.git" in head section of the code, then wrote on Iterm "brew install --HEAD valgrind" but it gives me:
Last 15 lines from /Users/m/Library/Logs/Homebrew/valgrind/02.configure:
checking for gcc-ar... no
checking for perl... /usr/bin/perl
checking for gdb... /no/gdb/was/found/at/configure/time
checking dependency style of clang... none
checking for diff -u... yes
checking for clang option to accept ISO C99... none needed
checking for a supported version of gcc... ok (clang-11.0.0)
checking build system type... x86_64-pc-darwin
checking host system type... x86_64-pc-darwin
checking for a supported CPU... ok (x86_64)
checking for a 64-bit only build... yes
checking for a 32-bit only build... no
checking for a supported OS... ok (darwin)
checking for the kernel version... unsupported (19.0.0)
configure: error: Valgrind works on Darwin 10.x, 11.x, 12.x, 13.x, 14.x, 15.x, 16.x and 17.x (Mac OS X 10.6/7/8/9/10/11 and macOS 10.12/13)
READ THIS: https://docs.brew.sh/Troubleshooting
See https://github.com/LouisBrunner/valgrind-macos/.
Either try
brew tap LouisBrunner/valgrind
brew install --HEAD LouisBrunner/valgrind/valgrind
Or compile it from the source, if the above method doesn't work. (But they should have fixed the above method just recently.)
git clone https://github.com/LouisBrunner/valgrind-macos.git
cd valgrind-macos
./autogen.sh
./configure --prefix=/where/you/want/it/installed --enable-only64bit
make
sudo make install
Enjoy!
https://github.com/sowson/valgrind
brew install --HEAD https://raw.githubusercontent.com/sowson/valgrind/master/valgrind.rb
MacOS Catalina (10.15.4), I was able to confirm the operation.

CentOS 7 Upgraded gcc / g++ but can't seem to use it?

I used the script to upgrade gcc/g++ to v5.4. The script ran successfully and the new libraries were supposedly installed to /usr/lib64
Still, when I gcc --version it tells me its 4.8.5 still. There is no gcc directory in /usr/lib64 and the one in /usr/lib only contains a gcc directory folder for 4.8.5
Any help is appreciated!!
Perhaps it's an issue with creating a symbolic link to gcc-4.8
cd /usr/bin
sudo rm gcc
sudo ln -s gcc-4.8 gcc
then test
gcc --version
And see if you got it. If not, you can
sudo yum remove path/packageName
and reinstall

No gcc4 in Cygwin's package list

I had to use NS-2 on Windows. Thus, I've installed Cygwin and downloaded NS-2 source and run ./install then it says
Cygwin detected
Note: Cygwin install is still considered EXPERIMENTAL
Checking Cygwin version is >= 1.7.1... 1.7.27 (should be ok)
Checking filesystems are mounted as UNIX filetype... yes
Checking default mode is binmode... yes
Checking legitimate login name... ok
Checking legitimate path name... ok
Checking for gcc4... NO!
There are packages in Cygwin that seem to be related to gcc4
cygwin64-gcc
gcc
mingw-gcc
mingw64-*-gcc
And all of them have versions >= 4.x
And there are no packages named *gcc4*
The gcc4-* packages are obsolete; gcc-* now provides version 4.x of the compiler. You'll need to patch this script to check e.g. gcc -dumpversion instead of a specific package name.
I've performed the commands below in CygWin and managed to fix the issue.
cd /bin
ln -s gcc.exe gcc-4
ln -s gcc.exe gcc-3
ln -s gcc.exe 'g++-4'
gcc is backwards compatible, so simlinking gcc-4 to gcc and g++ to g++-4 will get you exactly what you need.

Mac OS X Lion Xcode problems using RVM

I had Xcode 4.1 preview 5 working fine but decided to upgrade to the final xcode 4.1 thru the App store. I uninstalled Xcode first...
sudo /Developer/Library/uninstall-devtools –mode=all
Then installed Xcode thru the app store and rebooted.
I also removed RVM completely but... now whenever I try and install a version of Ruby it fails. In the error file i get this:
[2011-07-27 18:29:25] ./configure --prefix="/Users/holden/.rvm/usr"
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... config/install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... no
checking for gcc... /usr/bin/gcc-4.2
checking whether the C compiler works... no
configure: error: in `/Users/holden/.rvm/src/yaml-0.1.4':
configure: error: C compiler cannot create executables
See `config.log' for more details
There is no gcc-4.2 or any other gcc in the /usr/bin directory.
What's up with Xcode?
Apparently even after downloading and "installing" XCode from the Appstore and despite the long process after downloading where it appears to install it and the words "Installed" eventually become displayed next to it in the store. You must still manually install it again within your applications folder before it will work.
Odd.
Just bought a Mac,
what I had to do to make it work after installing Xcode and seeing that /usr/bin doesn't have gcc, was:
Enter Xcode preferences going over to the downloads tab and install Command Line Tools.
After setting up my developer account and downloading the tools I opened terminal and typed
rvm install 1.9.3 --with-gcc=clang
and everything compiled and works.
Note - after running "Install Xcode" I still only have "gcc" in /usr/bin, not gcc-4.2. But still worked fine, /usr/bin/gcc was a symlink to /usr/bin/llvm-gcc-4.2
Guy's answer above seems to fix the problem compiling Ruby in RVM with XCode 4.2 installed completely, and removed for me to install GCC from https://github.com/kennethreitz/osx-gcc-installer . This is preferable for users needing to have both RVM and XCode 4.2 installed.

Resources