gcc 4.9.1 in OS X Yosemite - gcc: warning: couldn’t understand kern.osversion ‘14.0.0'

36,744

Solution 1

I had a similar issue when building things from source, and it was because I forgot to install the updated command line tools after upgrading to Yosemite and xcode 6.1. Try this in your command line:

xcode-select --install 

That will download and install the command line tools and may fix your problem.

Solution 2

If you set MACOSX_DEPLOYMENT_TARGET=10.9 in your environment prior to compiling, the shared object linking should work properly.

Solution 3

This was enough for me, and it doesn't require any symlink:

export CC=/Applications/Xcode.app/Contents/Developer/usr/bin/gcc

After that, just run the command as usual.

Solution 4

if you're using Homebrew, simply:

brew upgrade gcc

Solution 5

This solve my problem: I link gcc with /Applications//Xcode.app/Contents/Developer/usr/bin/gcc

cd /usr/local/bin
ln -s /Applications//Xcode.app/Contents/Developer/usr/bin/gcc gcc
Share:
36,744
MMax
Author by

MMax

Updated on February 10, 2020

Comments

  • MMax
    MMax about 4 years

    I install OS X Yosemite and now i have a huge problem with gcc 4.9.1 compiler. I hope some one can help me please.

    I try to compile my program and i have the warning message:

    gcc: warning: couldn’t understand kern.osversion ‘14.0.0'
    

    I search on google and i find https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61407 I try to apply the patch doing:

    sudo patch -p1 < /usr/local/bin/00-darwin-10.10.patch
    

    in gcc folder: /usr/local/bin/gcc and i received the message:

    can't find file to patch at input line 5
    Perhaps you used the wrong -p or --strip option?
    The text leading up to this was:
    --------------------------
    |diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
    |index dd45802..0db14d7 100644
    |--- a/fixincludes/fixincl.x
    |+++ b/fixincludes/fixincl.x
    --------------------------
    File to patch:
    

    in File to patch: i already tried gcc and i received the message:

    patching file gcc
    Hunk #1 FAILED at 1.
    Hunk #2 FAILED at 15.
    Hunk #3 succeeded at 1274 with fuzz 2 (offset -7908 lines).
    Hunk #4 FAILED at 1319.
    Hunk #5 FAILED at 1548.
    Hunk #6 FAILED at 2671.
    patch: **** Can't rename file gcc to gcc.orig : Permission denied
    

    I try with sudo and i received:

    can't find file to patch at input line 5
    Perhaps you used the wrong -p or --strip option?
    The text leading up to this was:
    --------------------------
    |diff --git a/fixincludes/fixincl.x b/fixincludes/fixincl.x
    |index dd45802..0db14d7 100644
    |--- a/fixincludes/fixincl.x
    |+++ b/fixincludes/fixincl.x
    --------------------------
    File to patch: 
    

    I´m in the wrong folder? Anyone can help me?

  • Fralcon
    Fralcon over 9 years
    Thanks for this. It fixed my problem and I had been trying to fix it for some time. For me the problem was I couldn't install the pg ruby gem.
  • William
    William over 9 years
    the problem behind this issue is not exactly trivial...it causes problems when installing MPICH2 and other software that should otherwise work correctly on Yosemite
  • Héctor Ramos
    Héctor Ramos about 9 years
    THIS. This finally fixed my issue.
  • carlodef
    carlodef about 9 years
    On my system this didn't work, but brew upgrade gcc49 did the job
  • IanBussieres
    IanBussieres about 9 years
    Worked for me on 10.10 with ruby 2.1.5 and Xcode 6.3. I have spent 2 days crawling SO and trying to find the solution, this was the one for me.
  • ericpeters0n
    ericpeters0n over 8 years
    Even on Yosemite? (10.10)
  • ericpeters0n
    ericpeters0n over 8 years
    Apparently! Worked here :)
  • Soundararajan
    Soundararajan over 7 years
    Works in ElCapatin as well
  • David
    David over 7 years
    Tried the various other solutions and this is the only one that worked for me. Xcode-select version 2343 : El Capitan version 10.11.6
  • Dan Robinson
    Dan Robinson over 7 years
    Same issue as @Fralcon. This fixed it. Thank you!
  • p-robot
    p-robot about 7 years
    Using this approach on Yosemite 10.10.5 worked here. Thank you.
  • Michael Lang
    Michael Lang about 7 years
    Needed this after an upgrade from Maverick to Sierra. Solves issues with install gems with native extensions for Ruby 1.8.7 under RVM.
  • Quuxplusone
    Quuxplusone over 6 years
    It should be noted that /Applications/Xcode.app/Contents/Developer/usr/bin/gcc is not GCC at all; it's just a convenience synonym for LLVM/Clang. If the OP actually needed gcc (or gfortran or whatever), then this would not help. But it certainly helps if you don't mind using the system LLVM/Clang. (But in that case, why would you install GNU GCC from Homebrew in the first place?)
  • Diving
    Diving over 2 years
    I am having a similar problem with gcc 4.9.0 in BigSur 11.16.2. Simply gcc --version and I get " gcc: warning: couldn’t understand kern.osversion ‘20.6.0 " . I just open a new question about it (because the kern.osversion is similar, not the same). Also, I tried the xcode-selec --install and `brew upgrade gcc' fixes, but it did not worked for me.