{"id":7230,"date":"2014-05-31T23:02:12","date_gmt":"2014-05-31T23:02:12","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/31\/error-installing-mysql2-gem-on-ruby-1-9-2-collection-of-common-programming-errors\/"},"modified":"2014-05-31T23:02:12","modified_gmt":"2014-05-31T23:02:12","slug":"error-installing-mysql2-gem-on-ruby-1-9-2-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/31\/error-installing-mysql2-gem-on-ruby-1-9-2-collection-of-common-programming-errors\/","title":{"rendered":"Error installing mysql2 gem on Ruby 1.9.2-Collection of common programming errors"},"content":{"rendered":"<p>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:<\/p>\n<pre><code>todd-andrewss-macbook:shiftly toddOld$ gem install mysql2\nBuilding native extensions.  This could take a while...\nERROR:  Error installing mysql2:\n ERROR: Failed to build gem native extension.\n\n\/Users\/toddOld\/.rvm\/rubies\/ruby-1.9.2-p0\/bin\/ruby extconf.rb\nchecking for rb_thread_blocking_region()... yes\nchecking for mysql.h... yes\nchecking for errmsg.h... yes\nchecking for mysqld_error.h... yes\ncreating Makefile\n\nmake\ngcc -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\nIn file included from \/Users\/toddOld\/.rvm\/rubies\/ruby-1.9.2-p0\/include\/ruby-1.9.1\/ruby.h:32,\n                 from .\/mysql2_ext.h:4,\n                 from client.c:1:\n\/Users\/toddOld\/.rvm\/rubies\/ruby-1.9.2-p0\/include\/ruby-1.9.1\/ruby\/ruby.h:108: error: size of array \u2018ruby_check_sizeof_long\u2019 is negative\n\/Users\/toddOld\/.rvm\/rubies\/ruby-1.9.2-p0\/include\/ruby-1.9.1\/ruby\/ruby.h:112: error: size of array \u2018ruby_check_sizeof_voidp\u2019 is negative\nIn file included from \/Users\/toddOld\/.rvm\/rubies\/ruby-1.9.2-p0\/include\/ruby-1.9.1\/ruby\/intern.h:29,\n                 from \/Users\/toddOld\/.rvm\/rubies\/ruby-1.9.2-p0\/include\/ruby-1.9.1\/ruby\/ruby.h:1327,\n                 from \/Users\/toddOld\/.rvm\/rubies\/ruby-1.9.2-p0\/include\/ruby-1.9.1\/ruby.h:32,\n                 from .\/mysql2_ext.h:4,\n                 from client.c:1:\n\/Users\/toddOld\/.rvm\/rubies\/ruby-1.9.2-p0\/include\/ruby-1.9.1\/ruby\/st.h:69: error: size of array \u2018st_check_for_sizeof_st_index_t\u2019 is negative\nclient.c: In function \u2018rb_raise_mysql2_error\u2019:\nclient.c:79: warning: comparison is always true due to limited range of data type\nclient.c:79: warning: comparison is always true due to limited range of data type\nclient.c: In function \u2018rb_mysql_client_socket\u2019:\nclient.c:412: warning: comparison is always true due to limited range of data type\nclient.c:412: warning: comparison is always true due to limited range of data type\nclient.c: In function \u2018init_mysql2_client\u2019:\nclient.c:556: warning: comparison is always true due to limited range of data type\nclient.c:556: warning: comparison is always true due to limited range of data type\nclient.c:561: warning: comparison is always true due to limited range of data type\nclient.c:561: warning: comparison is always true due to limited range of data type\nclient.c:566: warning: comparison is always true due to limited range of data type\nclient.c:566: warning: comparison is always true due to limited range of data type\nclient.c:571: warning: comparison is always true due to limited range of data type\nclient.c:571: warning: comparison is always true due to limited range of data type\nclient.c:576: warning: comparison is always true due to limited range of data type\nclient.c:576: warning: comparison is always true due to limited range of data type\nclient.c:580: warning: comparison is always true due to limited range of data type\nclient.c:580: warning: comparison is always true due to limited range of data type\nclient.c:584: warning: comparison is always true due to limited range of data type\nclient.c:584: warning: comparison is always true due to limited range of data type\nclient.c:589: warning: comparison is always true due to limited range of data type\nclient.c:589: warning: comparison is always true due to limited range of data type\nclient.c:594: warning: comparison is always true due to limited range of data type\nclient.c:594: warning: comparison is always true due to limited range of data type\nclient.c:599: warning: comparison is always true due to limited range of data type\nclient.c:599: warning: comparison is always true due to limited range of data type\nclient.c:604: warning: comparison is always true due to limited range of data type\nclient.c:604: warning: comparison is always true due to limited range of data type\nclient.c:608: warning: comparison is always true due to limited range of data type\nclient.c:608: warning: comparison is always true due to limited range of data type\nclient.c:613: warning: comparison is always true due to limited range of data type\nclient.c:613: warning: comparison is always true due to limited range of data type\nclient.c:618: warning: comparison is always true due to limited range of data type\nclient.c:618: warning: comparison is always true due to limited range of data type\nclient.c:622: warning: comparison is always true due to limited range of data type\nclient.c:622: warning: comparison is always true due to limited range of data type\nclient.c:627: warning: comparison is always true due to limited range of data type\nclient.c:627: warning: comparison is always true due to limited range of data type\nclient.c:632: warning: implicit conversion shortens 64-bit value into a 32-bit value\nclient.c:632: warning: comparison is always true due to limited range of data type\nclient.c:632: warning: comparison is always true due to limited range of data type\nclient.c:642: warning: implicit conversion shortens 64-bit value into a 32-bit value\nclient.c:642: warning: comparison is always true due to limited range of data type\nclient.c:642: warning: comparison is always true due to limited range of data type\nclient.c:647: warning: implicit conversion shortens 64-bit value into a 32-bit value\nclient.c:647: warning: comparison is always true due to limited range of data type\nclient.c:647: warning: comparison is always true due to limited range of data type\nclient.c:652: warning: implicit conversion shortens 64-bit value into a 32-bit value\nclient.c:652: warning: comparison is always true due to limited range of data type\nclient.c:652: warning: comparison is always true due to limited range of data type\nclient.c:657: warning: implicit conversion shortens 64-bit value into a 32-bit value\nclient.c:657: warning: comparison is always true due to limited range of data type\nclient.c:657: warning: comparison is always true due to limited range of data type\nmake: *** [client.o] Error 1\n\n\nGem files will remain installed in \/Users\/toddOld\/.rvm\/gems\/ruby-1.9.2-p0\/gems\/mysql2-0.2.6 for inspection.\nResults logged to \/Users\/toddO\n\nld\/.rvm\/gems\/ruby-1.9.2-p0\/gems\/mysql2-0.2.6\/ext\/mysql2\/gem_make.out\n<\/code><\/pre>\n<p>I tried installing with a number of different MySQL versions, including 5.5.6.rc, 5.1.14 and 5.1.49. I am running Mac OS X 10.5.8 with the XCode tools installed. I confirmed that MySQL works from the command line and connects correctly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8230; 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()&#8230; yes checking [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-7230","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7230","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=7230"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/7230\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=7230"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=7230"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=7230"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}