/usr/bin/ld: cannot find -lmysqlclient_r installing ruby gem mysql2 in Fedora Linux + MySQL 5.5.15

[[email protected] rails]$ uname -a
Linux fedora 2.6.35.10-74.fc14.i686 #1 SMP Thu Dec 23 16:17:40 UTC
2010 i686 i686 i386 GNU/Linux
[[email protected] rails]$

[[email protected] rails]$ rpm -qa |grep MySQL
MySQL-client-5.5.15-1.linux2.6.i386
MySQL-test-5.5.15-1.linux2.6.i386
MySQL-server-5.5.15-1.linux2.6.i386
MySQL-shared-compat-5.5.15-1.linux2.6.i386
MySQL-devel-5.5.15-1.linux2.6.i386
[[email protected] rails]$

[[email protected] rails]$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [i686-linux]
[[email protected] rails]$ gem -v
1.8.10
[[email protected] rails]$ rails -v
Rails 3.1.3
[[email protected] rails]$

[[email protected] rails]$ gem install mysql2
Building native extensions. This could take a while…
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.

    /home/dinooz/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb

checking for rb_thread_blocking_region()… yes
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/home/dinooz/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/
i686-linux -I/home/dinooz/.rvm/rubies/ruby-1.9.2-p290/include/
ruby-1.9.1/ruby/backward -I/home/dinooz/.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/home/dinooz/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/
i686-linux -I/home/dinooz/.rvm/rubies/ruby-1.9.2-p290/include/
ruby-1.9.1/ruby/backward -I/home/dinooz/.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_fields:
result.c:381:35: warning: comparison between signed and unsigned
integer expressions
gcc -I. -I/home/dinooz/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/
i686-linux -I/home/dinooz/.rvm/rubies/ruby-1.9.2-p290/include/
ruby-1.9.1/ruby/backward -I/home/dinooz/.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 -shared -o mysql2.so client.o result.o mysql2_ext.o -L. -L/home/
dinooz/.rvm/rubies/ruby-1.9.2-p290/lib -Wl,-R/home/dinooz/.rvm/rubies/
ruby-1.9.2-p290/lib -L. -rdynamic -Wl,-export-dynamic -Wl,-rpath,/usr/
lib -Wl,-R -Wl,/home/dinooz/.rvm/rubies/ruby-1.9.2-p290/lib -L/home/
dinooz/.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 /home/dinooz/.rvm/gems/ruby-1.9.2-
p290/gems/mysql2-0.3.10 for inspection.
Results logged to /home/dinooz/.rvm/gems/ruby-1.9.2-p290/gems/
mysql2-0.3.10/ext/mysql2/gem_make.out
[[email protected] rails]$

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs