Building gpgme, in qemu-binfmt virtualization from an x86_64 host, preparing one chroot within an outer chroot, for a RISC-V64 profile based on features/llvm and default/linux/riscv/23.0/rv64/lp64d/musl. Am I crazy? Probably, but I like it, so let's move on =) ``` # emerge -pqv '=app-crypt/gpgme-1.23.2::gentoo' [ebuild R ] app-crypt/gpgme-1.23.2 USE="cxx -common-lisp -debug -python -qt5 -qt6 -static-libs -test -verify-sig" PYTHON_TARGETS="python3_12 -python3_10 -python3_11 -python3_13" ``` Emerge invocation was `emerge -av --prefix=/seed --update --newuse --deep --with-bdeps=y @system` Find build log attached below, but the notable errors are about a gazillion of these: ``` /usr/include/c++/v1/cstring:66:5: error: <cstring> tried including <string.h> but didn't find libc++'s <string.h> header. This usually means that your header search paths are not configured properly. The header search paths should contain the C++ Standard Library headers before any C Standard Library, and you are probably using compiler flags that make that not be the case. 66 | # error <cstring> tried including <string.h> but didn't find libc++'s <string.h> header. \ | ^ ``` I've seen these before, and the problem shows when explicitly including `/usr/include` as a header search path. It screws up clang++'s header search path order. If we look at the build command: ``` /bin/sh ../../../libtool --tag=CXX --mode=compile clang++ -std=c++11 -DHAVE_CONFIG_H -I. -I/tmp/portage/app-crypt/gpgme-1.23.2/work/b/lang/cpp/src -I../../../conf -I../../../src -fvisibility=hidden -I/seed/usr/include -I/seed/usr/include -DBUILDING_GPGMEPP -Wsuggest-override -Wzero-as-null-pointer-constant -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -O2 -pipe -fomit-frame-pointer -march=rv64gc -mabi=lp64d -c -o decryptionresult.lo /tmp/portage/app-crypt/gpgme-1.23.2/work/b/lang/cpp/src/decryptionresult.cpp libtool: compile: clang++ -std=c++11 -DHAVE_CONFIG_H -I. -I/tmp/portage/app-crypt/gpgme-1.23.2/work/b/lang/cpp/src -I../../../conf -I../../../src -fvisibility=hidden -I/seed/usr/include -I/seed/usr/include -DBUILDING_GPGMEPP -Wsuggest-override -Wzero-as-null-pointer-constant -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -O2 -pipe -fomit-frame-pointer -march=rv64gc -mabi=lp64d -c /tmp/portage/app-crypt/gpgme-1.23.2/work/b/lang/cpp/src/decryptionresult.cpp -fPIC -DPIC -o .libs/decryptionresult.o ``` We see the culprit is those two `-I/seed/usr/include -I/seed/usr/include` flags. Those break it because they hoist the root prefix's /usr/include early in the search paths order before libc++'s headers, and the whole thing explodes. I haven't found a durable fix; so far I've been patching the build system to get rid of those extraneous include paths... but I actually have no idea how to do that on an old `./configure && make` style build system... :-( I usually use CMake. The C targets build fine with those CFLAGS, but if they get into the CXXFLAGS it'll fail. If there's a better fix, such as helping clang++ to order the search paths right even if `/usr/include` gets added explicitly on the command line... that'd be great! But I'll happily settle for a way to patch the build system. Reproducible: Always Steps to Reproduce: 1. Attempt to install gpgme 2. Wait for it... 3. Yep, it failed =D Actual Results: Build fails because /usr/include C headers get included by C++ #include statements instead of libc++'s C headers Expected Results: Build succeeds no matter what!! ;-) Emerge --info: Portage 3.0.65 (python 3.12.5-final-0, default/linux/riscv/23.0/rv64/lp64d/musl, gcc-14, musl-1.2.5-r1, 6.6.30-gentoo-revelation riscv64) ================================================================= System Settings ================================================================= System uname: Linux-6.6.30-gentoo-revelation-riscv64-with-libc KiB Mem: 65462700 total, 15107480 free KiB Swap: 33554428 total, 32499708 free Timestamp of repository gentoo: Thu, 08 Aug 2024 05:30:00 +0000 Head commit of repository gentoo: 8af8e6011b6eb4e7b29b1910e566d273ec947bfd sh bash 5.2_p32 ld GNU ld (Gentoo 2.42 p6) 2.42.0 app-misc/pax-utils: 1.3.7::gentoo app-shells/bash: 5.2_p32::gentoo dev-build/make: 4.4.1-r1::gentoo dev-lang/perl: 5.40.0::gentoo dev-lang/python: 3.12.5::gentoo sys-apps/baselayout: 2.15::gentoo sys-apps/openrc: 0.54.2::gentoo sys-apps/sandbox: 2.39::gentoo sys-devel/binutils-config: 5.5::gentoo sys-devel/clang: 18.1.8::gentoo sys-devel/gcc-config: 2.11::gentoo sys-devel/lld: 18.1.8::gentoo sys-devel/llvm: 18.1.8-r4::gentoo sys-kernel/linux-headers: 6.9::gentoo (virtual/os-headers) sys-libs/musl: 1.2.5-r1::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 volatile: False sync-rsync-verify-max-age: 3 sync-rsync-verify-metamanifest: yes sync-rsync-extra-opts: sync-rsync-verify-jobs: 1 local location: /var/db/repos/local masters: gentoo volatile: False ACCEPT_KEYWORDS="riscv ~riscv" ACCEPT_LICENSE="@FREE" ADDR2LINE="llvm-addr2line" AR="llvm-ar" AS="clang -c" CBUILD="riscv64-unknown-linux-musl" CC="clang" CFLAGS="-O2 -pipe -fomit-frame-pointer -march=rv64gc -mabi=lp64d" CHOST="riscv64-unknown-linux-musl" CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d" CPP="clang-cpp" CXX="clang++" CXXFLAGS="-O2 -pipe -fomit-frame-pointer -march=rv64gc -mabi=lp64d" DISTDIR="/var/cache/distfiles" ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE 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="-O2 -pipe -march=rv64gc -mabi=lp64d" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync merge-wait news nodoc noinfo noman parallel-fetch pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-O2 -pipe -march=rv64gc -mabi=lp64d" GENTOO_MIRRORS="http://distfiles.gentoo.org" INSTALL_MASK="charset.alias /usr/share/locale/locale.alias" LANG="en_US.utf8" LD="/usr/lib/llvm/18/bin/ld.lld" LDFLAGS="-fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -Wl,--as-needed" LEX="flex" NM="llvm-nm" OBJCOPY="llvm-objcopy" OBJDUMP="llvm-objdump" PKGDIR="/var/cache/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="/tmp/" RANLIB="llvm-ranlib" READELF="llvm-readelf" SHELL="/bin/bash" STRINGS="llvm-strings" STRIP="llvm-strip" USE="acl bzip2 clang crypt default-compiler-rt default-libcxx default-lld iconv ipv6 libcxx libcxxabi llvm-libunwind ncurses nls openmp pam pcre pic readline riscv seccomp ssl test-rust unicode xattr zlib" ADA_TARGET="gcc_12" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio 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" ELIBC="musl" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12" RUBY_TARGETS="ruby31 ruby32" VIDEO_CARDS="fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account" Unset: ARFLAGS, ASFLAGS, CCLD, CONFIG_SHELL, CPPFLAGS, CTARGET, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, LC_ALL, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, MAKEOPTS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RUSTFLAGS, SIZE, YACC, YFLAGS
Created attachment 899789 [details] The build log Attachment: the build log
Why are you passing --prefix=/seed to emerge? What do you hope to accomplish by this?
The objective is to create an root filesystem in /seed, such as could be chrooted into or used to create a bootable image.
*sigh* OK, so upon further RTFMing and trying again, it looks like the installation succeeds when I pass --root instead of --prefix. Thanks for pointing that out... OK, so I think this is PEBKAC. Closing.