Thursday, August 20, 2009

Problem with installation of gem mechanize nokogiri rfeedparser

If the issue is with installtion of :
gem install mechanize


Following package needs:
yum install expat
yum install libexpat
yum install libxml2-devel
yum install libxml
yum install libxml-devel
yum install libxslt libxslt-dev
yum install libxslt-devel

cd /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.3.3
ruby ext/nokogiri/extconf.rb
make
make install

Or just do "gem install mechanize"

----------------------------------------------------------------------
gem install rfeedparser

Building native extensions. This could take a while...
ERROR: Error installing rfeedparser:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
checking for main() in -lc... yes
creating Makefile

make
gcc -I. -I/usr/local/include/ruby-1.9.1/i686-linux -I/usr/local/include/ruby-1.9.1/ruby/backward -I/usr/local/include/ruby-1.9.1 -I. -D_FILE_OFFSET_BITS=64 -fPIC -O2 -g -Wall -Wno-parentheses -o hpricot_scan.o -c hpricot_scan.c
ext/hpricot_scan/hpricot_scan.rl: In function ‘hpricot_scan’:
ext/hpricot_scan/hpricot_scan.rl:172: error: ‘struct RString’ has no member named ‘ptr’
ext/hpricot_scan/hpricot_scan.rl:185: error: ‘struct RString’ has no member named ‘ptr’
ext/hpricot_scan/hpricot_scan.rl:185: error: ‘struct RString’ has no member named ‘len’
ext/hpricot_scan/hpricot_scan.rl:186: error: ‘struct RString’ has no member named ‘len’
ext/hpricot_scan/hpricot_scan.rl:202: error: ‘struct RString’ has no member named ‘ptr’
make: *** [hpricot_scan.o] Error 1


Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.6 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/hpricot-0.6/ext/hpricot_scan/gem_make.out

Resolution:
Need Above all yum packages installed.

http://www.yoshidam.net/xmlparser-0.6.8.tar.gz
cd xmlparser/
ruby extconf.rb
checking for expat.h... yes
checking for XML_ParserCreate() in -lexpat... yes
checking for XML_SetNotStandaloneHandler()... yes
checking for XML_SetParamEntityParsing()... yes
checking for XML_SetDoctypeDeclHandler()... yes
checking for XML_ParserReset()... yes
checking for XML_SetSkippedEntityHandler()... yes
checking for XML_GetFeatureList()... yes
checking for XML_UseForeignDTD()... yes
checking for XML_GetIdAttributeIndex()... yes
checking for ntohl() in -lsocket... no
creating Makefile

make && make install

root@localhost xmlparser]# gem install rfeedparser
Successfully installed rfeedparser-0.9.951
1 gem installed
[root@localhost xmlparser]#

rock na.! if any issue, write to lokahnde.shrikant@gmail.com

How to "gem install mysql" ?

If you trying to install mysql gem, and you are not able to install.
-----------------------------------------------------
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
-----------------------------------------------------

Resolution :


cd /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/ && ruby extconf.rb --with-mysql-config --with-mysql-include

o/p:
checking for mysql_ssl_set()... yes
checking for mysql.h... yes
creating Makefile
[root@localhost:/usr/local/lib/ruby/gems/1.8/gems/mysql-2.7] make
gcc -I. -I. -I/usr/local/lib/ruby/1.8/x86_64-linux -I. -DHAVE_MYSQL_SSL_SET -DHAVE_MYSQL_H -I/usr/include/mysql -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fno-strict-aliasing -fwrapv -fPIC -g -O2 -c mysql.c
gcc -shared -o mysql.so mysql.o -L. -L/usr/local/lib -Wl,-R/usr/local/lib -L. -rdynamic -Wl,-export-dynamic -L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -L/usr/lib64 -lssl -lcrypto -ldl -lcrypt -lm -lc

make install
o/p:/usr/bin/install -c -m 0755 mysql.so /usr/local/lib/ruby/site_ruby/1.8/x86_64-linux

[root@localhost rails
]# irb

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'mysql'
=> true
irb(main):003:0> quit

Cool Done.! It may possible that mysql gem is not in gem list.