View previous topic :: View next topic |
Author |
Message |
viacheslavg n00b

Joined: 23 Sep 2016 Posts: 10
|
Posted: Fri May 09, 2025 10:13 am Post subject: crossdev CHOST for 23.0 profile |
|
|
Hello,
I'm little bit lost understanding what should we have in a make.conf for crossdev environment when we are switched to 23.0 profile.
On the one hand migration guide for 23 profile (https://www.gentoo.org/support/news-items/2024-03-22-new-23-profiles.html) says that we should remove CHOST completely from make.conf.
On the other hand when I bootstrap crossdev it provides CHOST in make.conf.
In my case I have following make.conf right after boostraping crossdev:
Code: |
# 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
ROOT=/usr/${CHOST}/
ACCEPT_KEYWORDS="${ARCH} ~${ARCH}"
USE="${ARCH}"
CFLAGS="-O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
FEATURES="-collision-protect sandbox buildpkg noman noinfo nodoc"
# Be sure we dont overwrite pkgs from another repo..
PKGDIR=${ROOT}var/cache/binpkgs/
PORTAGE_TMPDIR=${ROOT}tmp/
|
If I leave CHOST there and switch to "default/linux/arm64/23.0/split-usr/desktop" profile and build toolchain then it seems it is broken. Because if I chroot to it and try to emerge something I have strange errors like:
Code: |
[ERROR] code for hash blake2b was not found.
Traceback (most recent call last):
File "/usr/lib/python3.12/hashlib.py", line 245, in <module>
globals()[__func_name] = __get_hash(__func_name)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/hashlib.py", line 129, in __get_openssl_constructor
return __get_builtin_constructor(name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/hashlib.py", line 123, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type blake2b
[ERROR] code for hash blake2s was not found.
Traceback (most recent call last):
File "/usr/lib/python3.12/hashlib.py", line 245, in <module>
globals()[__func_name] = __get_hash(__func_name)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/hashlib.py", line 129, in __get_openssl_constructor
return __get_builtin_constructor(name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/hashlib.py", line 123, in __get_builtin_constructor
raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type blake2s
.........................
/bin/bash: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory
|
If I remove CHOST from make.conf and ask to merge e.g. gcc I have following:
Code: |
# aarch64-unknown-linux-gnu-emerge -vp gcc
These are the packages that would be merged, in order:
Calculating dependencies... done!
Dependency resolution took 3.29 s (backtrack: 0/20).
[ebuild N ] sys-libs/zlib-1.3.1-r1:0/1::gentoo to /usr/ USE="-minizip -static-libs -verify-sig" 0 KiB
[ebuild N ] virtual/libintl-0-r2::gentoo to /usr/ 0 KiB
[ebuild N ] virtual/libiconv-0-r2::gentoo to /usr/ 0 KiB
[ebuild N ] sys-libs/zlib-1.3.1-r1:0/1::gentoo to /usr/aarch64-unknown-linux-gnu/ USE="-minizip -static-libs -verify-sig" 0 KiB
[ebuild N ] virtual/libintl-0-r2::gentoo to /usr/aarch64-unknown-linux-gnu/ 0 KiB
[ebuild N ] virtual/libiconv-0-r2::gentoo to /usr/aarch64-unknown-linux-gnu/ 0 KiB
[ebuild N ] dev-libs/gmp-6.3.0-r1:0/10.4::gentoo to /usr/ USE="asm cpudetection cxx -doc -pic -static-libs" 0 KiB
[ebuild N ] app-arch/xz-utils-5.8.1::gentoo to /usr/aarch64-unknown-linux-gnu/ USE="extra-filters nls -doc -pgo -static-libs -verify-sig" CPU_FLAGS_ARM="-crc32" 0 KiB
[ebuild N ] sys-apps/gentoo-functions-1.7.3::gentoo to /usr/ USE="-test" 0 KiB
[ebuild N ] app-arch/xz-utils-5.8.1::gentoo to /usr/ USE="extra-filters nls -doc -pgo -static-libs -verify-sig" CPU_FLAGS_ARM="-crc32" 0 KiB
[ebuild N ] sys-libs/timezone-data-2025b::gentoo to /usr/ USE="nls -leaps-timezone -zic-slim" 0 KiB
[ebuild N ] dev-libs/libunistring-1.3:0/5::gentoo to /usr/ USE="-doc -static-libs" 0 KiB
[ebuild N ] sys-kernel/linux-headers-6.14::gentoo to /usr/aarch64-unknown-linux-gnu/ USE="-headers-only" 0 KiB
[ebuild N ] dev-libs/gmp-6.3.0-r1:0/10.4::gentoo to /usr/aarch64-unknown-linux-gnu/ USE="asm cpudetection cxx -doc -pic -static-libs" 0 KiB
[ebuild N ] dev-libs/libunistring-1.3:0/5::gentoo to /usr/aarch64-unknown-linux-gnu/ USE="-doc -static-libs" 0 KiB
[ebuild N ] sys-libs/timezone-data-2025b::gentoo to /usr/aarch64-unknown-linux-gnu/ USE="nls -leaps-timezone -zic-slim" 0 KiB
[ebuild N ] dev-libs/mpfr-4.2.2:0/6::gentoo to /usr/ USE="-static-libs -verify-sig" 0 KiB
[ebuild N ] virtual/os-headers-0-r2::gentoo to /usr/aarch64-unknown-linux-gnu/ 0 KiB
[ebuild N ] app-arch/zstd-1.5.7-r1:0/1::gentoo to /usr/ USE="lzma zlib -lz4 -static-libs -test" 0 KiB
[ebuild N ] sys-devel/gcc-config-2.12.1::gentoo to /usr/ USE="(cc-wrappers) (native-symlinks)" 0 KiB
[ebuild N ] net-dns/libidn2-2.3.8:0/2::gentoo to /usr/ USE="nls -static-libs -verify-sig" 0 KiB
[ebuild N ] dev-libs/mpfr-4.2.2:0/6::gentoo to /usr/aarch64-unknown-linux-gnu/ USE="-static-libs -verify-sig" 0 KiB
[ebuild N ] app-arch/zstd-1.5.7-r1:0/1::gentoo to /usr/aarch64-unknown-linux-gnu/ USE="lzma zlib -lz4 -static-libs -test" 0 KiB
[ebuild N ] net-dns/libidn2-2.3.8:0/2::gentoo to /usr/aarch64-unknown-linux-gnu/ USE="nls -static-libs -verify-sig" 0 KiB
[ebuild N ] sys-libs/glibc-2.41-r1:2.2::gentoo to /usr/ USE="multiarch ssp (static-libs) -audit -caps (-cet) -compile-locales (-custom-cflags) -doc -gd -hash-sysv-compat -headers-only (-multilib) -multilib-bootstrap -nscd -perl -profile (-selinux) (-stack-realign) -suid -systemd -systemtap -test (-vanilla)" 0 KiB
[ebuild N ] dev-libs/mpc-1.3.1:0/3::gentoo to /usr/ USE="-static-libs" 0 KiB
[ebuild N ] sys-libs/glibc-2.41-r1:2.2::gentoo to /usr/aarch64-unknown-linux-gnu/ USE="multiarch ssp (static-libs) -audit -caps (-cet) -compile-locales (-custom-cflags) -doc -gd -hash-sysv-compat -headers-only (-multilib) -multilib-bootstrap -nscd -perl -profile (-selinux) (-stack-realign) -suid -systemd -systemtap -test (-vanilla)" 0 KiB
[ebuild N ] dev-libs/mpc-1.3.1:0/3::gentoo to /usr/aarch64-unknown-linux-gnu/ USE="-static-libs" 0 KiB
[ebuild N ] sys-libs/libxcrypt-4.4.38:0/1::gentoo to /usr/aarch64-unknown-linux-gnu/ USE="(compat) (system) -headers-only -static-libs -test" 0 KiB
[ebuild N ] virtual/libcrypt-2-r1:0/2::gentoo to /usr/aarch64-unknown-linux-gnu/ USE="-static-libs" 0 KiB
[ebuild N ] sys-devel/gcc-14.2.1_p20250301:14::gentoo to /usr/ USE="(cxx) (default-stack-clash-protection) (default-znow) fortran nls openmp (pie) sanitize ssp zstd -ada (-cet) (-custom-cflags) -d -debug -doc (-fixed-point) -go -graphite -hardened (-ieee-long-double) -jit (-libssp) -lto -modula2 (-multilib) -objc -objc++ -objc-gc (-pch) -pgo -rust -systemtap -test (-time64) -valgrind -vanilla -vtv" 0 KiB
Total: 31 packages (31 new), Size of downloads: 0 KiB
|
Note: some packages will be installed to /usr/aarch64-unknown-linux-gnu/ while others to /usr/
Is it normal? Any advice?
Thanks. |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 55227 Location: 56N 3W
|
Posted: Fri May 09, 2025 11:24 am Post subject: |
|
|
viacheslavg,
First of all, as long as CHOST is correct, it does not matter where it it set.
The CHOST in your target root, should be the same as the CHOST outside of it, for cross compiling.
I like to set it inside the target root to make sure.
Quote: | ... Because if I chroot to it and try to emerge something ... |
You can't just do that.
When you chroot into /usr/<target> with the aid of qemu-static, you are to all intents and purposes running a native <target> install. qemu-static emulates the <target> CPU.
Its slow but it works.
The requires that you make changes to the target make.conf.
I have two target make.conf and choose by use of a symbolic link. make.conf.cross and make.conf.native, with make.conf a symlink to the right one, mostly :)
In the chroot ...
Code: | CBUILD=x86_64-pc-linux-gnu | is not correct or not required.
Code: | ROOT=/usr/${CHOST}/ | you are in the chroot now ...
Code: | PKGDIR=${ROOT}var/cache/binpkgs/
PORTAGE_TMPDIR=${ROOT}tmp/ | is that correct still?
It probably is when ROOT= is fixed.
Code: | CFLAGS="-O2 -pipe -fomit-frame-pointer" | You should add -mcpu to suit your target there. AArch64 does strange things when its left to choose.
The mix of destinations between /usr/ and /usr/aarch64-unknown-linux-gnu/ is expected.
Build time dependencies must be built and run on the host, so they go to /usr.
Target code goes to /usr/aarch64-unknown-linux-gnu/
Many of those build time dependencies should already be installed on your build host. They should not be New.
What does Code: | aarch64-unknown-linux-gnu-emerge --info | tell with and without CHOST set in the target root? _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
viacheslavg n00b

Joined: 23 Sep 2016 Posts: 10
|
Posted: Fri May 09, 2025 1:47 pm Post subject: |
|
|
NeddySeagoon,
Thanks for the hints. I found one stupid mistake. While I commenting out CHOST env in the following line I have:
Code: | ROOT=/usr/${CHOST}/
|
that is why I had that weird emerge output with the intent to install existing host packages to /usr/
As for the chroot-ing, indeed I'm using qmu with following script for chroot (found it long ago either on this forum or on Gentoo wiki):
Code: | #!/bin/bash
/etc/init.d/qemu-binfmt start
#Next two lines are optional. Activate if the qemu-wrapper is used. Check that the wrapper location corresponds with the call at the end of line two
#echo '-1' > /proc/sys/fs/binfmt_misc/arm #deregister wrong arm
#echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\x00\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-wrapper:' > /proc/sys/fs/binfmt_misc/register
cd /usr/aarch64-unknown-linux-gnu
mount -t proc none proc
mount -o bind /dev dev
mount -o bind /usr/portage usr/portage
mount -o bind /usr/local/portage usr/local/portage
mount -o bind /sys sys
mount -o bind /var/tmp/portage var/tmp/portage
cp /etc/resolv.conf etc/resolv.conf
chroot . /bin/bash --login
umount var/tmp/portage
umount sys
umount usr/local/portage
umount usr/portage
umount dev
umount proc
|
and my old make.conf (which I lost after crossdev --clean, but managed to restore) looks like:
Code: | # 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
ROOT=/usr/${CHOST}/
ACCEPT_KEYWORDS="${ARCH} ~${ARCH}"
USE="${ARCH} -pam wayland"
CFLAGS="-O2 -pipe -march=armv8-a+crc -mtune=cortex-a53 -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j5"
FEATURES="-collision-protect -pid-sandbox sandbox buildpkg"
# Be sure we dont overwrite pkgs from another repo..
PKGDIR=${ROOT}packages/
PORTAGE_TMPDIR=/var/tmp/
PKG_CONFIG_PATH="${ROOT}usr/lib/pkgconfig/"
#PORTDIR_OVERLAY="/usr/portage/local/"
LLVM_TARGETS="AArch64"
|
as you can see most dirs are correctly bind-mounted before chroot-ing , but, indeed ROOT and CBUILD will be wrong... hmmm.. no idea how it was working before
maybe ROOT fallbacks to / in case it points to nowhere?
Well, let me try to rebuild from scratch without CHOST now and we will see if it help.
Thanks. |
|
Back to top |
|
 |
|
|
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
|
|