64bit CentOS 6のdevtool-1.1でc++ 32bit compileできない

devtools-1.1をインストールし、g++のオプションに-m32を追加し、

scl enable devtoolset-1.1 bash

後にmakeするとこんな感じのエラーがでてビルドに失敗。

/opt/centos/devtoolset-1.1/root/usr/libexec/gcc/x86_64-redhat-linux/4.7.2/ld: skipping incompatible /opt/centos/devtoolset-1.1/root/usr/lib/gcc/x86_64-redhat-linux/4.7.2/libstdc++_nonshared.a when searching for -lstdc++_nonshared
/opt/centos/devtoolset-1.1/root/usr/libexec/gcc/x86_64-redhat-linux/4.7.2/ld: cannot find -lstdc++_nonshared

実際、

$ ls -l /opt/centos/devtoolset-1.1/root/usr/lib/gcc/x86_64-redhat-linux/4.7.2/32
...

  • rw-r--r--. 1 root root 78 Jan 26 2013 libgomp.so

lrwxrwxrwx. 1 root root 41 Sep 1 13:52 libitm.a -> ../../../i686-redhat-linux/4.7.2/libitm.a

  • rw-r--r--. 1 root root 77 Jan 26 2013 libitm.so

lrwxrwxrwx. 1 root root 46 Sep 1 13:52 libquadmath.a -> ../../../i686-redhat-linux/4.7.2/libquadmath.a

  • rw-r--r--. 1 root root 70 Jan 26 2013 libquadmath.so

lrwxrwxrwx. 1 root root 44 Sep 1 13:52 libstdc++.a -> ../../../i686-redhat-linux/4.7.2/libstdc++.a

  • rw-r--r--. 1 root root 206 Jan 26 2013 libstdc++.so

lrwxrwxrwx. 1 root root 54 Sep 1 13:52 libstdc++_nonshared.a -> ../../../i686-redhat-linux/4.7.2/libstdc++_nonshared.a

となっているけれど、リンク先のi686-redhat-linuxディレクトリが存在しない。色々試行錯誤した結果、32bit用を明示的にインストールする必要があることが判明。

$ sudo yum install devtoolset-1.1.*i686

でもこれでできるのはなぜか /opt/rh/devtoolset-1.1/root/usr/lib/gcc/i686-redhat-linux/4.7.2/ 。
ということで、

$ sudo ln -s /opt/rh/devtoolset-1.1/root/usr/lib/gcc/i686-redhat-linux /opt/rh/devtoolset-1.1/root/usr/lib/gcc/.

手動でシンボリックリンク貼って解決。ちなみにdebtools-2でも同様。