Tuesday, September 18, 2007

Missing libstdc++.so.5 on FedoraCore 7

While installing the latest Firefox and Java 6 on a newly installed
Fedora Core 7 box, I encountered the following error, here is the
one received while unpacking the Java EE 5 SDK Update 3 for Linux,

# ./java_ee_sdk-5_03-linux.bin
./java_ee_sdk-5_03-linux.bin: error while loading shared libraries:
libstdc++.so.5: cannot open shared object file: No such file or directory
#
Looking a little deeper into the GCC coming with the FC7,

# file /usr/bin/gcc
/usr/bin/gcc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),
dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped
#

And now with the Java binary,

# file java_ee_sdk-5_03-linux.bin
java_ee_sdk-5_03-linux.bin: ELF 32-bit LSB executable, Intel 80386, version 1
(SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not
stripped
#
It looks like the Java file was compiled with an older GCC.
Let's see what C/C++ library FC7 provides:
# ls /usr/lib/libstdc*
4 /usr/lib/libstdc++.so.6@ 924 /usr/lib/libstdc++.so.6.0.8*
#
By running a yum search, we found that there is a compatibility
library available for the older GCC:
# yum search libstdc++
Loading "installonlyn" plugin


compat-libstdc++-33.i386 3.2.3-61 fedora
Matched from:
compat-libstdc++-33
The compat-libstdc++ package contains compatibility standard C++ library
from GCC 3.3.4.

...
#
Let's install it,
# yum install compat-libstdc++-33
...
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
compat-libstdc++-33 i386 3.2.3-61 fedora 232 k

...
...
Running Transaction
Installing: compat-libstdc++-33 ######################### [1/1]

Installed: compat-libstdc++-33.i386 0:3.2.3-61
Complete!
#

Now the missing library can be seen on the system,

# ls /usr/lib/libstdc*
0 /usr/lib/libstdc++.so.5@ 4 /usr/lib/libstdc++.so.6@
724 /usr/lib/libstdc++.so.5.0.7* 924 /usr/lib/libstdc++.so.6.0.8*
#
And next to run the Java install and Firefox again, both programs worked.

Install Ruby On Rails on Fedora Core 7

Here are the steps to install Rails on a newly installed Fedora Core 7(FC7)

Step 1. Install Ruby

First we need to install Ruby related packages to the FC7.

If you've selected Ruby software package during the FC7 installation,
the installed version is already old. The installed version from
the FC7 is something like 1.8.6-2 and to a yum search showing that
there is already updates for 1.8.6.36-3. Thus it may be easier to
simply install Ruby manually(as shown below) after the FC7 install,
if you like to start with the latest of the software.

If you start with a freshly installed FC7 or this is the first time
you run yum on the system, you may need to run the following to
set up the yum:

$ yum grouplist

Next, you need to become the root:

$ su -

Install the following Ruby related packages that are essential for
anyone who likes to do development in Ruby:

# yum install ruby ruby-libs ruby-devel ruby-irb ruby-ri ruby-rdoc ruby-docs

Depends on type of the applications, here are few more useful packages:

# yum install eruby eruby-libs eruby-devel bsf ruby-tcltk


Step 1.1. Manually compile Ruby

If you like to compile the Ruby by hand, here are the steps, run as root:

# wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.6.tar.gz
# cd /tmp
# tar zxf ruby-1.8.6.tar.gz
# cd ruby-1.8.6
# ./configure --prefix=/usr
# make
# make test
# make install



Step 2. Install MySQL

If you haven't selected MySQL during FC7 installation, you need to
do it here:

# yum install mysql mysql-devel mysql-server

Step 3. Install RubyGems

It is recommended to install Rails from RubyGems. The latest
RubyGems as of this writing can be downloaded as follows:

# wget http://rubyforge.org/frs/download.php/20989/rubygems-0.9.4.tgz

Move the downloaded file to, say, /opt, unzip and install:

# mv rubygems-0.9.4.tgz /opt/
# cd /opt
# tar xvfz rubygems-0.9.4.tgz
# cd rubygems-0.9.4
# ruby setup.rb

Step 4. Install Rails

# gem install rails --include-dependencies

Sometime the first install will fail with error such as
failed to find the package, just try run the install again.

Setup MySQL and Install Rails MySQL interface

Normally you will need a MySQL root user:

# service mysqld restart
# mysqladmin -u root password 'your-mysql-root-password'

Here is the standard install of MySQL interface library for Rails:

# gem install mysql -- --with-mysql-config=/usr/bin/mysql_config


Step 5. Rails test

To verify the Rails installed correctly, simply create a skeleton
test in a local directory:

# rails test
# cd test
# ruby script/server

And then point your browser to:

http://localhost:3000/

If you see a Rails welcome page, then everything should have been
set up successfully.