在Ubuntu Server 11.10上安装mysql2 gem时出错:/ usr / bin / ld:找不到-lmysqlclient_r

时间:2012-07-17 16:16:32

标签: ruby ubuntu gem mysql2

我在其他一些帖子中提到的Ubuntu Server 11.10 x64上遇到了同样的错误: Post #1 Post #2

由于“无法找到-lmysqlclient_r”,无法编译mysql2 gem

我正在使用:

  • Ruby v1.8.7
  • MySQL v5.5.25-1
  • Rails 3.2.3
  • 宝石1.8.24

我安装了libmysqlclient-dev软件包,但它仍无效。

文件   - libmysqlclient_r.a   - libmysqlclient_r.so   - libmysqlclient_r.so.18   - libmysqlclient_r.so.18.0.0 位于/ usr / lib / x86_64-linux-gnu /

所以我在/ usr / lib /中创建了符号链接 我还是行不通:(

任何想法??

$ sudo gem install mysql2
Building native extensions.  This could take a while...
ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.8 extconf.rb
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/usr/lib/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H    -I/usr/include/mysql -DBIG_JOINS=1  -fno-strict-aliasing  -g -fPIC -fno-strict-aliasing -g -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/usr/lib/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H    -I/usr/include/mysql -DBIG_JOINS=1  -fno-strict-aliasing  -g -fPIC -fno-strict-aliasing -g -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/usr/lib/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_H -DHAVE_ERRMSG_H -DHAVE_MYSQLD_ERROR_H    -I/usr/include/mysql -DBIG_JOINS=1  -fno-strict-aliasing  -g -fPIC -fno-strict-aliasing -g -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 mysql2_ext.o result.o client.o -L. -L/usr/lib -L. -Wl,-Bsymbolic-functions -rdynamic -Wl,-export-dynamic -Wl,-rpath,/usr/lib/x86_64-linux-gnu    -lruby1.8 -L/usr/lib/x86_64-linux-gnu -lmysqlclient_r -lpthread -lz -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

0 个答案:

没有答案