Nov 232010
 

The guys at KPIT Cummins provide a well working GCC tool chain for all kind of Renesas CPUs. Takes a lot out of the pain of using those.

For the longest time I used the Linux 10.02 GCC chain for H8. Worked right from the start. Yesterday I thought about updating to 10.03. Should be no problem. So as usual this is what I did:

  1. get the Linux (32 bit) RPM from their site
  2. alien -t gnuh8300_v10.03_elf-1-1.i386.rpm
  3. tar  -x  -v -C / -f gnuh8300_v10.03_elf-1.tgz

Then change my PATH to include the resulting /usr/share/gnuh8300_v10.03_elf-1/bin directory, and then…cc1 failed with libelf.so.1 missing:

/usr/share/gnuh8300_v10.03_elf-1/libexec/gcc/h8300-elf/4.5-GNUH8_v10.03/cc1: error while loading shared libraries: libelf.so.1: cannot open shared object file: No such file or directory

and

harald@v3k7$ ldd
/usr/share/gnuh8300_v10.03_elf-1/libexec/gcc/h8300-elf/4.5-GNUH8_v10.03/cc1
         linux-gate.so.1 =>  (0xf77ca000)
         libdl.so.2 => /lib32/libdl.so.2 (0xf77a4000)
         libelf.so.1 => not found
         libc.so.6 => /lib32/libc.so.6 (0xf7649000)
         /lib/ld-linux.so.2 (0xf77cb000)


Since this is a 32 bit compiler chain and you can see above and below:

harald@v3k7$ file /usr/share/gnuh8300_v10.03_elf-1/bin/h8300-elf-gcc
/usr/share/gnuh8300_v10.03_elf-1/bin/h8300-elf-gcc: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped


the library should be in /lib32/, but although I have ia32-libs installed, there is no /lib32/libelf* at all.
The fix is as simple as can be: get a working libelf.so.1 into /lib32/:

cd /tmp
wget http://ftp.jaist.ac.jp/pub/Linux/ubuntu//pool/main/e/elfutils/libelf1_0.147-2_i386.deb
alien -t libelf1_0.147-2_i386.deb
sudo cp usr/lib/libelf-0.147.so /lib32/
cd /lib32
sudo ln -s libelf-0.147.so libelf.so.1

That adds a 32 bit libelf into /lib32. Now cc1 is happy again:

harald@v3k7$ ldd /usr/share/gnuh8300_v10.03_elf-1/libexec/gcc/h8300-elf/4.5-GNUH8_v10.03/cc1
         linux-gate.so.1 =>  (0xf7784000)
         libdl.so.2 => /lib32/libdl.so.2 (0xf775e000)
         libelf.so.1 => /lib32/libelf.so.1 (0xf7748000)
         libc.so.6 => /lib32/libc.so.6 (0xf75ed000)
         /lib/ld-linux.so.2 (0xf7785000)