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

本秂侑毒 提交于 2019-11-28 18:39:53

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.

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

if you're using Homebrew, simply:

brew upgrade gcc

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.

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

The patch you are trying to use is for patching the source code of GCC, and you are trying to use it to patch the compiled binary. That won't work.

In theory the process would be

  • Download source tarball of GCC compiler
  • apply the patch to it
  • compile GCC
  • Install the compiled GCC

However, you are unlikely to be able to do this since you cannot run the compiler in order to compile a newer copy of itself. Catch-22!

Searching google for 'gcc yosemite' I found a number of references to possible solutions, eg. enter link description here. I'm afraid I am no mac expert so I cannot judge the quality of these solutions.

I am also getting the warning "couldn't understand kern.osversion `14.0.0'" on GFORTRAN compilations while running Yosemite (10.10.1) with Xcode 6.1 and GCC 5.0. The compiler, however, generates functioning executable code and it seems to run correctly. Maybe you can just ignore the warning?

I solved an issue by linking

export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2
export CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2

It seems to want a current version of XCode command line tools. When I first typed "make" after installing Yosemite I got a warning and a dialog box saying that I did not have XCode command line tools and asked if I wanted to install them. I did so, and everything worked.

However one user did not get this dialog and instead got the error message as shown. The "xcode-select --install" did not work, so it seems like it may have kept the outdated command line tools and header files.

The MACOSX_DEPLOYMENT_TARGET=10.9 solution did work for him. However the compiles seemed to be a lot slower.

I had this issue, installed Xcode cli tools (xcode-select --install), and still had issues. I'd upgraded from Yosemite to Mojave, and uninstalling an older version of the compiler worked for me:

brew uninstall apple-gcc42

Hope this helps someone!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!