Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
handbook: chroot fails "no such file or directory"
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
jpsollie
Guru
Guru


Joined: 17 Aug 2013
Posts: 323

PostPosted: Sun Nov 06, 2022 7:27 am    Post subject: handbook: chroot fails "no such file or directory" Reply with quote

I have a crossdev setup in aarch64-unknown-linux-gnu.
Whereas it worked before, currently I can't compile several packages anymore, and python is the most important one here
Code:

 * Disabled modules:  gdbm _tkinter _elementtree pyexpat
 * econf: updating Python-3.10.8/config.sub with /usr/share/gnuconfig/config.sub
 * econf: updating Python-3.10.8/config.guess with /usr/share/gnuconfig/config.guess
/usr/aarch64-unknown-linux-gnu/tmp/portage/dev-lang/python-3.10.8_p2/work/Python-3.10.8/configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=aarch64-unknown-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --docdir=/usr/share/doc/python-3.10.8_p2 --htmldir=/usr/share/doc/python-3.10.8_p2/html --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu ac_cv_header_stropts_h=no --enable-shared --without-static-libpython --enable-ipv6 --infodir=${prefix}/share/info --mandir=${prefix}/share/man --with-computed-gotos --with-dbmliborder= --with-libc= --enable-loadable-sqlite-extensions --without-ensurepip --with-system-expat --with-system-ffi --with-wheel-pkg-dir=/usr/lib/python/ensurepip --with-lto --enable-optimizations --with-readline=readline --without-lto --disable-optimizations
configure: loading site script /usr/share/config.site
configure: loading site script /usr/share/crossdev/include/site/linux
configure: loading site script /usr/share/crossdev/include/site/linux-gnu
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for python3.10... python3.10
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... "linux"
checking for x86_64-pc-linux-gnu-gcc... aarch64-unknown-linux-gnu-gcc
checking whether the C compiler works... no
configure: error: in `/usr/aarch64-unknown-linux-gnu/tmp/portage/dev-lang/python-3.10.8_p2/work/python-3.10.8_p2-x86_64-pc-linux-gnu':
configure: error: C compiler cannot create executables
See `config.log' for more details

as you can see: the CHOST is x86_64-pc-linux-gnu, whereas I'd expect it to be aarch64-unknown-linux-gnu
so, I thought qemu could help me here:
Code:

Dynamic Runlevel: manual
 qemu-binfmt                                                                                                                                                                                                                   [  started  ]
$ chroot /usr/aarch64-unknown-linux-gnu/ /bin/bash --login
chroot: failed to run command ‘/bin/bash’: No such file or directory


Code:

emerge --info:
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=znver1 -O3 -pipe "
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/share/gnupg/qualified.txt /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php8.1/ext-active/ /etc/php/cgi-php8.1/ext-active/ /etc/php/cli-php8.1/ext-active/ /etc/php/fpm-php8.1/ext-active/ /etc/php/phpdbg-php8.1/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=znver1 -O3 -pipe "
DISTDIR="/data/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-march=znver1 -O3 -pipe "
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned qa-unresolved-soname-deps sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=znver1 -O3 -pipe "
GENTOO_MIRRORS="http://ftp.belnet.be/pub/rsync.gentoo.org/gentoo/ rsync://ftp.belnet.be/gentoo/gentoo/ ftp://ftp.free.fr/mirrors/ftp.gentoo.org/"
LANG="en_US.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j32 -l16"
PKGDIR="/data/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="acl amd64 berkdb bind bzip2 caps clang cli compiler-rt crypt dbus default-compiler-rt default-libcxx dri fortran gdbm gnutls iconv ipv6 libcxx libcxxabi libglvnd libtirpc libunwind lto lzma mesa multilib ncurses nfs nftables nptl opencl openmp openssl pam pcre python readline samba seccomp sha3 split-usr ssl test-rust udev unicode urandom usb xattr xinetd zlib" ABI_X86="64" ADA_TARGET="gnat_2020" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes sha sse sse2 sse3 avx avx2 bmi1 bmi2 sse4_1 sse4_2 ssse3 pni mmx mmxext fma3 f16c rdrand" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="AMDGPU X86" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9 python3_10" QEMU_SOFTMMU_TARGETS="x86_64 i386 aarch64 arm" QEMU_USER_TARGETS="x86_64 i386 aarch64 arm" RUBY_TARGETS="ruby27 ruby30" SANE_BACKENDS="xerox_mfp hp" USERLAND="GNU" VIDEO_CARDS="amdgpu radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS


