Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 927017

Summary: autotools.eclass breaks on projects using `AC_CONFIG_AUX_DIR`
Product: Gentoo Linux Reporter: Sergei Trofimovich <slyich>
Component: EclassesAssignee: Gentoo's Team for Core System packages <base-system>
Status: UNCONFIRMED ---    
Severity: normal CC: slyich
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Sergei Trofimovich 2024-03-14 12:10:41 UTC
Initially observed as a failure on nix-2.21.0 upstream package (not in ::gentoo).

Self-contained example of cat/bug-0 package:

```ebuild
# $ cat bug-0.ebuild
EAPI=8
SLOT=0

inherit autotools

src_unpack () {
    mkdir -p "$S"
}

src_prepare() {
        mkdir -p config
        cat > configure.ac <<-EOF
        AC_INIT([bug], [0], [https://dev.null])
        AC_CONFIG_AUX_DIR([config])
        AC_CANONICAL_HOST
        AC_OUTPUT
EOF

        eapply_user

        eautoreconf

        find
}
```

It's build fails as:

```
$ ebuild cat/bug/bug-0.ebuild clean configure
Appending /bound/nix-guix-gentoo to PORTDIR_OVERLAY...
>>> Unpacking source...
>>> Source unpacked in /dev/shm/portage/cat/bug-0/work
>>> Preparing source in /dev/shm/portage/cat/bug-0/work/bug-0 ...
 * Running eautoreconf in '/dev/shm/portage/cat/bug-0/work/bug-0' ...
 * Running 'aclocal --system-acdir=/dev/shm/portage/cat/bug-0/temp/aclocal' ...  [ ok ]
 * Running 'autoconf --force' ...                                                [ ok ]
 * Running elibtoolize in: bug-0/
.
./config
./configure.ac
./.__autoconf_trace_data
./autom4te.cache
./autom4te.cache/requests
./autom4te.cache/traces.0
./autom4te.cache/output.0
./autom4te.cache/traces.1
./autom4te.cache/output.1
./autom4te.cache/traces.2
./autom4te.cache/output.2
./config.guess
./config.sub
./configure
./.elibtoolized
>>> Source prepared.
>>> Configuring source in /dev/shm/portage/cat/bug-0/work/bug-0 ...
 * econf: updating bug-0/config.guess with /usr/share/gnuconfig/config.guess
 * econf: updating bug-0/config.sub with /usr/share/gnuconfig/config.sub
./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --datarootdir=/usr/share --docdir=/usr/share/doc/bug-0 --htmldir=/usr/share/doc/bug-0/html --libdir=/usr/lib64
configure: loading site script /usr/share/config.site
configure: loading site script /usr/share/config.site.d/80crossdev.conf
configure: error: cannot find required auxiliary files: config.guess config.sub

!!! Please attach the following file when seeking support:
!!! /dev/shm/portage/cat/bug-0/work/bug-0/config.log
```

It fails because autotools.eclass places config.guess config.sub not to expected `config/` firectory set by AC_CONFIG_AUX_DIR, but to the root directory.

For comparison this is how configuration succeeds when ran manually:

```
$ mkdir /tmp/b
$ pushd /tmp/b
$ mkdir -p config
$         cat > configure.ac <<-EOF
        AC_INIT([bug], [0], [https://dev.null])
        AC_CONFIG_AUX_DIR([config])
        AC_CANONICAL_HOST
        AC_OUTPUT
EOF
$ autoreconf -ifv
autoreconf-2.72: export WARNINGS=
autoreconf-2.72: Entering directory '.'
autoreconf-2.72: configure.ac: not using Gettext
autoreconf-2.72: running: aclocal --force
autoreconf-2.72: configure.ac: tracing
autoreconf-2.72: configure.ac: not using Libtool
autoreconf-2.72: configure.ac: not using Intltool
autoreconf-2.72: configure.ac: not using Gtkdoc
autoreconf-2.72: running: /usr/bin/autoconf-2.72 --force
autoreconf-2.72: configure.ac: not using Autoheader
autoreconf-2.72: configure.ac: not using Automake
autoreconf-2.72: 'config/config.sub' is created
autoreconf-2.72: 'config/config.guess' is created
autoreconf-2.72: Leaving directory '.'
$ find
.
./config
./config/config.sub
./config/config.guess
./configure.ac
./autom4te.cache
./autom4te.cache/requests
./autom4te.cache/traces.0
./autom4te.cache/output.0
./autom4te.cache/traces.1
./autom4te.cache/output.1
./autom4te.cache/traces.2
./autom4te.cache/output.2
./configure

$ ./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --datarootdir=/usr/share --docdir=/usr/share/doc/bug-0 --htmldir=/usr/share/doc/bug-0/html --libdir=/usr/lib64
configure: loading site script /usr/share/config.site
configure: loading site script /usr/share/config.site.d/80crossdev.conf
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
configure: creating ./config.status
```

