1
1

More than 5 years have passed since last update.

`couldn't understand kern.osversion '14.5.0'` でコンパイルエラーするときの対処法

Posted at

自分の場合は、nativecodeをコンパイルする必要があるGemをインストールする時に、couldn't understand kern.osversion '14.5.0'というコンパイルエラーが発生しました。

make "DESTDIR="
compiling binder.cpp
couldn't understand kern.osversion `14.5.0'
cc1plus: error: unrecognized command line option "-Wno-ignored-qualifiers"
cc1plus: error: unrecognized command line option "-Wno-unused-result"
make: *** [binder.o] Error 1

グーグル先生に聞いてみてもなかなか答えが見つからずにハマりましたが、解決できたのでメモ。どうやらHomebrewで入ってたgccが原因っぽい。

環境情報

  • OSX Yosemite 10.10.5
  • Xcode 7.0

Homebrewの apple-gcc42 をアンインストール

色々探してたら「xcode - Why does Homebrew report "couldn't understand kern.osversion `14.0.0'"? - Stack Overflow」という記事を発見。Answerのコメントまで読み進みと、こんなコメントが。

@SandeepM That's an interesting solution. But homebrew should stay out of /usr/bin, so my question would be whether your offending gcc was in /usr/local/bin instead. I guess the homebrew uninstall solution won't work for everyone, but it does show that Apple's gcc42 causes problems after updates. (the Homebrew apple-gcc42 formula says: "This formula contains compilers built from Apple's GCC sources, build 5666.3".)

確認してみると自分の環境にもapple-gcc42を発見したので、アンインストールしてみる。

% brew list
apple-gcc42
% brew uninstall apple-gcc42

すると、エラー内容が変わった。

make "DESTDIR="
compiling binder.cpp
make: g++-4.2: No such file or directory
make: *** [binder.o] Error 1

g++-4.2のシンボリックリンクを作成

brew uninstallで消えたようなので、xcodeで入っているg++へのシンボリックリンクを作成する。

%ln -s /usr/bin/g++ /usr/bin/g++-4.2  

これで無事にコンパイルが通った!

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1