Code:

aarch64-unknown-linux-gnu-emerge --info:
ACCEPT_KEYWORDS="arm64 ~arm64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O3 -mcpu=cortex-a53 -pipe"
CHOST="aarch64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/share/gnupg/qualified.txt /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php8.1/ext-active/ /etc/php/cgi-php8.1/ext-active/ /etc/php/cli-php8.1/ext-active/ /etc/php/fpm-php8.1/ext-active/ /etc/php/phpdbg-php8.1/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O3 -mcpu=cortex-a53 -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS=" --usepkg"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-Os -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news nodoc noinfo noman parallel-fetch preserve-libs protect-owned qa-unresolved-soname-deps sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-Os -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.utf8"
LDFLAGS="-O3 -mcpu=cortex-a53 -pipe"
LINGUAS="en"
MAKEOPTS="-j32"
PKGDIR="/data/software/pkgaarch64/"
PORTAGE_CONFIGROOT="/usr/aarch64-unknown-linux-gnu/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/usr/aarch64-unknown-linux-gnu/tmp/"
SHELL="/bin/bash"
USE="arm64 bind build caps custom-cflags dbus dhcp geoip ipv6 kdrive lto minimal multicall ncurses netlink readline split-usr ssl stunnel threads urandom xinetd zlib" ELIBC="glibc" INPUT_DEVICES="evdev" KERNEL="linux" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10 python3_9" USERLAND="GNU" VIDEO_CARDS="fbdev"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS


I must have set a wrong config, that's for sure... but where do I need to look?
_________________
The power of Gentoo optimization (not overclocked): [img]https://www.passmark.com/baselines/V10/images/503714802842.png[/img]
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54578
Location: 56N 3W

PostPosted: Sun Nov 06, 2022 12:57 pm    Post subject: Reply with quote

jpsollie,

/usr/aarch64-unknown-linux-gnu/ as set up by crossdev is set up for cross compiling. /usr/aarch64-unknown-linux-gnu/ in the target root.
For cross compiling
Code:
CHOST="x86_64-pc-linux-gnu"
is correct.

The fresh crossdev target root is not useful. You need to set the profile in the target root.

To be able to use the target root for cross compiling or qemu native builds, you need two different make.conf files, one for cross compiling and one for qemu native builds.

To be able to chroot into arm64 from amd64 the targen root requires a qemu user-static amd64 binary installed. Its the only amd64 in the chroot and will emulate an arm64 CPU to execute the arm64 code inside the chroot.

You also need kernel support. This old wiki page will point the way.
That page does not touch on using that same target root as both a chroot and a cross compile target.

Somwhere I have a sample of both make.conf files.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
jpsollie
Guru
Guru


Joined: 17 Aug 2013
Posts: 323

PostPosted: Sun Nov 06, 2022 1:42 pm    Post subject: Reply with quote

Those are a lot of things! I'll try to answer them one by one:

NeddySeagoon wrote:
jpsollie,

/usr/aarch64-unknown-linux-gnu/ as set up by crossdev is set up for cross compiling. /usr/aarch64-unknown-linux-gnu/ in the target root.
For cross compiling
Code:
CHOST="x86_64-pc-linux-gnu"
is correct.

The fresh crossdev target root is not useful. You need to set the profile in the target root.

Code:

ls -al /usr/aarch64-unknown-linux-gnu/etc/portage/
total 40
drwxr-xr-x  5 root root 4096 Oct 11 09:27 .
drwxr-xr-x 45 root root 4096 Nov  6 07:55 ..
-rw-r--r--  1 root root 1404 Nov  6 13:44 make.conf
lrwxrwxrwx  1 root root   38 Mar 26  2022 make.profile -> /var/db/repos/gentoo/profiles/embedded
-rw-r--r--  1 root root  153 Mar 17  2022 package.accept_keywords
-rw-r--r--  1 root root   86 Mar 16  2021 package.license
-rw-r--r--  1 root root   58 Oct 22 16:42 package.mask
-rw-r--r--  1 root root  950 Oct 22 13:32 package.use
drwxr-xr-x  2 root root 4096 Mar 13  2021 profile
drwxr-sr-x  2 root root 4096 Oct 24  2021 repo.postsync.d
drwxr-sr-x  5 root root 4096 Mar 20  2022 savedconfig

NeddySeagoon wrote:

To be able to use the target root for cross compiling or qemu native builds, you need two different make.conf files, one for cross compiling and one for qemu native builds.

Code:

cat /etc/portage/make.conf
# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
COMMON_FLAGS="-march=znver1 -O3 -pipe"
#MACHINE_FLAGS="-madx -maes -mavx -mavx2 -mbmi -mbmi2 -mclflushopt -mclzero -mcx16 -mf16c -mfma -mfsgsbase -mfxsr -mlzcnt -mmmx -mmovbe -mmwaitx -mpclmul -mpopcnt -mprfchw -mrdrnd -mrdseed -msahf -msha -msse -msse2 -msse3 -msse4.1 -msse4.2 -msse4a -mssse3 -mxsave -mxsavec -mxsaveopt -mxsaves --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=512"
MAKEOPTS="-j32 -l16"
#MAKEOPTS="-j4"
ACCEPT_KEYWORDS="${ARCH} ~${ARCH}"
#FEATURES="-sandbox"
FEATURES="-sandbox -pid-sandbox -network-sandbox -ipc-sandbox buildpkg" #distcc
#FEATURES="-sandbox -pid-sandbox -network-sandbox -ipc-sandbox"
#splitdebug -sandbox"
CFLAGS="${COMMON_FLAGS} ${MACHINE_FLAGS}"
CXXFLAGS="${COMMON_FLAGS} ${MACHINE_FLAGS}"
FCFLAGS="${COMMON_FLAGS} ${MACHINE_FLAGS}"
FFLAGS="${COMMON_FLAGS} ${MACHINE_FLAGS}"
USE="python berkdb bind bzip2 dbus ipv6 lzma lto mesa ncurses nfs nptl nftables opencl samba -sslv3 -sslv2 -smartcard openssl sha3 usb udev -X -introspection -nls -qt5 -egl -gles2 -gles2-only gnutls caps urandom xinetd -system-mitkrb5 -zeroconf"
#AMD AOCC support
USE="${USE} clang compiler-rt default-compiler-rt default-libcxx libcxx libcxxabi libunwind"
ALSA_CARDS=""
VIDEO_CARDS="amdgpu radeonsi"
LLVM_TARGETS="AMDGPU X86"
PYTHON_TARGETS="python3_9 python3_10"
PYTHON_SINGLE_TARGET="python3_9"
RUBY_TARGETS="ruby27 ruby30"
CPU_FLAGS_X86="aes sha sse sse2 sse3 avx avx2 bmi1 bmi2 sse4_1 sse4_2 ssse3 pni mmx mmxext fma3 f16c rdrand"
SANE_BACKENDS="xerox_mfp hp"
# NOTE: This stage was built with the bindist Use flag enabled
PORTDIR="/var/db/repos/gentoo"
DISTDIR="/data/distfiles"
PKGDIR="/data/binpkgs"
BINPKG_COMPRESS="lz4"
#EMERGE_DEFAULT_OPTS="${EMERGE_DEFAULT_OPTS} --usepkg"
# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C
GENTOO_MIRRORS="http://ftp.belnet.be/pub/rsync.gentoo.org/gentoo/ rsync://ftp.belnet.be/gentoo/gentoo/ ftp://ftp.free.fr/mirrors/ftp.gentoo.org/"
ACCEPT_LICENSE='*'
#GENTOO_MIRRORS="rsync://localhost/gentoo-portage"
QEMU_SOFTMMU_TARGETS="x86_64 i386 aarch64 arm"
QEMU_USER_TARGETS="x86_64 i386 aarch64 arm"

linuxserver /usr/src/linux # cat /usr/aarch64-unknown-linux-gnu/etc/portage/make.conf
# Note: profile variables are set/overridden in profile/ files:
# etc/portage/profile/use.force (overrides kernel_* USE variables)
# etc/portage/profile/make.defaults (overrides ARCH, KERNEL, ELIBC variables)

CHOST=aarch64-unknown-linux-gnu
CBUILD=x86_64-pc-linux-gnu

