title: OSX Mavericks C compiler not working (linker command failed)
body: <p>A while ago I installed osx-gcc-installer. It hasn't been an issue until I tried to install opencv with homebrew. Brew doctor complained about osx-gcc-installer so I uninstalled command line tools, xcode and every sign of osx-gcc-installer.</p>
  
  <p>Now when I install xcode again as well as the command line tools I keep getting the same errors. Here is the output of trying to install webp (which my brew doctor says I need). Any help is much appreciated:</p>
  
  <p>terminal output</p>
  
  <pre><code>checking for gcc... clang
  checking whether the C compiler works... no
  configure: error: in `/private/tmp/webp-Rsgs/libwebp-0.4.0':
  configure: error: C compiler cannot create executables
  See `config.log' for more details
  </code></pre>
  
  <p>And the config.log</p>
  
  <pre><code>This file contains any messages produced by compilers while
  running configure, to aid debugging if configure makes a mistake.
  
  It was created by libwebp configure 0.4.0, which was
  generated by GNU Autoconf 2.68.  Invocation command line was
  
    $ ./configure --disable-dependency-tracking --enable-libwebpmux --enable-libwebpdemux --enable-libwebpdecoder --prefix=/usr/local/Cellar/webp/0.4.0_1
  
  ## --------- ##
  ## Platform. ##
  ## --------- ##
  
  hostname = Jons-MacBook-Pro.local
  uname -m = x86_64
  uname -r = 13.2.0
  uname -s = Darwin
  uname -v = Darwin Kernel Version 13.2.0: Thu Apr 17 23:03:13 PDT 2014; root:xnu-2422.100.13~1/RELEASE_X86_64
  
  /usr/bin/uname -p = i386
  /bin/uname -X     = unknown
  
  /bin/arch              = unknown
  /usr/bin/arch -k       = unknown
  /usr/convex/getsysinfo = unknown
  /usr/bin/hostinfo      = Mach kernel version:
       Darwin Kernel Version 13.2.0: Thu Apr 17 23:03:13 PDT 2014; root:xnu-2422.100.13~1/RELEASE_X86_64
  Kernel configured for up to 4 processors.
  2 processors are physically available.
  4 processors are logically available.
  Processor type: i486 (Intel 80486)
  Processors active: 0 1 2 3
  Primary memory available: 8.00 gigabytes
  Default processor set: 170 tasks, 947 threads, 4 processors
  Load average: 1.66, Mach factor: 2.32
  /bin/machine           = unknown
  /usr/bin/oslevel       = unknown
  /bin/universe          = unknown
  
  PATH: /usr/local/Library/ENV/4.3
  PATH: /usr/local/opt/libpng/bin
  PATH: /usr/local/opt/jpeg/bin
  PATH: /usr/bin
  PATH: /bin
  PATH: /usr/sbin
  PATH: /sbin
  
  
  ## ----------- ##
  ## Core tests. ##
  ## ----------- ##
  
  configure:2296: checking build system type
  configure:2310: result: x86_64-apple-darwin13.2.0
  configure:2330: checking host system type
  configure:2343: result: x86_64-apple-darwin13.2.0
  configure:2363: checking target system type
  configure:2376: result: x86_64-apple-darwin13.2.0
  configure:2418: checking for a BSD-compatible install
  configure:2486: result: /usr/bin/install -c
  configure:2497: checking whether build environment is sane
  configure:2547: result: yes
  configure:2688: checking for a thread-safe mkdir -p
  configure:2727: result: ./install-sh -c -d
  configure:2740: checking for gawk
  configure:2770: result: no
  configure:2740: checking for mawk
  configure:2770: result: no
  configure:2740: checking for nawk
  configure:2770: result: no
  configure:2740: checking for awk
  configure:2756: found /usr/bin/awk
  configure:2767: result: awk
  configure:2778: checking whether make sets $(MAKE)
  configure:2800: result: yes
  configure:2893: checking for style of include used by make
  configure:2921: result: GNU
  configure:2992: checking for gcc
  configure:3019: result: clang
  configure:3248: checking for C compiler version
  configure:3257: clang --version &gt;&amp;5
  Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
  Target: x86_64-apple-darwin13.2.0
  Thread model: posix
  configure:3268: $? = 0
  configure:3257: clang -v &gt;&amp;5
  Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
  Target: x86_64-apple-darwin13.2.0
  Thread model: posix
  configure:3268: $? = 0
  configure:3257: clang -V &gt;&amp;5
  clang: error: unsupported option '-V -isystem/usr/local/include'
  configure:3268: $? = 1
  configure:3257: clang -qversion &gt;&amp;5
  clang: error: unknown argument: '-qversion' [-Wunused-command-line-argument-hard-error-in-future]
  clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
  configure:3268: $? = 1
  configure:3288: checking whether the C compiler works
  configure:3310: clang    conftest.c  &gt;&amp;5
  ld: entry point (start) undefined.  Usually in crt1.o for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  configure:3314: $? = 1
  configure:3352: result: no
  configure: failed program was:
  | /* confdefs.h */
  | #define PACKAGE_NAME "libwebp"
  | #define PACKAGE_TARNAME "libwebp"
  | #define PACKAGE_VERSION "0.4.0"
  | #define PACKAGE_STRING "libwebp 0.4.0"
  | #define PACKAGE_BUGREPORT "http://code.google.com/p/webp/issues"
  | #define PACKAGE_URL "http://developers.google.com/speed/webp"
  | #define PACKAGE "libwebp"
  | #define VERSION "0.4.0"
  | /* end confdefs.h.  */
  | 
  | int
  | main ()
  | {
  | 
  |   ;
  |   return 0;
  | }
  configure:3357: error: in `/private/tmp/webp-Rsgs/libwebp-0.4.0':
  configure:3359: error: C compiler cannot create executables
  See `config.log' for more details
  
  ## ---------------- ##
  ## Cache variables. ##
  ## ---------------- ##
  
  ac_cv_build=x86_64-apple-darwin13.2.0
  ac_cv_env_CC_set=set
  ac_cv_env_CC_value=clang
  ac_cv_env_CFLAGS_set=
  ac_cv_env_CFLAGS_value=
  ac_cv_env_CPPFLAGS_set=
  ac_cv_env_CPPFLAGS_value=
  ac_cv_env_CPP_set=
  ac_cv_env_CPP_value=
  ac_cv_env_LDFLAGS_set=
  ac_cv_env_LDFLAGS_value=
  ac_cv_env_LIBS_set=
  ac_cv_env_LIBS_value=
  ac_cv_env_build_alias_set=
  ac_cv_env_build_alias_value=
  ac_cv_env_host_alias_set=
  ac_cv_env_host_alias_value=
  ac_cv_env_target_alias_set=
  ac_cv_env_target_alias_value=
  ac_cv_host=x86_64-apple-darwin13.2.0
  ac_cv_path_install='/usr/bin/install -c'
  ac_cv_prog_AWK=awk
  ac_cv_prog_ac_ct_CC=clang
  ac_cv_prog_make_make_set=yes
  ac_cv_target=x86_64-apple-darwin13.2.0
  
  ## ----------------- ##
  ## Output variables. ##
  ## ----------------- ##
  
  ACLOCAL='${SHELL} /private/tmp/webp-Rsgs/libwebp-0.4.0/missing --run aclocal-1.11'
  AMDEPBACKSLASH=''
  AMDEP_FALSE=''
  AMDEP_TRUE='#'
  AMTAR='$${TAR-tar}'
  AM_BACKSLASH=''
  AM_CFLAGS=''
  AM_DEFAULT_V=''
  AM_DEFAULT_VERBOSITY=''
  AM_V=''
  AR=''
  AUTOCONF='${SHELL} /private/tmp/webp-Rsgs/libwebp-0.4.0/missing --run autoconf'
  AUTOHEADER='${SHELL} /private/tmp/webp-Rsgs/libwebp-0.4.0/missing --run autoheader'
  AUTOMAKE='${SHELL} /private/tmp/webp-Rsgs/libwebp-0.4.0/missing --run automake-1.11'
  AWK='awk'
  BUILD_GIF2WEBP_FALSE=''
  BUILD_GIF2WEBP_TRUE=''
  BUILD_LIBWEBPDECODER_FALSE=''
  BUILD_LIBWEBPDECODER_TRUE=''
  BUILD_VWEBP_FALSE=''
  BUILD_VWEBP_TRUE=''
  CC='clang'
  CCDEPMODE=''
  CFLAGS=''
  CPP=''
  CPPFLAGS=''
  CYGPATH_W='echo'
  DEFS=''
  DEPDIR='.deps'
  DLLTOOL=''
  DSYMUTIL=''
  DUMPBIN=''
  ECHO_C='\c'
  ECHO_N=''
  ECHO_T=''
  EGREP=''
  EXEEXT=''
  FGREP=''
  GIF_INCLUDES=''
  GIF_LIBS=''
  GL_INCLUDES=''
  GL_LIBS=''
  GREP=''
  INSTALL_DATA='${INSTALL} -m 644'
  INSTALL_PROGRAM='${INSTALL}'
  INSTALL_SCRIPT='${INSTALL}'
  INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
  JPEG_INCLUDES=''
  JPEG_LIBS=''
  LD=''
  LDFLAGS=''
  LIBOBJS=''
  LIBPNG_CONFIG=''
  LIBS=''
  LIBTOOL=''
  LIPO=''
  LN_S=''
  LTLIBOBJS=''
  MAKEINFO='${SHELL} /private/tmp/webp-Rsgs/libwebp-0.4.0/missing --run makeinfo'
  MANIFEST_TOOL=''
  MKDIR_P='./install-sh -c -d'
  NM=''
  NMEDIT=''
  OBJDUMP=''
  OBJEXT=''
  OTOOL64=''
  OTOOL=''
  PACKAGE='libwebp'
  PACKAGE_BUGREPORT='http://code.google.com/p/webp/issues'
  PACKAGE_NAME='libwebp'
  PACKAGE_STRING='libwebp 0.4.0'
  PACKAGE_TARNAME='libwebp'
  PACKAGE_URL='http://developers.google.com/speed/webp'
  PACKAGE_VERSION='0.4.0'
  PATH_SEPARATOR=':'
  PNG_INCLUDES=''
  PNG_LIBS=''
  PTHREAD_CC=''
  PTHREAD_CFLAGS=''
  PTHREAD_LIBS=''
  RANLIB=''
  SED=''
  SET_MAKE=''
  SHELL='/bin/sh'
  STRIP=''
  TIFF_INCLUDES=''
  TIFF_LIBS=''
  USE_EXPERIMENTAL_CODE=''
  USE_SWAP_16BIT_CSP=''
  VERSION='0.4.0'
  WANT_DEMUX_FALSE=''
  WANT_DEMUX_TRUE=''
  WANT_MUX_FALSE=''
  WANT_MUX_TRUE=''
  ac_ct_AR=''
  ac_ct_CC='clang'
  ac_ct_DUMPBIN=''
  am__EXEEXT_FALSE=''
  am__EXEEXT_TRUE=''
  am__fastdepCC_FALSE=''
  am__fastdepCC_TRUE=''
  am__include='include'
  am__isrc=''
  am__leading_dot='.'
  am__nodep=''
  am__quote=''
  am__tar='$${TAR-tar} chof - "$$tardir"'
  am__untar='$${TAR-tar} xf -'
  ax_pthread_config=''
  bindir='${exec_prefix}/bin'
  build='x86_64-apple-darwin13.2.0'
  build_alias=''
  build_cpu='x86_64'
  build_os='darwin13.2.0'
  build_vendor='apple'
  datadir='${datarootdir}'
  datarootdir='${prefix}/share'
  docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
  dvidir='${docdir}'
  exec_prefix='NONE'
  host='x86_64-apple-darwin13.2.0'
  host_alias=''
  host_cpu='x86_64'
  host_os='darwin13.2.0'
  host_vendor='apple'
  htmldir='${docdir}'
  includedir='${prefix}/include'
  infodir='${datarootdir}/info'
  install_sh='${SHELL} /private/tmp/webp-Rsgs/libwebp-0.4.0/install-sh'
  libdir='${exec_prefix}/lib'
  libexecdir='${exec_prefix}/libexec'
  localedir='${datarootdir}/locale'
  localstatedir='${prefix}/var'
  mandir='${datarootdir}/man'
  mkdir_p='$(top_builddir)/./install-sh -c -d'
  oldincludedir='/usr/include'
  pdfdir='${docdir}'
  pkgconfigdir=''
  prefix='/usr/local/Cellar/webp/0.4.0_1'
  program_transform_name='s,x,x,'
  psdir='${docdir}'
  sbindir='${exec_prefix}/sbin'
  sharedstatedir='${prefix}/com'
  sysconfdir='${prefix}/etc'
  target='x86_64-apple-darwin13.2.0'
  target_alias=''
  target_cpu='x86_64'
  target_os='darwin13.2.0'
  target_vendor='apple'
  </code></pre>
  
  <p>EDIT:
  After some more investigating I think I might have an issue with my /usr/bin/ld:</p>
  
  <pre><code>$ /usr/bin/ld
  ld: warning: -arch not specified
  ld: warning: -macosx_version_min not specificed, assuming 10.7
  ld: no object files specified for inferred architecture x86_64
  </code></pre>
  
  <p>Operating Systems isn't my strong suit so i might be off topic. Hoping this helps someone with more OS knowledge.</p>
  
  <p>EDIT2:</p>
  
  <p>Attempting to compile the test code from the config.log output results in the following:</p>
  
  <pre><code>jon$ clang -o test ~/Desktop/test.c -v
      Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
      Target: x86_64-apple-darwin13.2.0
      Thread model: posix
       "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name test.c -mrelocation-model pic -pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 236.3 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1 -fdebug-compilation-dir /usr/bin -ferror-limit 19 -fmessage-length 116 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0 -fencode-extended-block-signature -fdiagnostics-show-option -fcolor-diagnostics -vectorize-slp -o /var/folders/5s/5jxchdtd3pvc09rwdt4n2nfw0000gn/T/test-309e3a.o -x c /Users/jon/Desktop/test.c
      clang -cc1 version 5.1 based upon LLVM 3.4svn default target x86_64-apple-darwin13.2.0
      #include "..." search starts here:
      #include &lt;...&gt; search starts here:
       /usr/local/include
       /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/include
       /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
       /usr/include
       /System/Library/Frameworks (framework directory)
       /Library/Frameworks (framework directory)
      End of search list.
       "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.9.0 -o test /var/folders/5s/5jxchdtd3pvc09rwdt4n2nfw0000gn/T/test-309e3a.o -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/lib/darwin/libclang_rt.osx.a
      ld: can't open output file for writing: test, errno=13 for architecture x86_64
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
  
  jon$ gcc -o test ~/Desktop/test.c 
  ld: can't open output file for writing: test, errno=13 for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  jon$ 
  </code></pre>