我無法運行Ruby on Rails與Ruby 1.9.3和Mountain Lion捆綁安裝。它不會安裝MySql2 gem。我在Mac OS X Lion上安裝了Ruby on Rails大約10次,所以我對這些步驟非常熟悉,但無法將MySQL gem安裝到其中。這是我得到的錯誤。提前致謝。Bundle安裝不會安裝與Ruby 1.9.3,Rails3和Mac Mountain Lion的mysql2 gem
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/username/.rvm/rubies/ruby-1.9.3-p327/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 client.c:1:
In file included from ./mysql2_ext.h:8:
In file included from /Users/username/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby.h:32:
/Users/username/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/ruby.h:105:37: error: 'ruby_check_sizeof_long' declared as an array with a negative size
typedef char ruby_check_sizeof_long[SIZEOF_LONG == sizeof(long) ? 1 : -1];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/username/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/x86_64-darwin12.2.0/ruby/config.h:24:21: note: expanded from macro 'SIZEOF_LONG'
#define SIZEOF_LONG 8
^
In file included from client.c:1:
In file included from ./mysql2_ext.h:8:
In file included from /Users/username/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby.h:32:
/Users/username/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/ruby.h:109:38: error: 'ruby_check_sizeof_voidp' declared as an array with a negative size
typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/username/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/x86_64-darwin12.2.0/ruby/config.h:28:22: note: expanded from macro 'SIZEOF_VOIDP'
#define SIZEOF_VOIDP 8
^
In file included from client.c:1:
In file included from ./mysql2_ext.h:8:
In file included from /Users/username/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby.h:32:
In file included from /Users/username/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/ruby.h:1382:
In file included from /Users/username/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/intern.h:34:
/Users/username/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/ruby/st.h:67:45: error: 'st_check_for_sizeof_st_index_t' declared as an array with a negative size
typedef char st_check_for_sizeof_st_index_t[SIZEOF_VOIDP == (int)sizeof(st_index_t) ? 1 : -1];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/username/.rvm/rubies/ruby-1.9.3-p327/include/ruby-1.9.1/x86_64-darwin12.2.0/ruby/config.h:28:22: note: expanded from macro 'SIZEOF_VOIDP'
#define SIZEOF_VOIDP 8
^
3 errors generated.
make: *** [client.o] Error 1
Gem files will remain installed in /Users/username/.rvm/gems/ruby-1.9.3-p327/gems/mysql2-0.3.11 for inspection.
Results logged to /Users/username/.rvm/gems/ruby-1.9.3-p327/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
An error occurred while installing mysql2 (0.3.11), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling.
我試圖捆綁安裝--path mysql和捆綁安裝--system既不如果你使用RVM,並可能增加mysql2 RVM之外,請嘗試以下步驟工作
鏈接中的答案工作得很好。 – Francisco