On 22/09/2021 21:03, Michael Jones wrote:
>
> Like I said, I think there'd be a big benefit to collaborating, but the image 
> builder is usable as
> is for your purpose, if I understand it correctly. Its just missing the 
> native binaries to speed
> things up.
>

OK, so have a look here for inspiration:

    https://wiki.gentoo.org/wiki/Crossdev_qemu-static-user-chroot


I think that lxc script won't function as is today, but the intent seems clear. 
Basically what I had
failed to notice is:

- The cross compiler is a mix of target arch gcc libs and native binaries, so 
this seems safe to
copy into the chroot

- the libc binary is tagged with the arch, at least when not on amd64, so it's 
possible to have both
arm and amd64 libcs in the chroot at the same time without a collision

- setting LD_LIBRARY_PATH is an interesting way to keep the other libs in an 
unusual directory


So I think it should be possible to simply copy in some/all of the files 
created by crossdev into
the arm chroot and then either simply setup your own gcc symlinks (as per 
distcc) or to use the guts
of the crossdev emerge wrapper scripts to do the same

Simplest way to accurately copy in would seem to be the usual trick (from the 
host):

    ROOT=/chroot_dir emerge -1vK --nodeps 
cross-armv7a-unknown-linux-musleabihf/gcc

Where the package at the end is your crossdev gcc

However, the symlinks would seem to support the case of upgrades in the host 
get carried through
into the target... Need to ponder which is simplest. Installing the package 
allows for uninstall and
tracking the files (I guess it completely replaces and overwrites the chroot 
compiler?). The symlink
method will clash and mask out some files in the chroot, accidentally upgrading 
in the chroot would
break everything.


As an aside, getting static exes is a bit of a pain on gentoo, so to note it 
here for the benefit of
google, you can get a static binutils with the following incantation:

  CFLAGS="$(portageq envvar CFLAGS) -static" EXTRA_ECONF="--disable-shared 
LDFLAGS=--static"
CXXFLAGS=$CFLAGS  ROOT=/tmp/test-binutils emerge -1v --nodeps sys-devel/binutils


Generally just the CFLAGS and CXXFLAGS parts are needed, the EXTRA_ECONF is 
just a trick needed for
binutils. My thought was just to install this static package direct into the 
chroot as per the above.


Ed W


Reply via email to