Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Architectures & Platforms Gentoo on ARM
  • Search

crossdev CHOST for 23.0 profile

Gentoo on all things ARM. Both 32 bit and 64 bit.
Tell about your hardware and CHOST.
Problems with crossdev targeting ARM hardware go here too.
Post Reply
  • Print view
Advanced search
5 posts • Page 1 of 1
Author
Message
viacheslavg
n00b
n00b
Posts: 27
Joined: Fri Sep 23, 2016 1:55 pm

crossdev CHOST for 23.0 profile

  • Quote

Post by viacheslavg » Fri May 09, 2025 10:13 am

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-ite ... files.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: Select all

# 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: Select all

[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: Select all

# 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.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56073
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Fri May 09, 2025 11:24 am

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.
... 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: Select all

CBUILD=x86_64-pc-linux-gnu 
is not correct or not required.

Code: Select all

ROOT=/usr/${CHOST}/
you are in the chroot now ...

Code: Select all

PKGDIR=${ROOT}var/cache/binpkgs/
PORTAGE_TMPDIR=${ROOT}tmp/ 
is that correct still?
It probably is when ROOT= is fixed.

Code: Select all

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: Select all

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.
Top
viacheslavg
n00b
n00b
Posts: 27
Joined: Fri Sep 23, 2016 1:55 pm

  • Quote

Post by viacheslavg » Fri May 09, 2025 1:47 pm

NeddySeagoon,

Thanks for the hints. I found one stupid mistake. While I commenting out CHOST env in the following line I have:

Code: Select all

ROOT=/usr/${CHOST}/
:oops:

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: Select all

#!/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: Select all

# 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 :roll:
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.
Top
viacheslavg
n00b
n00b
Posts: 27
Joined: Fri Sep 23, 2016 1:55 pm

  • Quote

Post by viacheslavg » Tue May 13, 2025 1:43 pm

So, after rebuilding from scratch everything looks good now.
Another issue I was talking about before

Code: Select all

/bin/bash: error while loading shared libraries: libgcc_s.so.1: cannot open shared object file: No such file or directory 
is caused by the fact that ld.so.cache was not up to date after chrooting. Simple

Code: Select all

# ldconfig
fixed the problem.

Also I used NeddySeagoon's suggestion and created separate make.conf for crossdev and chroot envs.

BTW: is the any way to choose make.conf file based on some env variable? It would be nice option too.

Thanks for support.
Top
NeddySeagoon
Administrator
Administrator
User avatar
Posts: 56073
Joined: Sat Jul 05, 2003 9:37 am
Location: 56N 3W

  • Quote

Post by NeddySeagoon » Tue May 13, 2025 6:18 pm

viacheslavg,

My script that prepares the chroot also sets the correct symlink for building in the QEMU chroot.
I usually forget to change it back for cross compiling.
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Top
Post Reply
  • Print view

5 posts • Page 1 of 1

Return to “Gentoo on ARM”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy