Code: Select all
#alias emerge-chroot="ROOT=/ CBUILD=$(portageq envvar CHOST) HOSTCC=$CBUILD-gcc emerge"
alias emerge-chroot="\
ROOT=/ \
CBUILD=aarch64-unknown-linux-gnu \
PORTAGE_TMPDIR=/tmp/ \
DISTDIR=/var/cache/distfiles \
PKGDIR=/var/cache/binpkgs \
PORT_LOGDIR=/var/log/portage \
HOSTCC=aarch64-unknown-linux-gnu-gcc \
emerge"Working on an x86_64 (amd64) workstation with lots of RAM and CPU, I am setting up a cross-build environment with e.g.
Code: Select all
TARGET=armv7a-unknown-linux-gnueabihfI have very carefully followed Gentoo wiki guides to set up crossdev (https://wiki.gentoo.org/wiki/Crossdev) and a cross build environment with qemu chroot (https://wiki.gentoo.org/wiki/Cross_build_environment). I notice the warning at the top of the latter that it might need to be updated, and I have not managed to get cross-${TARGET}/rust-std to work (so skipping that for now).
I carefully noticed where the system creates binpkgs, and it seems logical when I'm "just" using the crossdev toolchain to run e.g.
Code: Select all
${TARGET}-emerge -uavDN @system --keep-goingCode: Select all
armv7a-unknown-linux-gnueabihf-rpi23A-packages -> /usr/armv7a-unknown-linux-gnueabihf/var/cache/binpkgsAs the cross build environment wiki article notes, not all packages can be built this way -- some have to be built natively, so I've followed that guide's process for setting up a qemu chroot. This includes setting up an alias for use in the chroot
Code: Select all
alias emerge-chroot="ROOT=/ CBUILD=$(portageq envvar CHOST) HOSTCC=$CBUILD-gcc emerge"Code: Select all
alias emerge-chroot="ROOT=/ CBUILD=armv7a-unknown-linux-gnueabihf HOSTCC=armv7a-unknown-linux-gnueabihf-gcc emerge"Also, the crossbuild environment make.conf (host filesystem /usr/${TARGET}/etc/portage/make.conf contains the following
Code: Select all
CHOST="armv6j-unknown-linux-gnueabihf"
CBUILD=x86_64-pc-linux-gnu
ARCH="arm"
# use this for cross-building
ROOT=/usr/${CHOST}/
# use this for chroot (or carefully use alias emerge-chroot to specify ROOT, CBUILD)
#ROOT=/This seems to "work" in that I can emerge the rest of the system with e.g.
Code: Select all
(armv7a chroot) hostname / # emerge-chroot -uavDN @systemIs this normal behavior inside the chroot, or do I have some environment variable set wrong?
I noticed that the cross build environment article instructs
Do I need to do something like that for the chroot's /var also?Create the Portage temporary directory:Code: Select all
ln -s /tmp /usr/armv6j-hardfloat-linux-gnueabi/tmp
That would point the chroot's /usr/${TARGET}/var --> /var which should map it correctly for the host workstation's filesystem -- but I want to know if that is an appropriate solution or more of a work-around, when a more basic solution should have fixed it