ARCH="arm64"
HOSTCC=${CHOST}-gcc
CROSS_COMPILE="${HOSTCC}"
MAKEOPTS="-j32"
ROOT=/usr/${CHOST}/
MACHINE_FLAGS=""
ACCEPT_KEYWORDS="${ARCH} ~${ARCH}"
USE="-pcre -X -qt5 -test -bluetooth -seccomp -usb -xml minimal build -samba -pdf -gtk -png -svg -jpeg2k -gdbm -pci lto readline bind custom-cflags -cryptsetup caps ssl netlink dbus dhcp ipv6 -pam -introspection urandom ncurses geoip stunnel threads xinetd -cairo -glib -acl -xattrs -xattr -openmp -nls -pie -tcpd -cups -zeroconf split-usr"
COMMON_FLAGS="-O3 -mcpu=cortex-a53 -pipe"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
LDFLAGS="${COMMON_FLAGS}"
#FEATURES="-collision-protect sandbox -ipc-sandbox -pid-sandbox -user-sandbox -network-sandbox buildpkg noman noinfo nodoc"
FEATURES="-collision-protect buildpkg noman noinfo nodoc"
# Be sure we dont overwrite pkgs from another repo..
PYTHON_TARGETS="python3_10 python3_9"
PYTHON_SINGLE_TARGET="python3_10"
PKGDIR=/data/software/pkgaarch64/
PORTAGE_TMPDIR=${ROOT}tmp/
PKG_CONFIG_PATH="${ROOT}usr/lib/pkgconfig/"
BINPKG_COMPRESS="lz4"
EMERGE_DEFAULT_OPTS="${EMERGE_DEFAULT_OPTS} --usepkg"
#PORTDIR_OVERLAY="/usr/portage/local/"


NeddySeagoon wrote:


To be able to chroot into arm64 from amd64 the targen root requires a qemu user-static amd64 binary installed. Its the only amd64 in the chroot and will emulate an arm64 CPU to execute the arm64 code inside the chroot.

do I need that one in the first place? it used to work without!
If I don't, forget about this one! but thanks for the tip anyway ...
NeddySeagoon wrote:

You also need kernel support. This old wiki page will point the way.

my host .config
Code:

CONFIG_BINFMT_ELF=y
CONFIG_COMPAT_BINFMT_ELF=y
CONFIG_ELFCORE=y
CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y
CONFIG_BINFMT_SCRIPT=y
CONFIG_BINFMT_MISC=y
CONFIG_COREDUMP=y

NeddySeagoon wrote:

That page does not touch on using that same target root as both a chroot and a cross compile target.

Somwhere I have a sample of both make.conf files.

_________________
The power of Gentoo optimization (not overclocked): [img]https://www.passmark.com/baselines/V10/images/503714802842.png[/img]
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54578
Location: 56N 3W

PostPosted: Sun Nov 06, 2022 3:06 pm    Post subject: Reply with quote

jpsollie,

Code:
lrwxrwxrwx  1 root root   38 Mar 26  2022 make.profile -> /var/db/repos/gentoo/profiles/embedded

That's the bit that's not useful. Choose a profile that starts default/linux/arm64/17.0 That's valid but very bare.

/usr/aarch64-unknown-linux-gnu/etc/portage/make.conf:
 
CHOST=aarch64-unknown-linux-gnu
CBUILD=x86_64-pc-linux-gnu

ARCH="arm64"
HOSTCC=${CHOST}-gcc
CROSS_COMPILE="${HOSTCC}"
MAKEOPTS="-j32"
ROOT=/usr/${CHOST}/

Is fine for cross compiling but you need a native arm64 make.conf for a QEMU chroot, so most of that changes.
I'm cheating, I have a arm64 server. Its make.conf is set up to be Raspberry Pi ~arm64 compabable.

The qemu user-static amd64 binary installed in the arm64 chroot is required to chroot. /bin/bash is going to need it as its arm64 code.
The separate make.conf is only required if you will use portage under QEMU.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
jpsollie
Guru
Guru


Joined: 17 Aug 2013
Posts: 323

PostPosted: Sun Nov 06, 2022 8:00 pm    Post subject: Reply with quote

NeddySeagoon wrote:

Is fine for cross compiling but you need a native arm64 make.conf for a QEMU chroot, so most of that changes.
I'm cheating, I have a arm64 server. Its make.conf is set up to be Raspberry Pi ~arm64 compabable.
The qemu user-static amd64 binary installed in the arm64 chroot is required to chroot. /bin/bash is going to need it as its arm64 code.
The separate make.conf is only required if you will use portage under QEMU.


