APR (ab)uses AC_TRY_RUN to determine if: * We have /dev/zero * We can mmap /dev/zero The APR ebuild sets ac_cv_file__dev_zero=yes when cross compiling to fill in an answer for the first question, but the configure script immediately defeats that when answering the second. The configure script sets conflicting #defines, and the preprocessor produces code that doesn't compile: locks/unix/proc_mutex.c:1494:28: error: ‘mutex_proc_pthread_methods’ undeclared (first use in this function); did you mean ‘mutex_posixsem_methods’? 1494 | new_mutex->meth = &mutex_proc_pthread_methods; Attached is a patch which changes APR's configure script when cross compiling to rely on /dev/zero to be mmap-able. The patch has a longer explanation. Reproducible: Always Steps to Reproduce: 1. Set up a cross compiler 2. $TARGET-emerge apr Actual Results: locks/unix/proc_mutex.c:1494:28: error: ‘mutex_proc_pthread_methods’ undeclared (first use in this function); did you mean ‘mutex_posixsem_methods’? 1494 | new_mutex->meth = &mutex_proc_pthread_methods; Expected Results: Successful build. Portage 3.0.30 (python 3.9.9-final-0, default/linux/arm/17.0/armv6j/systemd, gcc-11.2.1, unavailable, 5.15.11-gentoo x86_64) ================================================================= System uname: Linux-5.15.11-gentoo-x86_64-Intel-R-_Core-TM-_i7-3770_CPU_@_3.40GHz-with-glibc2.34 KiB Mem: 16359728 total, 11377256 free KiB Swap: 24956920 total, 24956920 free Timestamp of repository gentoo: Sat, 08 Jan 2022 10:51:51 +0000 sh bash 5.1_p16 ld GNU ld (Gentoo 2.37_p1 p1) 2.37 distcc 3.4 x86_64-pc-linux-gnu [disabled] ccache version 4.5.1 [disabled] app-misc/pax-utils: 1.3.3::gentoo app-shells/bash: 5.1_p12::gentoo dev-lang/perl: 5.34.0-r6::gentoo dev-lang/python: 3.9.9::gentoo sys-apps/baselayout: 2.8::gentoo sys-apps/systemd: 250-r1::gentoo sys-devel/binutils: 2.37_p1-r1::gentoo sys-devel/binutils-config: 5.4::gentoo sys-devel/make: 4.3::gentoo sys-kernel/linux-headers: 5.15-r3::gentoo (virtual/os-headers) sys-libs/glibc: 2.34-r4::gentoo Repositories: gentoo location: /usr/portage sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 sync-rsync-verify-metamanifest: yes sync-rsync-verify-max-age: 24 sync-rsync-extra-opts: sync-rsync-verify-jobs: 1 x-portage location: /usr/local/portage masters: gentoo crossdev location: /var/db/repos/crossdev masters: gentoo priority: 10 ACCEPT_KEYWORDS="arm ~arm" ACCEPT_LICENSE="@FREE" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=armv6kz -mtune=arm1176jzf-s -mfpu=vfp -O3 -pipe -fgcse-sm -fgcse-las -fgraphite -fgraphite-identity -fvariable-expansion-in-unroller -fuse-linker-plugin -flto" CHOST="arm-unknown-linux-gnueabihf" CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt /var/ossec/etc" 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/apache2-php8.1/ext-active/ /etc/php/cgi-php8.0/ext-active/ /etc/php/cgi-php8.1/ext-active/ /etc/php/cli-php8.0/ext-active/ /etc/php/cli-php8.1/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-march=armv6kz -mtune=arm1176jzf-s -mfpu=vfp -O3 -pipe -fgcse-sm -fgcse-las -fgraphite -fgraphite-identity -fvariable-expansion-in-unroller -fuse-linker-plugin -flto" DISTDIR="/var/cache/distfiles" EMERGE_DEFAULT_OPTS=" --jobs=3 --load-average=8.1 --keep-going --quiet-fail y --quiet-repo-display " 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="-O2 -pipe -march=armv6j" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox nodoc noinfo noman parallel-fetch pid-sandbox 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=armv6j" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="en_US.UTF-8" LDFLAGS="-Wl,--as-needed" MAKEOPTS="-j8 -l7" PKGDIR="/usr/arm-unknown-linux-gnueabihf/packages/" PORTAGE_CONFIGROOT="/usr/arm-unknown-linux-gnueabihf/" 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/arm-unknown-linux-gnueabihf/tmp/" SHELL="/bin/bash" USE="acl arm bzip2 cli crypt dri fortran gdbm iconv ipv6 libglvnd ncurses nls nptl openmp pcre readline seccomp split-usr ssl systemd udev unicode xattr zlib" 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_ARM="edsp thumb v4 v5 v6" 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" 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_9" RUBY_TARGETS="ruby26 ruby27" USERLAND="GNU" VIDEO_CARDS="exynos fbdev omap dummy v4l" 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, 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
Created attachment 761676 [details, diff] Patch to configure.in
Created attachment 761677 [details] Build log
Signed-off-by: Alexandra Parker <alex.iris.parker@gmail.com>
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7080fc27a36a02b528415b262a2a83f0a8462ba9 commit 7080fc27a36a02b528415b262a2a83f0a8462ba9 Author: James Le Cuirot <chewi@gentoo.org> AuthorDate: 2022-11-13 17:25:12 +0000 Commit: James Le Cuirot <chewi@gentoo.org> CommitDate: 2022-11-13 17:25:25 +0000 dev-libs/apr: Apply patch to fix cross-compiling 1.7.0-r6 Fixes detection of /dev/zero. Thanks to Alexandra Parker for the patch. This has not yet been submitted upstream. Closes: https://bugs.gentoo.org/830833 Signed-off-by: James Le Cuirot <chewi@gentoo.org> dev-libs/apr/apr-1.7.0-r6.ebuild | 1 + dev-libs/apr/files/apr-1.7.0-dev-zero.patch | 34 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+)
The patch works well and makes sense to me, so I've applied it. Thanks, Alexandra, especially for the thorough explanation, and sorry it took so long. I'd be very grateful if you could submit this upstream. It's still relevant in the upcoming 2.0.
Submitted upstream: https://bz.apache.org/bugzilla/show_bug.cgi?id=66364