Home / rfi-damnation / wiki / Development / PhysX / !r9 Register | Log In Requiem for Innocence: Damnation: Installing PhysX for use with Panda3D - Revision 9

Installing PhysX for use with Panda3D

Right now, we just have some instructions for situations that need some special consideration; in general, getting the latest NVidia drivers (or the PhysX redistributable) will suffice.

Windows

We host a copy of the Windows PhysX SDK at http://development.g33xnexus.com/PhysX_2.8.3.21_for_PC_Core.msi. Simply download and install.

64-bit Arch Linux

For PhysX to work on 64-bit Linux, Panda must be built in 32-bit mode. To accomplish this on Arch 64-bit, you need to create a 32-bit chroot. Below are condensed instructions specifically for building Panda3D with PhysX support.

Run all of the following commands as root.

mkdir /opt/arch32
sed -e 's/x86\_64/i686/g' /etc/pacman.d/mirrorlist > /opt/arch32/mirrorlist
sed -e 's/x86\_64/i686/g;s@/etc/pacman.d/mirrorlist@/opt/arch32/mirrorlist@g' /etc/pacman.conf > /opt/arch32/pacman.conf
mkdir -p /opt/arch32/var/{cache/pacman/pkg,lib/pacman,lib/dbus}
echo "#!/bin/sh" > /usr/local/bin/pacman32
echo "pacman --root /opt/arch32 --cachedir /opt/arch32/var/cache/pacman/pkg --config /opt/arch32/pacman.conf" >> /usr/local/bin/pacman32
chmod +x /usr/local/bin/pacman32
pacman32 -Sy
pacman32 -S filesystem licenses bash sed coreutils gzip sudo base-devel ffmpeg ode openal gtk2 cvs python wget pacman pacman-color yaourt xorg-server libpng libjpeg

# Install the correct video drivers...
# NVidia:
pacman32 -S nvidia nvidia-utils mesa
# ATI:
pacman32 -S xf86-video-ati libgl ati-dri
# Intel:
# ??

Create /etc/rc.d/arch32 with the following contents:

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

case $1 in
    start)
        stat_busy "Starting Arch32 chroot"
        mount --bind /proc /opt/arch32/proc
        mount --bind /proc/bus/usb /opt/arch32/proc/bus/usb
        mount --bind /dev /opt/arch32/dev
        mount --bind /dev/pts /opt/arch32/dev/pts
        mount --bind /dev/shm /opt/arch32/dev/shm
        mount --bind /sys /opt/arch32/sys
        mount --bind /tmp /opt/arch32/tmp
        mount --bind /home /opt/arch32/home
        mount --bind /var/run /opt/arch32/var/run
        mount --bind /var/lib/dbus /opt/arch32/var/lib/dbus
        add_daemon arch32
        stat_done
        ;;
    stop)
        stat_busy "Stopping Arch32 chroot"
        umount /opt/arch32/proc/bus/usb
        umount /opt/arch32/proc
        umount /opt/arch32/dev/pts
        umount /opt/arch32/dev/shm
        umount /opt/arch32/dev
        umount /opt/arch32/sys
        umount /opt/arch32/tmp
        umount /opt/arch32/home
        umount /opt/arch32/var/run
        umount /opt/arch32/var/lib/dbus
        rm_daemon arch32
        stat_done
        ;;
    restart)
        $0 stop
        sleep 1
        $0 start
        ;;
    *)
        echo "usage: $0 {start|stop|restart}"
esac
exit 0

Make the environment setup script executable:

chmod +x /etc/rc.d/arch32

Add the environment setup script to startup: (edit /etc/rc.conf and modify the following line to add arch32)

DAEMONS=(syslog-ng network netfs arch32 crond)

Copy/link configuration files into the new chroot and enter the chroot:

cd /opt/arch32/etc

ln -f /etc/passwd* .
ln -f /etc/shadow* .
ln -f /etc/group* .
ln -f /etc/sudoers .

ln -f /etc/rc.conf .
ln -f /etc/resolv.conf .

ln -f /etc/localtime .
ln -f /etc/locale.gen .
ln -f /etc/profile.d/locale.sh profile.d
ln -f /etc/inputrc .

cp /etc/vimrc .
cp /etc/mtab .

# Start the chroot environment
/etc/rc.d/arch32 start

# Enable remote hosts in X (so that graphical apps in the chroot can run)
xhost +local:

# Enter the chroot
chroot /opt/arch32

In the chroot, finish installing required packages, and build Panda3D:

# Rebuild locale information.
/usr/sbin/locale-gen

# Install needed AUR packages: (follow the prompts)
yaourt -S fmodex libsquish physx nvidia-cg-toolkit ttf-bitstream-vera ttf-ms-fonts

# You may also want to install the following: (optional)
yaourt -S colorgcc gvim ctags artwiz-fonts rxvt-unicode

# Also possibly desired: libxxf86dga and xf86dgaproto, fftw, artoolkit, opencv, etc.
# Sadly, there is no Arch or AUR package for vrpn that I'm aware of.

# Build Panda3D: (follow the prompts)
# Note: You may encounter errors dealing with ffmpeg; if you do, edit the PKGBUILD when yaourt asks you, and change the makepanda line to include '--no-ffmpeg'.
yaourt -S panda3d-cvs

64-bit Ubuntu Linux (10.04)

For PhysX to work on 64-bit Linux, Panda must be built in 32-bit mode. On Ubuntu 10.04 this is done using the schroot and debootstrap programs. You will need to decide where to install your chroot, this assumes it's in /opt/lucid32. All you need is an empty directory to install into.

First, install schroot and debootstrap with:

sudo apt-get install schroot debootstrap

Now, we need to configure schroot. Edit /etc/schroot/schroot.conf and add:

[lucid]
description=Ubuntu hardy
location=/opt/lucid32
personality=linux32
priority=3
users=doko
groups=sbuild
root-groups=root

Save, and run the following (replacing /opt/lucid32 with the path to your chroot):

sudo debootstrap --variant=buildd --arch i386 lucid /opt/lucid32 http://archive.ubuntu.com/ubuntu/

After taking longer than the age of the universe, you should now have a nice chroot environment. Except it's entirely non-useful. So, let's fix it.

 sudo cp /etc/resolv.conf /opt/lucid32/etc/resolv.conf
 sudo cp /etc/apt/sources.list /opt/lucid32/etc/apt/

Note: If your current distribution is different than your target distribution, change all of the occurrences of Hardy/Gutsy/Feisty/Edgy etc. to your target distribution.

And now, it's time to chroot in, and install a few packages just to get us off the ground.

sudo chroot /opt/lucid32
apt-get update
apt-get --no-install-recommends install wget debconf devscripts gnupg nano vim  #For package-building
apt-get install sudo
apt-get update  #clean the gpg error message
apt-get install locales dialog  #If you don't talk en_US
locale-gen en_US.utf8  # or your preferred locale
tzselect; TZ='Continent/Country'; export TZ  #Configure and use our local time instead of UTC; save in .profile
exit

Now, it's time to setup mounting and dchroot. To do this, first fix the user and root password:

sudo cp /etc/passwd /opt/lucid32/etc/
sudo sed 's/\([^:]*\):[^:]*:/\1:*:/' /etc/shadow | sudo tee /opt/lucid32/etc/shadow
sudo cp /etc/group /opt/lucid32/etc/
sudo cp /etc/hosts /opt/lucid32/etc/ # avoid sudo warnings when it tries to resolve the chroot's hostname
sudo sed 's/\([^:]*\):[^:]*:/\1:*:/' /etc/gshadow | sudo tee /opt/lucid32/etc/gshadow
sudo cp /etc/sudoers /opt/lucid32/etc/
sudo chroot /opt/lucid32/
dpkg-reconfigure passwd
passwd <username of your first ubuntu user in the admin group>

Setup the following lines in /etc/fstab:

/home           /var/chroot/hardy/home        none    bind            0       0
/tmp            /var/chroot/hardy/tmp         none    bind            0       0
#/media/cdrom    /var/chroot/hardy/media/cdrom none    bind            0       0
/dev            /var/chroot/hardy/dev         none    bind            0       0
proc-chroot     /var/chroot/hardy/proc        proc    defaults        0       0
devpts-chroot   /var/chroot/hardy/dev/pts     devpts  defaults        0       0
Viewing revision 9 | History | Back to current revision | View Markdown source
Last Modified: 07.01.10, 06:45 PM by whitelynx