OS X 10.8 - 尝试执行'/usr/bin/i686-apple-darwin11-gcc-4.2.1'错误 - 安装json gem [英] OS X 10.8 - error trying to exec '/usr/bin/i686-apple-darwin11-gcc-4.2.1' - installing json gem
问题描述
在安装json gem的原生扩展时遇到问题。
在10.8之前,我安装了命令行工具。 RVM与Ruby 1.9.2。
升级到10.8并做了以下工作: 在安装json gem时,我仍然得到以下输出:
whoami
/ usr / local
ul>
➽ gem install json -v'1.7.4'
构建原生扩展。这可能需要一段时间...
错误:安装json时出错:
错误:无法构建gem本机扩展。
/Users/vincent/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
创建Makefile
make
/usr/bin/gcc-4.2 -I。 -I / Users / vincent / .rvm / rubies / ruby-1.9.2-p320 / include / ruby-1.9.1 / x86_64-darwin11.3.0 -I / Users / vincent / .rvm / rubies / ruby-1.9.2 -p320 / include / ruby-1.9.1 / ruby / backward -I / Users / vincent / .rvm / rubies / ruby-1.9.2-p320 / include / ruby-1.9.1 -I。 -DJSON_GENERATOR -I / Users / vincent / .rvm / usr / include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno -unused-parameter -Wno-括号-Wpointer-arith -Wwrite-strings -Wno-缺少字段初始化程序-Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -O3 -Wall -O0 -ggdb -o generator.o -c generator.c
gcc-4.2 :错误尝试执行'/usr/bin/i686-apple-darwin11-gcc-4.2.1':execvp:没有这样的文件或目录
make:*** [generator.o]错误255
Gem文件将保留安装在/Users/vincent/.rvm/gems/ruby-1.9.2-p320@hshmrk/gems/json-1.7.4进行检查。
结果记录到/Users/vincent/.rvm/gems/ruby-1.9.2-p320@hshmrk/gems/json-1.7.4/ext/json/ext/generator/gem_make.out
这里的任何帮助?我如何调试我的构建环境?不是专家,但我认为json gem安装程序忽略了我的环境,因为它使用的是我的系统中不存在的GCC版本,并且brew安装程序也没有创建它。
➽gcc-4.2
i686-apple-darwin11-gcc-4.2.1:无输入文件
➽哪个gcc-4.2
/usr/local/bin/gcc-4.2
➽ls /usr/bin/i686-apple-darwin11-gcc-4.2.1
ls :/usr/bin/i686-apple-darwin11-gcc-4.2.1:没有这样的文件或目录
我也尝试了symlinking ➽sudo link /usr/local/bin/gcc-4.2 /usr/bin/i686-apple-darwin11-gcc-4.2.1
。但是这给了vfork超时错误。
编辑:
➽ brew doctor
gcc-4.2:尝试执行错误'/usr/bin/i686-apple-darwin11-gcc-4.2.1':execvp:没有这样的文件或目录
警告:X11未安装。
您没有安装X11作为OS X安装的一部分。
这不是所有公式都需要的,但有些是预期的。
您可以从以下地址下载最新版本的XQuartz:
https://xquartz.macosforge.org
edit2:
确实运行了xcode-select XCode
edit3:
sudo xcode-select -switch / usr / bin
sudo ln -sf /usr/bin/llvm-gcc-4.2 / usr /bin/gcc-4.2
这个修正了它!基本上,你告诉OS X使用/ usr / bin文件夹进行编译,然后将llvm-gcc-4.2编译器链接到旧版本的位置。作品! BAM!
来源: http://jtimberman.housepub.org/blog/2012/02/26/xcode-command-line-tools/
sudo ln -sf / usr / bin / llvm-gcc-4.2 /usr/bin/gcc-4.2
我用xcode - 选择XCode和命令行工具。他们都工作。
我也卸载了brew-apple-gcc42,它仍然有效。
出口CC也不需要。
所以基本上只是链接。希望这可以解决人们遇到的一些问题。
I've just upgraded to OS X Mountain Lion (regretting it already).
Having issues with installing the json gem's native extentions.
Before 10.8 I had Command Line Tools installed. RVM with Ruby 1.9.2.
Upgraded to 10.8 and did the following stuff:
- sudo chown -R
whoami
/usr/local - brew update
- brew tap homebrew/dupes
- brew install apple-gcc42
- Installed XCode 4.4
- Installed Command Line Tools for XCode 4.4
- export CC=/usr/local/bin/gcc-4.2 in bash_profile
- sudo ln -s /usr/local/bin/gcc-4.2 /usr/bin/gcc-4.2
- edit: sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
I still get the following output when installing the json gem:
➽ gem install json -v '1.7.4'
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/Users/vincent/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
creating Makefile
make
/usr/bin/gcc-4.2 -I. -I/Users/vincent/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/x86_64-darwin11.3.0 -I/Users/vincent/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/ruby/backward -I/Users/vincent/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1 -I. -DJSON_GENERATOR -I/Users/vincent/.rvm/usr/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -O3 -Wall -O0 -ggdb -o generator.o -c generator.c
gcc-4.2: error trying to exec '/usr/bin/i686-apple-darwin11-gcc-4.2.1': execvp: No such file or directory
make: *** [generator.o] Error 255
Gem files will remain installed in /Users/vincent/.rvm/gems/ruby-1.9.2-p320@hshmrk/gems/json-1.7.4 for inspection.
Results logged to /Users/vincent/.rvm/gems/ruby-1.9.2-p320@hshmrk/gems/json-1.7.4/ext/json/ext/generator/gem_make.out
Any help here? How can I debug my build env? Not an expert when it comes to this but I think the json gem installer is ignoring my environment as it's using a version of GCC that doesn't exist on my system and the brew installer doesn't create it either.
➽ gcc-4.2
i686-apple-darwin11-gcc-4.2.1: no input files
➽ which gcc-4.2
/usr/local/bin/gcc-4.2
➽ ls /usr/bin/i686-apple-darwin11-gcc-4.2.1
ls: /usr/bin/i686-apple-darwin11-gcc-4.2.1: No such file or directory
I also tried symlinking ➽ sudo link /usr/local/bin/gcc-4.2 /usr/bin/i686-apple-darwin11-gcc-4.2.1
. But that gave a vfork timeout error.
edit:
➽ brew doctor
gcc-4.2: error trying to exec '/usr/bin/i686-apple-darwin11-gcc-4.2.1': execvp: No such file or directory
Warning: X11 is not installed.
You don't have X11 installed as part of your OS X installation.
This is not required for all formulae, but is expected by some.
You can download the latest version of XQuartz from:
https://xquartz.macosforge.org
edit2:
did run xcode-select XCode
edit3:
sudo xcode-select -switch /usr/bin
sudo ln -sf /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2
This fixed it! Basically you tell OS X to compile using /usr/bin folder and then you link the llvm-gcc-4.2 compiler to where the old one used to be. Works! BAM!
source: http://jtimberman.housepub.org/blog/2012/02/26/xcode-command-line-tools/
I'm under the impression that all you need to do is:
sudo ln -sf /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2
I tried with xcode-select XCode and the commandline tools. They both work. I also uninstalled the brew apple-gcc42 and it still works. export CC isn't needed either.
So basically just the link. Hope this solves some issues people are having.
这篇关于OS X 10.8 - 尝试执行'/usr/bin/i686-apple-darwin11-gcc-4.2.1'错误 - 安装json gem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!