Cell BE SDK Tips and FAQs
Posted March 29, 2006Hema N Reddy, Cell Ecosystem & Solutions Development, IBM
Copyright © 2006 International Business Machines®, All Rights Reserved.
1
Failure in setting up ramdisk:
The tails of install.sh shows:
make:
Entering directory `/home/cell/x86CellSdk/ramdisk'./build_image /opt/PPC-FC4/rpms ../sysroot ../systemsim-cell-release/run/cell/linux/sysroot_disk
Checking setup:
/opt/PPC-FC4/rpms /home/cell/x86CellSdk/ramdisk
/home/cell/x86CellSdk/ramdisk
288000+0 records in
288000+0 records out
mke2fs 1.37 (
mke2fs: Permission denied while trying to determine filesystem size
mount: wrong fs type, bad option, bad superblock on /dev/loop1,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
do_mount: Could not mount image ../systemsim-cell-release/run/cell/linux/sysroot_disk over mount directory mnt
make: *** [../systemsim-cell-release/run/cell/linux/sysroot_disk] Error 1
make: Leaving directory `/home/cell/x86CellSdk/ramdisk'
dmesg provides the following detail ...
loop: loaded (max 8 devices)
VFS: Can't find an ext2 filesystem on dev loop0.
This problem is a result of the Security Enhanced Linux configuration. A default clean install sets this to 'enforcing'. It needs to be 'permissive'.
If you are installing Fedora Core 4 from scratch, set Security Enhanced Linux to permissive. If you already have FC4 installed, do this:
edit /etc/selinux/config and change your policy from "enforcing" to "permissive",
then
relabel the disk: touch
/.autorelabel and reboot.
2
Error: missing GL/glut.h
The problem is, depending upon how the linux installation is done,
sometimes the glut.h file is missing in /usr/include/GL/ either due to a
mismatched version of glut/freeglut package or incomplete update after linux
installation. It can solved by updating the freeglut package or recompiling the
source and re-installing it. You will not be able to uninstall it, because it
has system level KDE dependencies that will not allow uninstall.On Fedora, you might do this:
"yum install freeglut-devel"
"yum install xorg-x11-devel"
A few sites where to find glut:
http://freeglut.sourceforge.net/
http://rpmfind.net/linux/rpm2html/search.php?query=gluthttp://rpmfind.net/linux/rpm2html/search.php?query=glut
3
Error message about libtk8.4.so
On some installations you might see the following
error:error while loading shared libraries: libtk8.4.so: cannot open shared object file: No such file or directory
Here’s how to fix it:
On fedora installations(FC4 and below): you need to load the Tk package, which is not included in a default install of Fedora Core 4. As root, run this command:
# yum install tk On other platforms(Note: unsupported by Cell SDK), you might get different errors with tcl and tk libraries. You might want to try re-installing or upgrading the libraries:
Ex. Red Hat 9.0 and below: (You will find tcl and tk libraries)
http://www.tcl.tk/software/tcltk/downloadnow84.tml
4
Cannot find callthru utility on the Systemsim console
Use the loopback mount feature to copy over the callthru
utility to the simulator kernel. On the terminal window:# cd systemsim-cell-release/run/cell/linux
# mount -o loop sysroot_disk /mnt
# cd <TOP of sdk source>systemsim-cell-release/sample/callthru
Copy the correct Makefile from src/tools/callthru and place it in systemsim-cell-release/sample/callthru
# cp ../../../src/tools/callthru/Makefile .
Compile the source for callthru
# make
Copy it to the loopback mounted file system
# cp callthru /mnt/bin
# umount /mnt
From now on, the callthru utility will always be there on the systemsim
5
Cannot find spu-gcc/xlc compilers
Set the PathModify your shell profile to forever set the path
# vi ~<user>.bash_profile
Add the following lines of text:
export PATH=/opt/ibmcmp/xlc/1.0/bin:/opt/sce/toolchain-2.3/spu/bin:/opt/sce/toolchain-2.3/ppu/bin:$PATH
Observe the directory structure at the <TOP> level, make.env, make.footer, make.header, Makefile
6
C/C++ name mangling, spu-g++ link errors
On sdk1.0, I am seeing the following errors:error: redeclaration of C++ built-in type `wchar_t'
sdk1.0/sysroot/usr/spu/include/stdio.h:26: error: expected `,'
or `...' before "new"
Do this to fix them:
open the file ./sysroot/usr/spu/include/stddef.h
Change the following:
typedef char wchar_t;
TO:
#ifndef __cplusplus
typedef char wchar_t;
#endif
open the file ./sysroot/usr/spu/include/stdio.h
Change line
extern int rename(const char * old, const char *new);
To
extern int rename(const char * src, const char *dest);
7
ppu-g++ link errors
On sdk1.0, I am seeing link errors that denote name
mangling.Do this:
You will need to modify the header file to declare the function call that’s raising the flag within the C/C++ friendly declarations:
#ifdef __cplusplus
extern "C" {
#endif
<API>
#ifdef __cplusplus
}
#endif
8
How do I uninstall currently installed version of SDK?
On
SDK1.0:The original install is going to write files into:
/opt/sce
/opt/ibmcmp
/opt/PPC-FC4
rpm is used for xlc (/opt/ibmcmp) and the rpms (/opt/PPC-FC4) so you can use rpm to unsinstall (rpm --erase). Starting with SDK 1.0.1 the sce tools are also installed via rpm.
The rest of the sdk will be in the directory and subdirectories where the original install.sh ran.
9
crt1.o: No such file: No such file or directory
Most probably you are using ppu64-gcc. If you are
not using the standard makefiles from the SDK [make.env, make.footer,
make.header], and manually compiling on the command line, you need to use
ppu32-gcc.10
Makefile version problem
Error seen:Install.sh fails complaining about makefile version being older than 3.8
Do this:
Get a version of makefile from any of the open source websites and install it;
Point the make path to the newly installed version.
11
Compiling math function in SDK
Add –lm to the list of importsIMPORTS = -lm
Recompile the program
12
How to print vectors
You can use spu_extract to print the values:For ex.
vector unsigned int v;
for (j=0; j<4; j++) {
printf("%d ", spu_extract(v, j));
}
However, if measuring performance, what you might want to do, is unroll the loop and print it like:
Printf(“%d %d %d %d “,spu_extract(v, 0), spu_extract(v, 1), spu_extract(v, 2), spu_extract(v, 3));