簡體   English   中英

嘗試了許多建議,如何安裝mysql2 gem?

[英]Tried many suggestions, how do I install mysql2 gem?

我正在嘗試在Rails應用程序的紅寶石上安裝mysql2 gem。 我當前正在運行Ubuntu 11.04,這是我運行sudo gem install mysql2bundle install時遇到的錯誤:

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 client.c
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
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
gcc -shared -o mysql2.so client.o mysql2_ext.o result.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


Gem files will remain installed in /var/lib/gems/1.8/gems/mysql2-0.3.11 for inspection.
Results logged to /var/lib/gems/1.8/gems/mysql2-0.3.11/ext/mysql2/gem_make.out

我嘗試使用mysql_config進行安裝,已經安裝了libmysqlclient-dev和libmysql-ruby庫,還嘗試了卸載並重新安裝mysql。 沒有一個有效。 我能夠成功安裝mysql gem,但不能成功安裝mysql2。

我正在運行ruby1.8和Rails 2.3.5。 誰能幫我嗎?

嘗試這個:

須藤apt-get install libmysql-ruby

sudo apt-get安裝libmysqlclient-dev

sudo gem安裝mysql2

如果您正在運行CentOS / Redhat,請嘗試安裝以下軟件包(使用yum):

MySQL-devel-5.5.22-1.el6.x86_64
MySQL-shared-5.5.22-1.el6.x86_64
MySQL-shared-compat-5.5.22-2.el6.x86_64

看這個博客和其他喜歡它的人。 但最終,我建議從11.04升級到11.10。 在運行11.04時,我遇到了許多奇怪的錯誤,因為遷移到11.10后,一切都變得更加穩定。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM