Installing mysql gem on RHEL 5.2 Tikanga. This actually works.
Ok, lets start at the beginning. Nice, freshish RHEL 5.2 box. Try to install mysql gem...
[nick@Dev1 ~]$ sudo gem install mysql
Password:
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... no
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... no
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/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/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out
Yikes! Look familiar? Bummer. First step, brute force install everything I could think might be missing
sudo yum install gcc mysql-server mysql-devel ruby ruby-devel
Turns out, the gcc was having some issues:
[nick@Dev1 mysql-2.7]$ sudo yum install gcc Loading "rhnplugin" plugin Loading "security" plugin intensive-rhel-i386-serve 100% |=========================| 1.2 kB 00:00 rackspace-int-rhel-i386-s 100% |=========================| 1.2 kB 00:00 Excluding Packages in global exclude list Finished Setting up Install Process Parsing package install arguments Resolving Dependencies --> Running transaction check ---> Package gcc.i386 0:4.1.2-42.el5 set to be updated --> Processing Dependency: libgomp = 4.1.2-42.el5 for package: gcc --> Processing Dependency: cpp = 4.1.2-42.el5 for package: gcc --> Processing Dependency: libgomp.so.1 for package: gcc --> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc --> Running transaction check ---> Package cpp.i386 0:4.1.2-42.el5 set to be updated ---> Package glibc-devel.i386 0:2.5-24.el5_2.2 set to be updated --> Processing Dependency: glibc-headers = 2.5-24.el5_2.2 for package: glibc-devel --> Processing Dependency: glibc-headers for package: glibc-devel ---> Package libgomp.i386 0:4.1.2-42.el5 set to be updated --> Running transaction check ---> Package glibc-headers.i386 0:2.5-24.el5_2.2 set to be updated --> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers --> Processing Dependency: kernel-headers for package: glibc-headers --> Finished Dependency Resolution Error: Missing Dependency: kernel-headers is needed by package glibc-headers Error: Missing Dependency: kernel-headers >= 2.2.1 is needed by package glibc-headers
Googling around a little, I found this helpful page which indicated that the default RHEL yum configuration excludes updates from the kernel. That is probably good practice in general, but right now it is preventing us from doing what "needs to be done."
Looking at my /etc/yum.conf file, indeed the kernal was excepted from updates:
[nick@Dev1 ~]$ cat /etc/yum.conf [main] cachedir=/var/cache/yum keepcache=0 debuglevel=2 logfile=/var/log/yum.log distroverpkg=redhat-release tolerant=1 exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 # Note: yum-RHN-plugin doesn't honor this. metadata_expire=1h # Default. # installonly_limit = 3 # PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d exclude=kernel*
So I commented out that line, yum installed gcc, and then off to the races. My googling also noted that passing the --with-mysql-config saves you some trouble, essentially letting it configure itself.
[nick@Dev1 ~]$ 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
Just in case, you might want to uncomment the kernal extension from your /etc/yum.conf file!