Note how `autoreconf` places files to config/ and ./configure succeeds. I think `eautoreconf` should do the same.
Comment 1 Sergei Trofimovich 2024-03-14 12:17:24 UTC
# emerge --info
Portage 3.0.63 (python 3.11.8-final-0, default/linux/amd64/17.1, gcc-13, glibc-2.39-r2, 6.7.5 x86_64)
=================================================================
System uname: Linux-6.7.5-x86_64-AMD_Ryzen_9_5950X_16-Core_Processor-with-glibc2.39
KiB Mem:   131856332 total,  17780292 free
KiB Swap:  197783036 total, 190911484 free
Head commit of repository gentoo: 83be941214e55eb8224e8fda0f2649222c5b37b1

Head commit of repository nix-guix: 63787b76a41377441d0bc06aa5ce5f2663e72aac

sh bash 5.2_p26
ld GNU ld (Gentoo 2.41 p5) 2.41.0
ccache version 4.9.1 [disabled]
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p26::gentoo
dev-build/autoconf:        2.72-r1::gentoo
dev-build/automake:        1.16.5-r2::gentoo
dev-build/cmake:           3.28.3::gentoo
dev-build/libtool:         2.4.7-r2::gentoo
dev-build/make:            4.4.1-r1::gentoo
dev-build/meson:           1.3.2::gentoo
dev-lang/perl:             5.38.2-r2::gentoo
dev-lang/python:           3.11.8_p1::gentoo, 3.12.2_p1::gentoo
dev-lang/rust:             1.76.0::gentoo
dev-util/ccache:           4.9.1::gentoo
sys-apps/baselayout:       2.15::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-apps/systemd:          254.10::gentoo
sys-devel/binutils:        2.41-r5::gentoo, 2.42-r1::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/gcc:             12.3.1_p20240209::gentoo, 13.2.1_p20240210::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-kernel/linux-headers:  6.7::gentoo (virtual/os-headers)
sys-libs/glibc:            2.39-r2::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo/gentoo.git
    priority: -1000
    volatile: False

crossdev
    location: /co
    masters: gentoo
    volatile: True

nix-guix
    location: /var/db/repos/nix-guix
    sync-type: git
    sync-uri: https://github.com/trofi/nix-guix-gentoo.git
    masters: gentoo
    volatile: False

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -fdiagnostics-show-option -frecord-gcc-switches"
CHOST="x86_64-pc-linux-gnu"
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 /etc/terminfo"
CXXFLAGS="-O2 -pipe"
DISTDIR="/bound/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"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live config-protect-if-modified distlocks ebuild-locks fail-clean fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news parallel-fetch pid-sandbox 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"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="C.UTF8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu"
LEX="flex"
MAKEOPTS="-j17 -l17"
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="/dev/shm"
SHELL="/bin/bash"
USE="X acl amd64 bzip2 cli crypt dri fortran gdbm harfbuzz iconv ipv6 libtirpc minizip multilib ncurses nls opengl openmp pam pcre readline seccomp split-usr ssl systemd test-rust unicode xattr zlib" ABI_X86="64" ADA_TARGET="gnat_2021" 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" CPU_FLAGS_X86="mmx mmxext sse sse2" ELIBC="glibc" 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-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" VIDEO_CARDS="amdgpu fbdev intel nouveau radeon radeonsi vesa dummy" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS