The Linux Foundation

 
DualArchBuild

From The Linux Foundation

Both ppc64/ppc and s390x/s390 are currently configured as a dual-arch OS, with the 31/32bit architecture being sort of a "secondary" subset of the 64bit arch. While there may be an "automagic" method of setting up the build toolchain so that things "just work", I found I had to do some manual manipulation of things to get a 31/32bit build working.

s390x/s390

Install is sles11/s390x. I have the following development related "32bit" packages installed:

etpglr3:/usr/bin # rpm -qa | grep 32bit | grep devel
ncurses-devel-32bit-5.6-90.55
pam-devel-32bit-1.0.2-20.1
binutils-devel-32bit-2.19-11.28
xorg-x11-devel-32bit-7.4-8.18
libjpeg-devel-32bit-6.2.0-879.10
glibc-devel-32bit-2.9-13.2

etpglr3:/usr/bin # rpm -qa | grep 32bit | grep gcc
libgcc43-32bit-4.3.3_20081022-11.18
gcc-32bit-4.3-62.198
gcc43-32bit-4.3.3_20081022-11.18

In theory, with the current state of things, libjpeg and xorg-x11 should not be required, but I'm working with a 4.0 sdk as we're in the midst of a big change in the sdk and things aren't building yet.

For the LSB SDK, we want the "s390" packages installed.

Then we do some manual manipulation of cc,gcc,c++,g++, and ld.

etpglr3:/usr/bin # ls -l cc* c++* gcc* g++* ld ld.REAL
lrwxrwxrwx 1 root root      3 Feb 27 12:04 c++ -> g++
lrwxrwxrwx 1 root root      7 Feb 27 12:04 c++-4.3 -> g++-4.3
-rwxr-xr-x 1 root root  31456 Feb 20  2009 c++filt
lrwxrwxrwx 1 root root      3 Feb 27 12:02 cc -> gcc
lrwxrwxrwx 1 root root      7 Feb 27 12:02 cc-4.3 -> gcc-4.3
-rwxr-xr-x 1 root root   5041 Feb 20  2009 ccmakedep
-rwxr-xr-x 1 root root    110 Feb 26 18:39 g++
-rwxr-xr-x 1 root root 250976 Feb 20  2009 g++-4.3
-rwxr-xr-x 1 root root    110 Feb 26 17:58 gcc
-rwxr-xr-x 1 root root 246880 Feb 20  2009 gcc-4.3
-rwxr-xr-x 1 root root   2018 Feb 20  2009 gccmakedep
-rwxr-xr-x 1 root root    120 Feb 26 18:35 ld
-rwxr-xr-x 1 root root 480072 Feb 20  2009 ld.REAL

This is different than the original packages had things setup:

etpglr3:/usr/bin # ls -l cc* c++* gcc* g++* ld ld.REAL
ls: cannot access ld.REAL: No such file or directory
lrwxrwxrwx 1 root root      7 May 11  2009 c++ -> g++-4.3
-rwxr-xr-x 1 root root  31456 Feb 20  2009 c++filt
lrwxrwxrwx 1 root root      7 May 11  2009 cc -> gcc-4.3
lrwxrwxrwx 1 root root      7 May 11  2009 g++ -> g++-4.3
-rwxr-xr-x 1 root root 250976 Feb 20  2009 g++-4.3
lrwxrwxrwx 1 root root      7 May 11  2009 gcc -> gcc-4.3
-rwxr-xr-x 1 root root 246880 Feb 20  2009 gcc-4.3
-rwxr-xr-x 1 root root 480072 Feb 20  2009 ld

gcc, g++ and ld are now wrapper scripts:

etpglr3:/usr/bin # cat gcc
#!/bin/bash

if [ `arch` == "s390" ]; then
        ${0##/*/}-4.3 -m31 "$@"
else
        ${0##/*/}-4.3 "$@"
fi
etpglr3:/usr/bin # cat g++
#!/bin/bash

if [ `arch` == "s390" ]; then
        ${0##/*/}-4.3 -m31 "$@"
else
        ${0##/*/}-4.3 "$@"
fi
etpglr3:/usr/bin # cat ld
#!/bin/sh

if [ `arch` == "s390" ]; then
        /usr/bin/ld.REAL -melf_s390 "$@"
else
        /usr/bin/ld.REAL "$@"
fi

So to get a 31bit build, one does as we've done in the old SLES10 chroot, enter the chroot using the "s390" command.

ppc64/ppc

This setup is very similar. One important difference is you have to run the powerpc32 command inside the chroot as the host debian system isn't able to do it.

32 bit packages:

lfdev-power64:/usr/bin # rpm -qa | grep 32bit | grep gcc
libgcc43-32bit-4.3.3_20081022-11.18
gcc43-32bit-4.3.3_20081022-11.18
gcc-32bit-4.3-62.198

lfdev-power64:/usr/bin # rpm -qa | grep 32bit | grep devel
libaio-devel-32bit-0.3.104-140.22
libxml2-devel-32bit-2.7.1-10.8
glibc-devel-32bit-2.9-13.2
fontconfig-devel-32bit-2.6.0-10.6
xorg-x11-devel-32bit-7.4-8.18
gdbm-devel-32bit-1.8.3-371.83
zlib-devel-32bit-1.2.3-106.34
gmp-devel-32bit-4.2.3-10.99
ncurses-devel-32bit-5.6-90.55
libpng-devel-32bit-1.2.31-5.10
freetype2-devel-32bit-2.3.7-25.8
gtk2-devel-32bit-2.14.4-16.1
libjpeg-devel-32bit-6.2.0-879.10
readline-devel-32bit-5.2-147.3
Mesa-devel-32bit-7.2-19.4

Layout of /usr/bin is the same as the s390x.

gcc, g++ and ld wrapper scripts:

lfdev-power64:/usr/bin # cat gcc
#!/bin/bash

if [ `arch` == "ppc" ]; then
        ${0##/*/}-4.3 -m32 "$@"
else
        ${0##/*/}-4.3 "$@"
fi
lfdev-power64:/usr/bin # cat g++
#!/bin/bash

if [ `arch` == "ppc" ]; then
        ${0##/*/}-4.3 -m32 "$@"
else
        ${0##/*/}-4.3 "$@"
fi
lfdev-power64:/usr/bin # cat ld
#!/bin/sh

if [ `arch` == "ppc" ]; then
        /usr/bin/ld.REAL -melf32ppc "$@"
else
        /usr/bin/ld.REAL "$@"
fi

[Article] [Discussion] [View source] [History]