You are here: TWiki > LinuxDevTools Web > AcratchBoxTips r13 - 26 Nov 2008 - 16:04 - PeterPearse


Start of topic | Skip to actions

scratchbox Tips & Tricks

See also

Foreign toolchains: Helper scripts

sb-toolchains-extra is in the process of changing to define runtime c files
Use tag sb-toolchain-extras_1.0.8 until the changes are complete.
darcs get --set-scripts-executable --tag sb-toolchain-extras_1.0.8 http://scratchbox.org/repos/1.0/sb-toolchain-extras
OR update scratchbox
Problems may occur if you get a new sb-toolchain-extras into an old scratchbox which does not provide the necessary support.

sbrshd

  • delete /etc/mtab before reboot to avoid remounting (possibly deleted) scratchbox directories
  • sbrshd target must be rebooted if a scratchbox target is deleted & then remade

Inconsistency detected by ld.so: rtld.c: 1192: dl_main: Assertion ‘(void *) ph->p_vaddr == _rtld_local._dl_sysinfo_dso’ failed!

Disable “vdso”:
Outside scratchbox:
sudo -i
echo 0 > /proc/sys/vm/vdso_enabled

mmap: Permission denied

Outside scratchbox
sudo -i
echo 4096 > /proc/sys/vm/mmap_min_addr
Can be done in the boot script on most distributions...

fakeroot hangs (probably not a scratchbox only problem)

fakeroot uses the loopback interface. If this is not running then fakeroot hangs and you see messages like
libfakeroot: connect: Connection timed out
Try
ifconfig lo 127.0.0.1 up
(outside scratchbox) to start the interface
ifconfig -a should show LOOPBACK RUNNING.

Ensure hosts are consistent

Example - toolchains built on a 64 bit host wont run on a 32 bit machine.

System Poisoning Warnings

Versions of the CodeSourcery toolchain from 2007Q1 onwards emit a warning under scratchbox regarding poisoning of the system directories & includes.
Some package configure scripts treat all warnings as a failure. Rather than switching this feature off and missing other warnings, stop this by supplying the flag -Wno-poison-system-directories
export SBOX_EXTRA_COMPILER_ARGS=-Wno-poison-system-directories

Foreign toolchains with multiple architectures

Some toolchains, e.g. CodeSourcery, include several versions of the system libraries
so that the same tools can be used to cross-compile several architectures e.g. armel, thumb, armv4t, marvell-f. This may confuse the scratchbox ~/sb-toolchain-extras/confhelper/create_toolchain_conf.py script
when it tries to configure the libraries to link with.
One solution is to remove the directories containing the extra libraries, once the (foreign) toolchain is installed on the host,
but before the scratchbox "foreign" toolchain installation is started e.g.
for d in thumb2, marvell-f, armv4t
do
   find <compiler directory> -name $d -exec rm -fr {} \;
done
TODO I've always used the armel variant - try installing thumb2
In that case we might need to copy thumb2 libraries up, rather than deleting all thumb2 directories......

Foreign toolchains have different directory structures

To get the sb-toolchain-extras to build you may need this link in the top level include directory
ln -s /scratchbox/compilers/<foreign compiler>/arm-none-linux-gnueabi/include/c++

Foreign toolchains - conf files

  • COMPILER_PACKAGE needs to be replaced with one debian (lower case alphanum or '-+.') word - it is used in the package name.

Using your own host binary

  • Add the binary tag to the scratchbox define
  • Ensure the to & from directories are in the scratchbox defines
export SBOX_REDIRECT_BINARIES="${SBOX_REDIRECT_BINARIES},/usr/invented/mytag:/home/my/binary"
export SBOX_REDIRECT_FROM_DIRS=${SBOX_REDIRECT_FROM_DIRS}:/usr/invented
export SBOX_REDIRECT_TO_DIRS=${SBOX_REDIRECT_FROM_DIRS}:/home/my
Note that the redirected binary and directory need not exist - the target binary must.
Show the redirected binary isn't present in the scratchbox file system, whilst the target binary is .
[sbox] > /usr/invented/mytag
bash: /usr/invented/mytag: No such file or directory
[sbox] > ls /usr/invented
ls: /usr/invented: No such file or directory
[sbox] > ls /usr/invented/mytag
ls: /usr/invented/mytag: No such file or directory
[sbox] > ls /scratchbox/invented/binary
/scratchbox/invented/binary
[sbox] > /scratchbox/invented/binary 
Hello from /scratchbox/invented/binary
Set up the redirection
[sbox] > export SBOX_REDIRECT_FROM_DIRS=${SBOX_REDIRECT_FROM_DIRS}:/usr/invented
[sbox] > export SBOX_REDIRECT_TO_DIRS=${SBOX_REDIRECT_TO_DIRS}:/scratchbox/invented
[sbox] > export SBOX_REDIRECT_BINARIES=${SBOX_REDIRECT_BINARIES},/usr/invented/mytag:/scratchbox/invented/binary
Show it works, although the redirected binary still isn't there
[sbox] > /usr/invented/mytag
Hello from /scratchbox/invented/binary
[sbox] > ls /usr/invented/mytag
ls: /usr/invented/mytag: No such file or directory
[sbox] > echo $SBOX_REDIRECT_FROM_DIRS
/bin:/usr/bin:/usr/local/bin:/usr/invented
[sbox] > echo $SBOX_REDIRECT_TO_DIRS
/scratchbox/devkits/debian-sarge/bin:/scratchbox/devkits/perl/bin:/scratchbox/devkits/cputransp/bin:/scratchbox/devkits/doctools/bin::/scratchbox/tools/bin:/targets/links/arch_tools/bin:
/scratchbox/compilers/bin:/scratchbox/invented
[sbox] > echo $SBOX_REDIRECT_BINARIES 
,/scratchbox/devkits/doctools/bin/install-info:/scratchbox/devkits/debian-sarge/bin/install-info,/usr/lib/dpkg/enoent:/scratchbox/devkits/debian-sarge/lib/dpkg/enoent,/usr/invented/mytag:
/scratchbox/invented/binary
Exercises for the reader
  • MUST the TO directory be under /scratchbox?
  • MUST the target executable be a binary, or could it be a script and/or link

Avoiding building all those target packages that are only used for a build

scratchbox HowTo

Bits I found unclear in the scratchbox instructions

Example is adding quilt
  • Where's the sb-devkit-template go?
    In scratchbox, host target , in ~.
  • How do we get the make to find the download site for the source.tgz? I couldn't see file_locations.mk being used so I included it in gar.conf.mk
    I added QUILT_SITE=http://blah/ to it, trailing slash is required
    and added $(QUILT_SITE) to the space seperated list MASTER_SITES in gar.conf.mk
  • Where do we make the tarball
    Outside scratchbox in /scratchbox/users/<user name>/home/<user name>/sb-<devkit name>-devkit seemed to work
    The tarball was in /scratchbox/users/<user name>/home/<user name>
  • Even after that you may have to fool dpkg-checkdeps by
    • Fudging an entry in the scratchbox target /var/lib/dpkg/status file.
      The easiest method (providing your host is a Debian distribution) is to copy the entry from the host /var/lib/dpkg/status
      Check version
    • Fudging the /var/lib/dpkg/info/debhelper.list file
      If you copy the host file check the contents against the scratchbox devkit....
  • And the devkit wont be available for selection until you extract the tarball into / and restart scratchbox.

-- PeterPearse - 31 Aug 2007

Edit | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r13 < r12 < r11 < r10 < r9 | More topic actions
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Use of this site is governed by these TermsAndConditions
Ideas, requests, problems regarding TWiki? Send feedback