when cross compiling (cross-emerge) from x86_64 to aarch64, any packages (eg bind) which use openssl do not compile as the aarch64 /arm64 / arm component in /usr/include/openssl/opensslconf.h is not declared, while other arches (mips, powerpc) are Reproducible: Always Steps to Reproduce: 1.create cross-compile toolchain for aarch64-unknown-linux-gnueabi or gnu 2.emerge openssl 3.cross-emerge bind + openssl Actual Results: compile fails: ABI is not supported Expected Results: bind compiles correctly Portage 3.0.28 (python 3.9.7-final-0, default/linux/amd64/17.1, gcc-10.3.0, glibc-2.33-r7, 5.14.12release+ x86_64) ================================================================= System uname: Linux-5.14.12release+-x86_64-AMD_Ryzen_Threadripper_2950X_16-Core_Processor-with-glibc2.33 KiB Mem: 32785512 total, 1483364 free KiB Swap: 97022380 total, 97020076 free Timestamp of repository gentoo: Mon, 25 Oct 2021 08:15:01 +0000 Head commit of repository gentoo: 9f30818120d8d4b59cae1403d12a1affcf7a4b1a sh bash 5.1_p8 ld GNU ld (Gentoo 2.37_p1 p0) 2.37 distcc 3.4 x86_64-pc-linux-gnu [disabled] app-shells/bash: 5.1_p8::gentoo dev-java/java-config: 2.3.1::gentoo dev-lang/perl: 5.34.0-r3::gentoo dev-lang/python: 2.7.18_p13::gentoo, 3.8.12_p1::gentoo, 3.9.7_p1::gentoo dev-lang/rust: 1.53.0::gentoo dev-util/cmake: 3.21.3::gentoo sys-apps/baselayout: 2.7-r3::gentoo sys-apps/openrc: 0.43.3::gentoo sys-apps/sandbox: 2.27::gentoo sys-devel/autoconf: 2.13-r1::gentoo, 2.69-r5::gentoo, 2.71-r1::gentoo sys-devel/automake: 1.13.4-r2::gentoo, 1.16.5::gentoo sys-devel/binutils: 2.36.1-r2::gentoo, 2.37_p1::gentoo sys-devel/gcc: 9.3.0-r2::gentoo, 10.3.0::gentoo, 11.2.0::gentoo sys-devel/gcc-config: 2.4::gentoo sys-devel/libtool: 2.4.6-r6::gentoo sys-devel/make: 4.3::gentoo sys-kernel/linux-headers: 5.14::gentoo (virtual/os-headers) sys-libs/glibc: 2.33-r7::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: rsync sync-uri: rsync://rsync.de.gentoo.org/gentoo-portage/ priority: -1000 sync-rsync-verify-metamanifest: yes sync-rsync-verify-jobs: 1 sync-rsync-extra-opts: sync-rsync-verify-max-age: 24 gamarouns location: /var/lib/layman/gamarouns masters: gentoo priority: 50 guru location: /var/lib/layman/guru sync-type: laymansync sync-uri: https://anongit.gentoo.org/git/repo/proj/guru.git masters: gentoo priority: 50 vmacs location: /var/lib/layman/vmacs masters: gentoo priority: 50 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.0/ext-active/ /etc/php/cgi-php8.0/ext-active/ /etc/php/cli-php8.0/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" FCFLAGS="-march=znver1 -O3 -pipe" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs 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 usersync xattr" FFLAGS="-march=znver1 -O3 -pipe" GENTOO_MIRRORS="http://ftp.snt.utwente.nl/pub/os/linux/gentoo" LANG="en_US.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j40" 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="/var/tmp" USE="acl amd64 bind bzip2 caps cli crypt dbus dri fortran gdbm gnutls iconv ipv6 libglvnd libtirpc lzma mesa multilib ncurses nfs nftables nptl opencl openmp openssl pam pcre python readline samba seccomp sha3 split-usr ssl sslv2 sslv3 tcpd udev unicode urandom usb xattr zlib" ABI_X86="64" ADA_TARGET="gnat_2019" 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" 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-3 php7-4" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_8 python3_9" RUBY_TARGETS="ruby27 ruby30" 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: CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS
COuld you please share the log of e.g. bind failing to build, and ideally the build log from openssl too? (ebuild ... clean install will help you do this).
(In reply to Sam James from comment #1) > COuld you please share the log of e.g. bind failing to build, and ideally > the build log from openssl too? (ebuild ... clean install will help you do > this). do you want the openssl native build or cross compile build log? anyway, I found a workaround for this issue: 1. add the following code to /usr/include/openssl/opensslconf.h: > #elif defined(__aarch64__) > # include <aarch64-unknown-linux-gnueabi/openssl/opensslconf.h> > 2. create a symbolic link to aarch64 includes: > ln -s /usr/aarch64-unknown-linux-gnueabi/include /usr/include/aarch64-unknown-linux-gnueabi but bind still doesn't compile correctly, dlz loading causes issues, but that's probably bind/dlz and not gentoo related I'll post the bind emerge logs
(In reply to Janpieter Sollie from comment #2) > (In reply to Sam James from comment #1) > > COuld you please share the log of e.g. bind failing to build, and ideally > > the build log from openssl too? (ebuild ... clean install will help you do > > this). > > do you want the openssl native build or cross compile build log? cross please if you can? > > anyway, I found a workaround for this issue: > 1. add the following code to /usr/include/openssl/opensslconf.h: > > #elif defined(__aarch64__) > > # include <aarch64-unknown-linux-gnueabi/openssl/opensslconf.h> > > 2. create a symbolic link to aarch64 includes: > > ln -s /usr/aarch64-unknown-linux-gnueabi/include /usr/include/aarch64-unknown-linux-gnueabi > but bind still doesn't compile correctly, dlz loading causes issues, but > that's probably bind/dlz and not gentoo related > I'll post the bind emerge logs Thanks for the help so far.
Created attachment 746730 [details] build log of aarch64 bind compile
Created attachment 746733 [details] build log of aarch64 bind compile
Seems like multilib is somehow enabled, which should not be by default for crossdev. The output of the command aarch64-unknown-linux-gnueabi-emerge --info might help us also.
Created attachment 746736 [details] build.log of aarch64 openssl compile build.log of aarch64 openssl
Created attachment 746739 [details] cross-emerge --target aarch4-unknown-linux-gnueabi --info
(In reply to Tee KOBAYASHI from comment #6) > Seems like multilib is somehow enabled, which should not be by default for > crossdev. Could it be related to using "embedded" profile instead of default/arm64 in portage?
Ah, I was wrong. The multilib in crossdev is not enabled in the first place. Never mind. The problem seems to be that when cross-emerging net-dns/bind etc. /usr/include/openssl/opensslconf.h is read where /usr/aarch64-unknown-linux-gnueabi/usr/include/openssl/opensslconf.h should be.
Looks similar to what media-gfx/povray suffers from for dependency on dev-libs/boost: https://bugs.gentoo.org/810227
seems like for DLZ with berkdb, the same issue occurs in /usr/include/db.h (with the same workaround described above), but not sure whether that's another bug or the same root cause
Correct, Bind's contrib/dlz/config.dlz.in is hardcoded to look in /usr/include, among other places, which is very bad. It should use pkg-config instead, or at least try that first. I don't maintain or even use Bind though, so I'll leave this to someone else.
As for net-dns/bind[berkdb], we could use the configure argument --with-dlz-bdb=PATH. For prefix systems --with-dlz-bdb="${EPREFIX}"/usr would be sufficient. The problem is that this does not work correctly for crossdev environments, because "${EPREFIX}" is expanded to an empty string. Instead we need to pass as PATH something like "${EPREFIX}"/usr/${CTARGET}/usr (e.g. /usr/aarch64-unknown-linux-gnueabi/usr).
(In reply to Tee KOBAYASHI from comment #14) > As for net-dns/bind[berkdb], we could use the configure argument > --with-dlz-bdb=PATH. For prefix systems --with-dlz-bdb="${EPREFIX}"/usr > would be sufficient. > > The problem is that this does not work correctly for crossdev environments, > because "${EPREFIX}" is expanded to an empty string. Instead we need to pass > as PATH something like "${EPREFIX}"/usr/${CTARGET}/usr (e.g. > /usr/aarch64-unknown-linux-gnueabi/usr). You probably want ESYSROOT for cross.
Created attachment 746796 [details, diff] net-dns/bind-9.16.21: Use ESYSROOT. Specify dlz-bdb path. So this patch for ebuild of net-dns/bind might work.
Don't change the --prefix path, that's used for installation.
Created attachment 746799 [details, diff] (revised) net-dns/bind-9.16.21: Use ESYSROOT. Specify dlz-bdb path. Is this OK?
Yep. I'm not sure about the effect on --with-openssl, but it's probably correct. I'd like the reporter to test this before we merge it.
FWIW, the following packages (found by grepping with 'ssl.*EPREFIX') may suffer from the same issue: app-admin/apache-tools app-benchmarks/siege app-crypt/heimdal dev-db/freetds dev-java/tomcat-native dev-lang/erlang dev-lang/php dev-perl/DBD-mysql dev-tcltk/tls mail-client/alpine net-dns/bind-tools net-dns/bind net-dns/unbound net-ftp/lftp net-im/pidgin net-irc/unrealircd net-libs/ldns net-libs/neon net-mail/fetchmail net-misc/curl net-misc/stunnel www-client/elinks www-client/lynx www-client/w3mmee
(In reply to Tee KOBAYASHI from comment #20) We will probably need separate bugs for any affected packages. Or at least 1 bug per maintainer. Alternatively, if someone could put a pull request together to fix the issue in all affected packages, we could probably get maintainers to sign off on them via Github.
Yeah. And we will need a clever way to do that. Simply substituting ${ESYSROOT} for ${EPREFIX} does not work, as shown above.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=209d2266879aa701b67812f45aa35ed067e0ff21 commit 209d2266879aa701b67812f45aa35ed067e0ff21 Author: Sam James <sam@gentoo.org> AuthorDate: 2021-11-10 05:37:18 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2021-11-10 05:37:18 +0000 net-dns/bind: fix cross-compilation for openssl and berkdb Closes: https://bugs.gentoo.org/820284 Thanks-to: Tee KOBAYASHI <xtkoba@gmail.com> Signed-off-by: Sam James <sam@gentoo.org> net-dns/bind/bind-9.16.22.ebuild | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Additionally, it has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4d8bb09a33ef4eb06eaa82d73db423fd76654c83 commit 4d8bb09a33ef4eb06eaa82d73db423fd76654c83 Author: Sam James <sam@gentoo.org> AuthorDate: 2021-11-10 05:39:34 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2021-11-10 05:40:06 +0000 net-dns/bind-tools: fix cross compilation for libidn Bug: https://bugs.gentoo.org/820284 Closes: https://bugs.gentoo.org/417131 Thanks-to: Bertrand Jacquin <bertrand@jacquin.bzh> Signed-off-by: Sam James <sam@gentoo.org> net-dns/bind-tools/bind-tools-9.16.22.ebuild | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)