简洁的想法

仁爱、喜乐、和平、忍耐、恩慈、良善、信实、温柔、节制

Fatal Error: stdio.h File Not Found

| Comments

OS X 10.7.3 安装XCode 4.3.1 之后,如果你也安装了命令行: Preferences > Downloads > Components and click install on Command Line Tools

那再编译什么东西的时候,就有可能收到报错信息,比如我就是在bundle install的时候得到如下信息:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Installing rb-fsevent (0.4.3.1) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
creating Makefile
CFLAGS='-isysroot /Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -mdynamic-no-pic -std=gnu99 -Os -pipe -Wmissing-prototypes -Wreturn-type -Wmissing-braces -Wparentheses -Wswitch -Wunused-function -Wunused-label -Wunused-parameter -Wunused-variable -Wunused-value -Wuninitialized -Wunknown-pragmas -Wshadow -Wfour-char-constants -Wsign-compare -Wnewline-eof -Wconversion -Wshorten-64-to-32 -Wglobal-constructors -pedantic' /usr/bin/clang -isysroot /Developer/SDKs/MacOSX10.7.sdk -mmacosx-version-min=10.7 -mdynamic-no-pic -std=gnu99 -dead_strip -framework CoreServices -o '/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rb-fsevent-0.4.3.1/bin/fsevent_watch' fsevent/fsevent_watch.c
fsevent/fsevent_watch.c:1:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^
1 error generated.
extconf.rb:59:in `<main>': Compilation of fsevent_watch failed (see README) (RuntimeError)


Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rb-fsevent-0.4.3.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rb-fsevent-0.4.3.1/ext/gem_make.out
An error occured while installing rb-fsevent (0.4.3.1), and Bundler cannot continue.
Make sure that `gem install rb-fsevent -v '0.4.3.1'` succeeds before bundling.

如果用心看一下,报的是stdio.h file not found.

其实问题出在这个command line tools上,可以用下面这个命令修正:

1
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/

Comments