2010-10-28 94 views
2

我目前正在嘗試爲Ruby on Rails應用程序安裝mysql2 gem。我正在使用Ruby 1.9.2。以下是錯誤:在Ruby 1.9.2上安裝mysql2 gem時出錯

todd-andrewss-macbook:shiftly toddOld$ gem install mysql2 
Building native extensions. This could take a while... 
ERROR: Error installing mysql2: 
ERROR: Failed to build gem native extension. 

/Users/toddOld/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb 
checking for rb_thread_blocking_region()... yes 
checking for mysql.h... yes 
checking for errmsg.h... yes 
checking for mysqld_error.h... yes 
creating Makefile 

make 
gcc -I. -I/Users/toddOld/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/i386-darwin9.8.0 -I/Users/toddOld/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/backward -I/Users/toddOld/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/mysql/include -g -Os -arch x86_64 -fno-common -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -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 -Wall -funroll-loops -o client.o -c client.c 
In file included from /Users/toddOld/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby.h:32, 
       from ./mysql2_ext.h:4, 
       from client.c:1: 
/Users/toddOld/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/ruby.h:108: error: size of array ‘ruby_check_sizeof_long’ is negative 
/Users/toddOld/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/ruby.h:112: error: size of array ‘ruby_check_sizeof_voidp’ is negative 
In file included from /Users/toddOld/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/intern.h:29, 
       from /Users/toddOld/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/ruby.h:1327, 
       from /Users/toddOld/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby.h:32, 
       from ./mysql2_ext.h:4, 
       from client.c:1: 
/Users/toddOld/.rvm/rubies/ruby-1.9.2-p0/include/ruby-1.9.1/ruby/st.h:69: error: size of array ‘st_check_for_sizeof_st_index_t’ is negative 
client.c: In function ‘rb_raise_mysql2_error’: 
client.c:79: warning: comparison is always true due to limited range of data type 
client.c:79: warning: comparison is always true due to limited range of data type 
client.c: In function ‘rb_mysql_client_socket’: 
client.c:412: warning: comparison is always true due to limited range of data type 
client.c:412: warning: comparison is always true due to limited range of data type 
client.c: In function ‘init_mysql2_client’: 
client.c:556: warning: comparison is always true due to limited range of data type 
client.c:556: warning: comparison is always true due to limited range of data type 
client.c:561: warning: comparison is always true due to limited range of data type 
client.c:561: warning: comparison is always true due to limited range of data type 
client.c:566: warning: comparison is always true due to limited range of data type 
client.c:566: warning: comparison is always true due to limited range of data type 
client.c:571: warning: comparison is always true due to limited range of data type 
client.c:571: warning: comparison is always true due to limited range of data type 
client.c:576: warning: comparison is always true due to limited range of data type 
client.c:576: warning: comparison is always true due to limited range of data type 
client.c:580: warning: comparison is always true due to limited range of data type 
client.c:580: warning: comparison is always true due to limited range of data type 
client.c:584: warning: comparison is always true due to limited range of data type 
client.c:584: warning: comparison is always true due to limited range of data type 
client.c:589: warning: comparison is always true due to limited range of data type 
client.c:589: warning: comparison is always true due to limited range of data type 
client.c:594: warning: comparison is always true due to limited range of data type 
client.c:594: warning: comparison is always true due to limited range of data type 
client.c:599: warning: comparison is always true due to limited range of data type 
client.c:599: warning: comparison is always true due to limited range of data type 
client.c:604: warning: comparison is always true due to limited range of data type 
client.c:604: warning: comparison is always true due to limited range of data type 
client.c:608: warning: comparison is always true due to limited range of data type 
client.c:608: warning: comparison is always true due to limited range of data type 
client.c:613: warning: comparison is always true due to limited range of data type 
client.c:613: warning: comparison is always true due to limited range of data type 
client.c:618: warning: comparison is always true due to limited range of data type 
client.c:618: warning: comparison is always true due to limited range of data type 
client.c:622: warning: comparison is always true due to limited range of data type 
client.c:622: warning: comparison is always true due to limited range of data type 
client.c:627: warning: comparison is always true due to limited range of data type 
client.c:627: warning: comparison is always true due to limited range of data type 
client.c:632: warning: implicit conversion shortens 64-bit value into a 32-bit value 
client.c:632: warning: comparison is always true due to limited range of data type 
client.c:632: warning: comparison is always true due to limited range of data type 
client.c:642: warning: implicit conversion shortens 64-bit value into a 32-bit value 
client.c:642: warning: comparison is always true due to limited range of data type 
client.c:642: warning: comparison is always true due to limited range of data type 
client.c:647: warning: implicit conversion shortens 64-bit value into a 32-bit value 
client.c:647: warning: comparison is always true due to limited range of data type 
client.c:647: warning: comparison is always true due to limited range of data type 
client.c:652: warning: implicit conversion shortens 64-bit value into a 32-bit value 
client.c:652: warning: comparison is always true due to limited range of data type 
client.c:652: warning: comparison is always true due to limited range of data type 
client.c:657: warning: implicit conversion shortens 64-bit value into a 32-bit value 
client.c:657: warning: comparison is always true due to limited range of data type 
client.c:657: warning: comparison is always true due to limited range of data type 
make: *** [client.o] Error 1 


Gem files will remain installed in /Users/toddOld/.rvm/gems/ruby-1.9.2-p0/gems/mysql2-0.2.6 for inspection. 
Results logged to /Users/toddO 

ld/.rvm/gems/ruby-1.9.2-p0/gems/mysql2-0.2.6/ext/mysql2/gem_make.out 

我試圖用許多不同的MySQL版本,包括5.5.6.rc,5.1.14和49年1月5日的安裝。我正在運行安裝了XCode工具的Mac OS X 10.5.8。我確認MySQL可以從命令行運行並正確連接。

+0

嘗試安裝舊版本的寶石。 – 2011-05-07 05:41:58

回答

1

檢查您的Ruby版本。如果它是64位的,那麼你的MySQL需要是64位,反之亦然。

還根據安裝與archflags一起安裝並添加--no-ri--no-rdoc

+0

這似乎是你的正確。我結束了從源代碼編譯MySQL,它工作正常。 – Stewart 2011-05-08 12:36:37