僕は木になりたい。。。

子供のとき本気でそう思ってました。 理由は樹齢が長いから

rails2.2

gem install mysql にハマる5

Rails2.2.2では、mysqlがデフォルトでは使えず、

gem install mysql
をやれと言われました。

やってみる。

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

/usr/local/bin/ruby extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/bin/ruby
        --with-mysql-config
        --without-mysql-config
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib
        --without-mysql-lib=${mysql-dir}/lib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-mlib
        --without-mlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-zlib
        --without-zlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-socketlib
        --without-socketlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-nsllib
        --without-nsllib
        --with-mysqlclientlib
        --without-mysqlclientlib


Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out
失敗。。

どうやら、 mysql_configの場所を教えてあげないとダメらしい。

やってみる。

$ sudo gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb install mysql -- --with-mysql-config=/usr/bin/mysql_config
checking for mysql_ssl_set()... no
checking for mysql.h... no
checking for mysql/mysql.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/bin/ruby
        --with-mysql-config


Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out
失敗。。

どうやら、 mysql-develが必要らしい。

インストールしてみる。

$ sudo yum install mysql-devel
Loaded plugins: refresh-packagekit
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package mysql-devel.i386 0:5.0.51a-1.fc9 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 mysql-devel             i386       5.0.51a-1.fc9    fedora            2.4 M

Transaction Summary
=============================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 2.4 M
Is this ok [y/N]: y
Downloading Packages:
(1/1): mysql-devel-5.0.51a-1.fc9.i386.rpm                                                                                                                                                  | 2.4 MB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : mysql-devel                                       [1/1]

Installed: mysql-devel.i386 0:5.0.51a-1.fc9
Complete!
お、入った。

で、やってみる

sudo gem install mysql -- --with-mysql-config=/usr/bin/mysql_config
Building native extensions.  This could take a while...
Successfully installed mysql-2.7
1 gem installed

よし、OK

Rails 2.2 で RubyGemsがどうのこうのと言われて。。5

Rails2.2で、試しにアプリを起動してみたら、
Rails requires RubyGems >= 1.3.1 (you have 1.2.0). Please `gem update --system` and try again.
と、言われたので、
$ sudo gem update --system 
とすると、
Updating RubyGems
Nothing to update
と言われた。
言われたとおりにしたのに。。

解決策

こうしたら
$ sudo gem install rubygems-update
Successfully installed rubygems-update-1.3.1
1 gem installed
出来た。
意気揚々と
$script/server
Rails requires RubyGems >= 1.3.1 (you have 1.2.0). Please `gem update --system` and try again.
ええええっ
$gem --version
1.2.0
やっぱり。。
ぐぐってみた。
Rails 2.2.2 と RubyGems 1.3.1 と rubygems-update - Rubyとか Illustratorとか SFとか折紙とか
Rails 2.2.2 と RubyGems 1.3.1 と rubygems-updateComments
と、言う事で、
$sudo update_rubygems
...いろいろやって...
If `gem` was installed by a previous RubyGems installation, you may need
to remove it by hand.

$gem --version
1.3.1
$ script/server -p 4000
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails 2.2.2 application starting on http://0.0.0.0:4000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:4000
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready.  TERM => stop.  USR2 => restart.  INT => stop (no restart).
** Rails signals registered.  HUP => reload (without restart).  It might not work well.
** Mongrel 1.1.5 available at 0.0.0.0:4000
** Use CTRL-C to stop.
解決しました。ありがとう!!
livedoor プロフィール

emosei

記事検索
読書をしよう
楽天市場
こちらもどうぞ
Archives
RSS
  • ライブドアブログ