MYSQL2 and RUBY 1.9.2 error handling

Quote

OS Version: Mac OS X 10.7.1 Lion

Ruby Version: Ruby 1.9.2p290 (2011-07-09 Revision 32553) [x86_64-darwin11.1.0]

Ruby location: / usr / local / RVM / BIN / RUBY

Rails Version: rails 3.1.0

Rails location: /usr/local/rvm/gems/ruby-1.9.2-p290/bin/rails

Error message

Quote

/us/local/rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.2.7/lib/mysql2.rb:9:1in `Require ‘: DLOPEN (/ usr / local / RVM / gems / Ruby -1.9.2-P290 / gems / mysql2-0.3.7 / lib / mysql2 / mysql2.bundle, 9): library not loaded: libmysqlclient.18.dylib (loadingerror)

Reference from: /usr/local/rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/lib/mysql2/mysql2.bundle

Reason: image not found – /usr/local/rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/lib/mysql2/mysql2.bundle

From /usr/local/rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.2.7/lib/mysql2.rb:9:in `

From /usr/local/rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `Require ‘

From /usr/local/rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `Block (2 Levels) in Require ‘

From /usr/local/rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:11 `Each ‘

From /usr/local/rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `Block in Require ‘

From /usr/local/rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `EACH ‘

From /usr/local/rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `Require ‘

From /usr/local/rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.18/lib/bundler.rb:120:in `Require ‘

From /Users/doug/sites/simple_cms/config/application.rb:7:in `

From /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:52:in `Require ‘

From /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:52:in `Block in ‘from / usr /LOCAL/RVM/GEMS/Ruby-1.9.2-P290/Gems/RailTies-3.1.0/lib/rails/commands.rb:49:in `TAP ‘

From /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:49:in `

From Script / Rails: 6: in `Require ‘

From Script / Rails: 6: In `

Solution

Sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /users/keo.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.7/lib /MYSQL2/Mysql2.bundle

There is also a mistake of Mongrel

The error prompt is as follows:

Quote

Ding Native Extensions. this Could Take A While …

Error: Error Installing Mongrel:

Error: failed to build gem native extension.

/ usr / local / bin / ruby ??extconf.rb install mangrel

Checking for main () in -lc … YES

CREANG Makefile

Make

GCC -I. -i / usr / local / include / ruby-1.9.1 / i386-darwin9.7.0 -i / usr / local / include / ruby-1.9.1 / ruby ??/ backward -i / usr / local / include /Ruby-1.9.1 -i. -d_xopen_source -d_darwin_c_source -fno-compon -d_xopen_source = 1-^ -g -wall -wno-parentheses -fno-common -pipe -fno-common -o http11.o -c http11. c

Http11.c: in function ‘http_field’:

HTTP11.C: 77: Error: ‘Struct Rstring’ Has No Member Named ‘PTR’

HTTP11.C: 77: Error: ‘Struct Rstring’ Has No Member Named ‘LEN’

Http11.c: 77: Warning: Left-hand Operands Of Comma Expression Has No Effect

Http11.c: 77: Warning: Statement with no effect

Http11.c: in function ‘header_done’:

HTTP11.C: 172: Error: ‘Struct Rstring’ Has No Member Named ‘PTR’

HTTP11.C: 174: Error: ‘Struct Rstring’ Has No Member Named ‘PTR’

Http11.c: 176: error: ‘Struct Rstring’ Has No Member Named ‘PTR’

HTTP11.C: 177: Error: ‘Struct Rstring’ Has No Member Named ‘Len’

Http11.c: in function ‘httpparser_execute’: http11.c: 298: error: ‘struct rstring’ Has no member named ‘PTR’

Http11.c: 299: Error: ‘Struct Rstring’ Has No Member Named ‘LEN’

Make: *** [http11.o] Error 1

The problem is that MONGREL to install pre-1.9.2 rails 3.1

$ sudo gem1.9 install mongrel –pre> building native extensions.this could take a while …> successfully installed mongrel-1.2.0.pre2> 1 gem installed

It is best to change the gemfile as follows:

Gem ‘Mongrel’, ‘~> 1.2.0.pre2’

Related Posts