MySQL Forums
Forum List  »  Ruby

gem install mysql2 :: Error cannot find -lmysqlclient_r
Posted by: Bernardino Lopez
Date: August 09, 2011 03:27PM

I install rvm in Fedora 15. like listed in the post:
https://plus.google.com/106336405206268952858/posts/g1URhoYF3qk

Also like to use MySQL, but when I try to install the gem for mysql2:

gem install mysql2

Script started on Mon 08 Aug 2011 12:48:23 PM CDT
]0;myredhat@myfedora15:~/rails[?1034h[myredhat@myfedora15 rails]$ su -llcleardf -hcleargem install mysql2

Building native extensions. This could take a while...

ERROR: Error installing mysql2:

ERROR: Failed to build gem native extension.



/usr/local/rvm/rubies/ruby-1.9.2-p290/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/usr/local/rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -D_FILE_OFFSET_BITS=64 -I/usr/include/mysql -g -pipe -m32 -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -fPIC -Wall -funroll-loops -o mysql2_ext.o -c mysql2_ext.c

gcc -I. -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -D_FILE_OFFSET_BITS=64 -I/usr/include/mysql -g -pipe -m32 -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -fPIC -Wall -funroll-loops -o client.o -c client.c

gcc -I. -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/i686-linux -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/usr/local/rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1 -I. -DHAVE_RB_THREAD_BLOCKING_REGION -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H -D_FILE_OFFSET_BITS=64 -I/usr/include/mysql -g -pipe -m32 -fPIC -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -DMY_PTHREAD_FASTMUTEX=1 -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -fPIC -Wall -funroll-loops -o result.o -c result.c

result.c: In function ‘rb_mysql_result_fetch_row’:

result.c:253:31: warning: variable ‘tokens’ set but not used [-Wunused-but-set-variable]

result.c:267:58: warning: variable ‘tokens’ set but not used [-Wunused-but-set-variable]

result.c:310:33: warning: variable ‘tokens’ set but not used [-Wunused-but-set-variable]

result.c: In function ‘rb_mysql_result_fetch_fields’:

result.c:376:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

gcc -shared -o mysql2.so mysql2_ext.o client.o result.o -L. -L/usr/local/rvm/rubies/ruby-1.9.2-p290/lib -Wl,-R/usr/local/rvm/rubies/ruby-1.9.2-p290/lib -L. -rdynamic -Wl,-export-dynamic -Wl,-rpath,/usr/lib -Wl,-R -Wl,/usr/local/rvm/rubies/ruby-1.9.2-p290/lib -L/usr/local/rvm/rubies/ruby-1.9.2-p290/lib -lruby -L/usr/lib -lmysqlclient_r -lpthread -lm -lrt -ldl -lpthread -lrt -ldl -lcrypt -lm -lc

/usr/bin/ld: cannot find -lmysqlclient_r

collect2: ld returned 1 exit status

make: *** [mysql2.so] Error 1





Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.6 for inspection.

Results logged to /usr/local/rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.6/ext/mysql2/gem_make.out

]0;myredhat@myfedora15:~/rails[myredhat@myfedora15 rails]$ rpm -qa |grep MySQL

MySQL-server-5.5.15-1.linux2.6.i386

MySQL-devel-5.5.15-1.linux2.6.i386

MySQL-shared-compat-5.5.15-1.linux2.6.i386

MySQL-client-5.5.15-1.linux2.6.i386

]0;myredhat@myfedora15:~/rails[myredhat@myfedora15 rails]$ uname -a

Linux myfedora15 2.6.38.8-32.fc15.i686 #1 SMP Mon Jun 13 20:01:50 UTC 2011 i686 i686 i386 GNU/Linux

]0;myredhat@myfedora15:~/rails[myredhat@myfedora15 rails]$ exit

exit


Script done on Mon 08 Aug 2011 12:49:05 PM CDT

I try to upgrade but nothing seems to work... I wonder if this is a ruby/gem issue or some missing library in the mysql client. !!!.

THX in advance for the heads up.



Edited 1 time(s). Last edit at 08/09/2011 03:31PM by Bernardino Lopez.

Options: ReplyQuote


Subject
Written By
Posted
gem install mysql2 :: Error cannot find -lmysqlclient_r
August 09, 2011 03:27PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.