我们实习生的电脑在安装mysql2 gem时遇到问题。我们只是将他的电脑从OS X 10.6升级到了10.8(Mountain Lion)。我曾尝试通过自制软件和64位DMG安装程序安装MySQL。我也尝试了对开发工具的符号链接(正如这里指出的:Not able to install some gems after mountain lion upgrade)。我们安装了Xcode(4.4)并安装了命令行工具。我们在安装命令行工具后尝试重新启动。mysql2 gem无法构建原生扩展
这是~/.bashrc
他的PATH声明:
PATH=/usr/local/bin:$PATH:$HOME/.rvm/bin:/usr/local/mysql/bin # Add RVM to PATH for scripting
符号链接:
Diego-Blantons-MacBook-Pro-3:~ lmrunner07$ sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2
Password:
尝试安装宝石:
Diego-Blantons-MacBook-Pro-3:~ lmrunner07$ gem install mysql2
Building native extensions. This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.
/Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... yes
checking for rb_wait_for_single_fd()... yes
checking for mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
creating Makefile
make
compiling client.c
In file included from /Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby.h:32,
from ./mysql2_ext.h:8,
from client.c:1:
/Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:105: error: size of array ‘ruby_check_sizeof_long’ is negative
/Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:109: error: size of array ‘ruby_check_sizeof_voidp’ is negative
In file included from /Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/intern.h:34,
from /Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/ruby.h:1382,
from /Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby.h:32,
from ./mysql2_ext.h:8,
from client.c:1:
/Users/lmrunner07/.rvm/rubies/ruby-1.9.3-p194/include/ruby-1.9.1/ruby/st.h:67: error: size of array ‘st_check_for_sizeof_st_index_t’ is negative
client.c: In function ‘rb_raise_mysql2_error’:
client.c:98: warning: ISO C90 forbids mixed declarations and code
client.c: In function ‘rb_mysql_client_socket’:
client.c:590: warning: ISO C90 forbids mixed declarations and code
make: *** [client.o] Error 1
Gem files will remain installed in /Users/lmrunner07/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11 for inspection.
Results logged to /Users/lmrunner07/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
我已经删除了自制mysql安装以及作为发射代理。此外rm -rf
宝石目录(用户/ lmrunner07/.rvm /宝石/红宝石1.9.3-P194 /宝石/ mysql2-0.3.11)
您可以验证您的Xcode 4.4版本是重新发布两个狮子和山狮? – davidcelis 2012-07-27 18:21:06
对不起,您想要我检查什么? – 2012-07-27 18:36:38
当Mountain Lion发布时,他们更新了应用商店中的Xcode 4.4,使其成为兼容Lion和Mountain Lion的版本。如果你没有重新安装Xcode,很可能你的版本只与以前版本的OS X兼容。 – davidcelis 2012-07-27 18:43:53