[Aboriginal] Unable to use gcc inside chroot of latest aboriginal.

Rob Landley rob at landley.net
Sun Jan 10 17:00:26 PST 2016


On 01/09/2016 02:54 PM, KARBOWSKI Piotr wrote:
> Hi,
> 
> It seems that something is kind of broken with the GCC when used in
> chroot.

There's a more/chroot-splice.sh script that sets up a chroot, which
works fine for me here? (It requires a control image to mount on /mnt,
but you can feed it an empty directory.)

> When I combine the root-filesystem with native-compiller and
> chroot there, the gcc runs cc, which then fails to run 'rawcc'.

How are you combining the two?

> Appending the /usr/*-unknown-linux/bin/ to $PATH does make gcc no longer
> crash like that, but I think it was not intendent to require altering
> $PATH.

It wasn't. You should be able to basically:

  mkdir out
  cp -a dir1/. out
  cp -a dir2/. out
  chroot out

(Without the /. cp has an annoying habit of creating out/dir1 or
out/dir2 but that's a cp issue inherent to posix...)

What chroot-splice.sh does is actually:

  # Copy root filesystem and native compiler
  cp -lan "build/root-filesystem-$1/." "$CHROOT" || exit 1
  cp -lan "build/native-compiler-$1/." "$CHROOT" || exit 1

The -l hardlinks the original files rather than creating a new copy.

The sbin/init.sh script under qemu (from
sources/root-filesystem/sbin/init.sh) does:

  [ -b /dev/[hsv]da ] &&
    mkdir -p /usr/overlay && mount /dev/[hsv]da /usr/overlay

and then:

  # Call overlay/init if available
  [ -e /usr/overlay/init ] && . /usr/overlay/init

Which comes from sources/toys/hdainit.sh and starts with:

  # splice hda into /
  cp -rFs /usr/overlay/. /

So chroot_splice.sh is doing cp -ln (hardlink, no overwrite) and that's
doing cp -Fs (delete destination file first (if any), symlink).

The only conflicting file between the two should be /bin/sh by the way.
(Switching from hush to bash 2.05b.)

Rob

 1452474026.0


More information about the Aboriginal mailing list