On Wed, Jan 25, 2012 at 7:36 PM, Jim Wharton <jamesawharton / gmail.com>wrote:

> I'm trying to get this gem installed and it keeps puking up errors. All
> the searches I've done tell me that I need to have the
> libmysqlclient-dev libraries installed. I do. But when I attempt to gem
> install mysql2:
>
> jim@caesar ~/Sites/igpt/install/shapefiles[testoo*]$ gem install mysql2
> -- --with-mysql-config=/usr/bin/mysql_config
> Building native extensions.  This could take a while...
> ERROR:  Error installing mysql2:
>  ERROR: Failed to build gem native extension.
>
>        /home/jim/.rvm/rubies/ruby-1.8.7-p334/bin/ruby extconf.rb
> --with-mysql-config=/usr/bin/mysql_config
> checking for rb_thread_blocking_region()... no
> checking for rb_wait_for_single_fd()... no
> checking for mysql.h... yes
> checking for errmsg.h... yes
> checking for mysqld_error.h... yes
> creating Makefile
>
> make
> gcc -I. -I.
> -I/home/jim/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/i686-linux -I.
> -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H
> -D_FILE_OFFSET_BITS=64  -I/usr/include/mysql  -DBIG_JOINS=1
> -fno-strict-aliasing   -DUNIV_LINUX -DUNIV_LINUX -fPIC -g -O2  -fPIC
> -Wall -funroll-loops  -c result.c
> result.c: In function °∆rb_mysql_result_fetch_row°«:
> result.c:258:31: warning: variable °∆tokens°« set but not used
> [-Wunused-but-set-variable]
> result.c:272:58: warning: variable °∆tokens°« set but not used
> [-Wunused-but-set-variable]
> result.c:315:33: warning: variable °∆tokens°« set but not used
> [-Wunused-but-set-variable]
> gcc -I. -I.
> -I/home/jim/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/i686-linux -I.
> -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H
> -D_FILE_OFFSET_BITS=64  -I/usr/include/mysql  -DBIG_JOINS=1
> -fno-strict-aliasing   -DUNIV_LINUX -DUNIV_LINUX -fPIC -g -O2  -fPIC
> -Wall -funroll-loops  -c mysql2_ext.c
> ./client.h:16:1: warning: °∆rb_thread_blocking_region°« defined but not
> used [-Wunused-function]
> gcc -I. -I.
> -I/home/jim/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/i686-linux -I.
> -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H
> -D_FILE_OFFSET_BITS=64  -I/usr/include/mysql  -DBIG_JOINS=1
> -fno-strict-aliasing   -DUNIV_LINUX -DUNIV_LINUX -fPIC -g -O2  -fPIC
> -Wall -funroll-loops  -c client.c
> client.c: In function °∆rb_mysql_client_info°«:
> client.c:539:3: warning: variable °∆wrapper°« set but not used
> [-Wunused-but-set-variable]
> gcc -shared -o mysql2.so result.o mysql2_ext.o client.o -L.
> -L/home/jim/.rvm/rubies/ruby-1.8.7-p334/lib
> -Wl,-R/home/jim/.rvm/rubies/ruby-1.8.7-p334/lib -L.  -rdynamic
> -Wl,-export-dynamic -Wl,-rpath,/usr/lib/mysql    -Wl,-R
> -Wl,/home/jim/.rvm/rubies/ruby-1.8.7-p334/lib
> -L/home/jim/.rvm/rubies/ruby-1.8.7-p334/lib -lruby
> -Wl,-Bsymbolic-functions -rdynamic -L/usr/lib/mysql -lmysqlclient_r
> -lrt -ldl -lcrypt -lm   -lc
> /usr/bin/ld: skipping incompatible
> /home/jim/.rvm/rubies/ruby-1.8.7-p334/lib/libruby.so when searching for
> -lruby
> /usr/bin/ld: skipping incompatible
> /home/jim/.rvm/rubies/ruby-1.8.7-p334/lib/libruby.so when searching for
> -lruby
> /usr/bin/ld: cannot find -lruby
> collect2: ld returned 1 exit status
> make: *** [mysql2.so] Error 1
>
>
> Gem files will remain installed in
> /home/jim/.rvm/gems/ruby-1.8.7-p334@rails307/gems/mysql2-0.3.11 for
> inspection.
> Results logged to
> /home/jim/.rvm/gems/ruby-1.8.7-p334@rails307
> /gems/mysql2-0.3.11/ext/mysql2/gem_make.out
>
> It just crashes out.
>
> Any ideas from that error?
>

Hi, I am unable to exactly reproduce your set-up because I do not
(longer ?) see ruby  ruby-1.8.7-p334 in the list on known rubies from
rvm ...

Would you have any problem with doing
$ rvm get stable
$ rvm install 1.8.7

and then trying again in that context ? In rvm that should not be a
siginificant problem, since you could still keep you older version if you
wished.

That would make it easier for others to reproduce your set-up.

I just tried with ruby-1.8.7-p330 on Ubuntu 10.04 in a fresh gemset
and the `gem install mysql2` "just worked" ...

HTH,

Peter