Lol ... that's definitely cheating :D
anyway: do I need a qemu chroot if this cross-build environment is only for building packages into the native device?
_________________
The power of Gentoo optimization (not overclocked): [img]https://www.passmark.com/baselines/V10/images/503714802842.png[/img]
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54578
Location: 56N 3W

PostPosted: Sun Nov 06, 2022 9:46 pm    Post subject: Reply with quote

jpsollie,

As long as cross compiling works, you do not need a QEMU chroot.
Cross compiling is much faster than a QEMU chroot as QEMU has to emulate the target CPU at the register level, which is slow.
For some things, its either a native build or a QEMU chroot though.

You do need a QEMU chroot to be able to chroot into the arm64 code, because somehow you need to be able to execute the arm64 code.

Cross compiling will give a lot of errors until you fix your target root profile as the cross compiler is going to use /usr/<target>/etc/potage/* when it builds things, not your build host /etc/potage/*
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
jpsollie
Guru
Guru


Joined: 17 Aug 2013
Posts: 323

PostPosted: Mon Nov 07, 2022 5:21 am    Post subject: Reply with quote

All of that sounds pretty logical. Should I make a new thread to help with python having --build=x86_64_unknown_linux_gnu in the configure script? or do you have some magic tricks I could try?

*EDIT: filed a bug for it:
https://bugs.gentoo.org/show_bug.cgi?id=880137
_________________
The power of Gentoo optimization (not overclocked): [img]https://www.passmark.com/baselines/V10/images/503714802842.png[/img]
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54578
Location: 56N 3W

PostPosted: Mon Nov 07, 2022 12:21 pm    Post subject: Reply with quote

jpsollie,

Python can be tricky to cross compile.
From memory, it builds some code then runs as as a part of the build process. That has to run on the host during cross compiling.
It it built arm64 code then tried to run it on the build host, I would probably hear the crash. :)

This is the main drawback with cross compile - packages than need to do that but are not cross build aware.

This next bit might make your head hurt.
If you go the QEMU chroot to build things like this, you can use distcc inside the chroot to use the cross compiler on the build host (outside the chroot) as a helper.
That way gcc runs native on the build host, not emulated by QEMU.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
jpsollie
Guru
Guru


Joined: 17 Aug 2013
Posts: 323

PostPosted: Mon Nov 07, 2022 9:16 pm    Post subject: Reply with quote

NeddySeagoon wrote:

This next bit might make your head hurt.
If you go the QEMU chroot to build things like this, you can use distcc inside the chroot to use the cross compiler on the build host (outside the chroot) as a helper.
That way gcc runs native on the build host, not emulated by QEMU.

You're a genious!
The path I'm currently walking is almost the same:
1)installing gcc on embedded target
2)install distcc on target
3)make a 40GB file in /tmp/blobs, format it as ext, and export /tmp/blobs via nfs
4) Mount /tmp/blobs as network share on target device, and the file in to /var/tmp/portage
5) run emerge on embedded device

But yours is way more beautiful!
_________________
The power of Gentoo optimization (not overclocked): [img]https://www.passmark.com/baselines/V10/images/503714802842.png[/img]
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54578
Location: 56N 3W

PostPosted: Mon Nov 07, 2022 9:43 pm    Post subject: Reply with quote

jpsollie,

distcc only distributes C and C++ compile jobs. Big chunks of the build still run on the embedded device.
Linking may run out of real RAM, so builds fail.

That was one of the things that drove me to play with a QEMU chroot for the Raspberry Pi3.
1 GB RAM is too small to build rust, firefox and friends, even in when the Pi3 was new.

gcc is a PITA to build on low end hardware as it is built three times.
The first time with any random C/C++ builds enough of gcc to build itself.
The second time it rebuilds itself with the compiler built in the first stage. There is only one copy of that, so no distcc.
The third time in builds the C/C++ again with the compiler built in stage2. No distcc again.
The results of those two builds are compared. If they are not identical, the build fails.
When all is well, it continues to build the other language targets.
Most of the build cannot use distcc.

When gcc cross compiles itself, it can't do the three pass build as it can't run the output compiler on the build host.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum