Developing Pixar's Renderman and Maya using Gentoo

In this post I will show you how to build a RHEL4 glibc/gcc system compatible with a source based Linux like Gentoo.
The problem facing many large companies creating software for Linux is that there is a vast array of distro's out there -which one do we create for ?
The usual answer is whatever is the most popular, for example Redhat. Don't get me wrong, my first Linux install was a Redhat install way back in 1998. At that time people were leaving the sinking SGI boat in droves for NT. I would rather die than be tied to a dos prompt all day, so at the time I took up Linux as an alternative to Irix.
Till now I have tried most Linux variants however I like to build my own using either Linux from scratch or Gentoo why? Because Redhat and other binary based builds are good until you need some slight adjustments.
Let me give you an example, a while back I had to install a rpm on a Fedora box for a client, problem was that the rpm was not built with the appropriate Japanese language libraries. Ok so I have to get another lib rpm right? Wrong, I was in rpm hell going back and forth between
binary and source rpms to get what was a fairly simple request. With Gentoo ( or any source based self built Linux ) everything is built from source on your box. A kit car guys Linux. Dont like the muffler? no problem - don`t build it sort of Linux.
I have never had a problem running graphics packages like XSI, Maya or Renderman on Gentoo, hey I ran them on Opensolaris back in 2005 which was a really good trick - they ran at native Linux speeds too!
Using binaries from a third party can be a little tricky, the real problem arises when developing for them. The rule of thumb is to use the same distro the creator used when making the binaries in question. Why?
In order of importance these should be preferably be the same version and be built with the same parameters, libraries etc, in order of importance.

  • glibc
  • gcc
  • linked libraries
  • kernel (sometimes)
So as you can understand the easiest way is to install the same distro as the binary maker - I don't take the easy route.
Please note there also three other ways:
  1. to also have secondary glibc's, but I will save that confusion for another post.
  2. to have chroots for each development in question, again I will save that confusion for another post.
  3. dual boot.
The setup
The machine is a 64 bit chip (intel core2 duo laptop)
64bit Linux for Pixar's Renderman Pro 13.5x server comes as following combinations:
gcc 3.3.3 - glibc 2.3.x
RHEL 4.0-64 (gcc 3.4.3, glibc 2.3.x)
RHEL 4.0-64 (gcc 4.0.2, glibc 2.3.4)
FC5-64 (gcc 4.1.0, glibc 2.4)

64bit Linux Maya 2008 comes as following single built binary:
RHEL WS 4.0 update 5(gcc 4.1.2, glibc 2.3.4-2.36)
So the best option (out of a very bad selection) we have is to have a system glibc build of 2.3.4 built with gcc 3.4.3 with an additional gcc 4.1.2 for Maya . Why build with 2.3.4 and not 2.3.6 because it is hard if not impossible to downgrade a glibc. Upgrades are trivial.

# This first step is unnessesary unless you want to have all data
# encrypted. No data at my company is unencrypted - company
# policy
# replace sda? With your partition
env-update && source /etc/profile && export PS1="(chroot) $PS1" && \
emerge app-shells/bash && \
yes -5 | etc-update && \
emerge -vO1 libperl && \
emerge -vO1 gdbm && \
emerge -vO1 perl && \
emerge -v1 autoconf && \
emerge -vO1 findutils && \
emerge binutils-config && \
emerge =binutils-2.16.1-r3 && \
env-update && source /etc/profile && export PS1="(chroot) $PS1" && \
binutils-config --amd64 --x86 1 && \
env-update && source /etc/profile && export PS1="(chroot) $PS1" && \
emerge -v1 gcc-config && \
emerge -vO1 sys-libs/zlib gettext sys-apps/texinfo bison gcc && \
gcc-config 1 && \
binutils-config --amd64 --x86 1 && \
env-update && source /etc/profile && export PS1="(chroot) $PS1" && \
emerge -vO =python-2.3.6-r3 && \
emerge -vO python && \
emerge -vO portage && \
yes -5|etc-update
chmod 644 /etc/resolv.conf
emerge -vO1 sys-apps/baselayout && \
yes -5|etc-update
env-update && source /etc/profile && export PS1="(chroot) $PS1" && \
bash /usr/portage/scripts/bootstrap.sh && \
emerge gcc && emerge -ve system && emerge -ve system && USE=symlink emerge tuxonice-sources
#cp /usr/src/linux/be* /mnt/gentoo/usr/src/linux/
#cp /usr/src/linux/.config /mnt/gentoo/usr/src/linux/
cd /usr/src/linux/ && ./be_make.sh && \
emerge fcron logrotate metalog dhcp acpid ntp sysfsutils udev jfsutils vim rcs \
gentoolkit xorg-x11 tmpreaper nfs-utils davfs2
emerge pbbuttonsd kde-meta kde-i18n netplug \
scim-anthy scim-qtimm kasumi scim-input-pad scim tomoe tcsh
# FROM SOURCE MACHINE RUN
#cp -rf ~/.ssh /mnt/gentoo/root/
#for x in dispatch-conf.conf fstab ; do cp -ai /mnt/gentoo/etc/$x /mnt/gentoo/etc/.$x.orig && cp /etc/$x /mnt/gentoo/etc/$x ; done
#base="etc/init.d";for x in "PixarLicenseServer" "alfmaitred" alfserver be_pixarbak pixard; do cp -a /$base/$x /mnt/gentoo/$base/$x ; done
#base="etc/conf.d";for x in "PixarLicenseServer" "alfmaitred" alfserver be_pixarbak pixard pixar; do cp -a /$base/$x /mnt/gentoo/$base/$x ; done
#base="etc/ssh";for x in "ssh_config" "sshd_config"; do cp -ai /mnt/gentoo/$base/$x /mnt/gentoo/$base/.$x.orig && cp /$base/$x /mnt/gentoo/$base/$x ; done
#base="etc/conf.d";for x in ntp-client net clock hostname ; do cp -ai /mnt/gentoo/$base/$x /mnt/gentoo/$base/.$x.orig && cp -a /$base/$x /mnt/gentoo/$base/$x ; done
#base="etc/modules.d";for x in alsa g_file_storage ipaq ; do cp /$base/$x /mnt/gentoo/$base/$x ; done
# cp /mnt/gentoo/etc/modules.autoload.d/kernel-2.6 /mnt/gentoo/etc/modules.autoload.d/.kernel-2.6.orig && cp /etc/modules.autoload.d/kernel-2.6 /mnt/gentoo/etc/modules.autoload.d/
#update-modules
#cp -a /backing_file /mnt/gentoo
#cp -a /etc/X11/xorg.conf /mnt/gentoo/etc/X11/
for x in PixarLicenseServer acpid alfmaitred dbus fcron hald metalog ntp-client pixard portmap sshd vmware xdm;do rc-update add $x default;done
emerge mozilla-firefox nspluginwrapper acroread netscape-flash adobesvg xdm sudo
emerge -ve world
emerge -ve world
#emerge =gcc-4.0.2-r3 =gcc-4.1.2 =gcc-4.1.0-r1
emerge =gcc-4.0.2-r3 =gcc-4.1.2 sys-fs/sshfs-fuse
#upgrade to gcc-4.1.2
#gcc-config 7
groupadd -g 777 blocal
useradd -d /home/blocal -g blocal -G winusers,winadmins,guest3,guest2,guest1,leonard,yoshi,hisako,roseatte,pixar,vmware,plugdev,cron,fcron,users,video,tape,dialout,cdrom,audio,uucp,floppy,disk -s /bin/bash -u 1000 blocal

for x in \
winuser:winusers:`head -c 10 /dev/random | base64 |sed 's/[^a-zA-Z0-9]//g'`:8880:8881 \
pixar:pixar:`head -c 10 /dev/random | base64 |sed 's/[^a-zA-Z0-9]//g'`:7771:7771 \
bglobal:bglobal:`head -c 10 /dev/random | base64 |sed 's/[^a-zA-Z0-9]//g'`:8001:8001 \
roseatte:roseatte:`head -c 10 /dev/random | base64 |sed 's/[^a-zA-Z0-9]//g'`:8002:8002 \
hisako:hisako:`head -c 10 /dev/random | base64 |sed 's/[^a-zA-Z0-9]//g'`:8003:8003 \
yoshi:yoshi:`head -c 10 /dev/random | base64 |sed 's/[^a-zA-Z0-9]//g'`:8004:8004 \
leonard:leonard:`head -c 10 /dev/random | base64 |sed 's/[^a-zA-Z0-9]//g'`:8005:8005 \
guest1:guest1:`head -c 10 /dev/random | base64 |sed 's/[^a-zA-Z0-9]//g'`:8006:8006 \
guest2:guest2:`head -c 10 /dev/random | base64 |sed 's/[^a-zA-Z0-9]//g'`:8007:8007 \
guest3:guest3:`head -c 10 /dev/random | base64 |sed 's/[^a-zA-Z0-9]//g'`:8008:8008 \
winadmin:winadmins:`head -c 10 /dev/random | base64 |sed 's/[^a-zA-Z0-9]//g'`:8879:8880
do
echo $x|awk -F: '{ print "groupadd -g "$5" "$2 \
" && useradd -d /home/"$1" -g "$2" -p " $3 " -s /bin/bash -u "$4" "$1 \
" && mkdir -m 750 /home/"$1" && chown "$1":"$2" /home/"$1\
" && usermod -a -G winusers "$1}'
#echo $x|awk -F: '{ print "userdel "$1" ; groupdel "$2" ; rmdir /home/"$1}'
done

passwd root
passwd blocal
mkdir /mnt/oldroot
echo "/dev/mapper/oldroot /mnt/oldroot jfs noatime 1 0" >> /etc/fstab
env-update && source /etc/profile && export PS1="(chroot) $PS1"