rob
July 21st, 2005, 11:58 PM
If you are having trouble getting the mysql gem to install in Fedora 4, ie. getting this error (or similar):
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.6 for inspection.
ruby extconf.rb install mysql\nchecking 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
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.6/gem_make.out
Then when you view gem_make.out, you get something like:
mysql.c:635: error: invalid storage class for function ‘res_free’
mysql.c:637: error: ‘res_free’ undeclared (first use in this function)
mysql.c:637: error: (Each undeclared identifier is reported only once
mysql.c:637: error: for each function it appears in.)
make: *** [mysql.o] Error 1
This error is caused by gcc 4 being used. We need to make it run gcc32 instead, which is the binary that Fedora has for gcc version 3.2.
Go ahead and run this again, just to be sure:
gem install mysql
Let command fail. Once it does, change directory to
/usr/lib/ruby/gems/1.8/gems/mysql-2.6
and run:
ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config
Then, edit Makefile in this directory and search for "i386-redhat-linux-gcc" (without the quotes). Replace it with gcc32.
Also, search for two instances of -mtune=pentium4 (or whatever CPU you use). Take the entire -mtune=cpu reference out.
Save the file, then run make. It should work fine for you!
Then, to register it with gem, run:
gem install mysql
again.
Thanks to the kind person on the the RoR wiki post (http://wiki.rubyonrails.com/rails/show/MySQL+Database+access+problem) that suggested that gcc 4 was to blame.
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.6 for inspection.
ruby extconf.rb install mysql\nchecking 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
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.6/gem_make.out
Then when you view gem_make.out, you get something like:
mysql.c:635: error: invalid storage class for function ‘res_free’
mysql.c:637: error: ‘res_free’ undeclared (first use in this function)
mysql.c:637: error: (Each undeclared identifier is reported only once
mysql.c:637: error: for each function it appears in.)
make: *** [mysql.o] Error 1
This error is caused by gcc 4 being used. We need to make it run gcc32 instead, which is the binary that Fedora has for gcc version 3.2.
Go ahead and run this again, just to be sure:
gem install mysql
Let command fail. Once it does, change directory to
/usr/lib/ruby/gems/1.8/gems/mysql-2.6
and run:
ruby extconf.rb --with-mysql-config=/usr/bin/mysql_config
Then, edit Makefile in this directory and search for "i386-redhat-linux-gcc" (without the quotes). Replace it with gcc32.
Also, search for two instances of -mtune=pentium4 (or whatever CPU you use). Take the entire -mtune=cpu reference out.
Save the file, then run make. It should work fine for you!
Then, to register it with gem, run:
gem install mysql
again.
Thanks to the kind person on the the RoR wiki post (http://wiki.rubyonrails.com/rails/show/MySQL+Database+access+problem) that suggested that gcc 4 was to blame.