Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac OS Sierra: checking whether the C compiler works... no

I want to compile a C library on my MacOS Sierra system, but I am getting the following error:

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 for gcc... clang
checking whether the C compiler works... no
configure: error: in `/Users/macuser/Downloads/libr':
configure: error: C compiler cannot create executables

I tried setting the symlink as suggested in OS X 10.9.2: checking whether the C compiler works... no :

sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeD‌​efault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.‌​11.xctoolchain

I tried setting the CC path and install xcode as in https://apple.stackexchange.com/questions/216573/cant-compile-source-code-on-mac :

export CC=clang
xcode-select --install

and accept the license. But nothing worked. Are there any new steps to consider on Sierra to get the command line tools running properly?

like image 261
user2212461 Avatar asked Nov 08 '16 14:11

user2212461


1 Answers

Start Xcode, select 'Preferences', then 'Locations'. You'll notice a dropdown control at 'Command Line Tools'. Select the newest version, close the dialog window, then call brew again. Restart your computer and run it again.

like image 167
morrislaptop Avatar answered Sep 22 '22 16:09

morrislaptop