2010-10-28 2 views
2

В настоящее время я пытаюсь установить gem mysql2 для приложения Ruby on Rails. Я использую Ruby 1.9.2. Здесь ошибка:Ошибка при установке mysql2 gem на Ruby 1.9.2

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 и 5.1.49. Я запускаю Mac OS X 10.5.8 с установленными инструментами XCode. Я подтвердил, что MySQL работает из командной строки и правильно подключается.

+0

Попробуйте установить более старую версию драгоценного камня. –

ответ

1

Проверьте свою версию Ruby. Если это 64-битный, то ваш MySQL должен быть 64-битным и наоборот.

Также установите с archflags в соответствии с установкой и добавьте --no-ri и --no-rdoc.

+0

Казалось бы, это правильно. Я закончил скомпилировать mysql из источника, и он отлично работал. – Stewart