I am currently trying to install the mysql2 gem for a ruby on rails application. I am using ruby 1.9.2. Here is the error
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
I have tried installing with a number of different mysql versions. These include 5.5.6.rc 5.1.14 5.1.49. I am running mac osx 10.5.8 with xcode tools installed. I can also confirm that mysql works from the command line and connects correctly.