Skip to content

autotools: skip compiler prefixes during aclocal directory search - #6277

Open
bernhardkaindl wants to merge 1 commit into
spack:developfrom
bernhardkaindl:aclocal-search-only-non-compiler-paths
Open

autotools: skip compiler prefixes during aclocal directory search#6277
bernhardkaindl wants to merge 1 commit into
spack:developfrom
bernhardkaindl:aclocal-search-only-non-compiler-paths

Conversation

@bernhardkaindl

@bernhardkaindl bernhardkaindl commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

autotools: skip compiler prefixes during aclocal directory search

For packages using autotools, spack creates a list of search paths for prefix/share/aclocal directories for aclocal -I.

  • This is done by the function _autoreconf_search_path_args of autotools.py. It checks the prefixes of all dependencies for prefix/share/aclocal directories.
  • This is good and needed, but when compilers used for a spack install have a prefix e.g. in /usr and the host has an installation of autoconf in the same prefix, the aclocal -I search path created also contains /usr, as if it was a prefix of a regular dependency that needs it aclocal directory.
  • This happens because the function loops over all dependencies without excluding compiler prefixes from the search.

This is of course an unwanted external inclusion of host-installed aclocal files into the build which we don't want unless needed e.g. for external packages.

This behaviour can be confirmed by making /usr/share/aclocal inaccessible using sudo chmod 700 /usr/share/aclocal. After that, a spack install --overwrite -y gmp from source demonstrates the issue:

> aclocal: error: couldn't open directory '/usr/share/aclocal': Permission denied
> autoreconf: error: aclocal failed with exit status: 1

To only use the needed aclocal paths, do not add prefixes when they're only for compilers when searching for aclocal directories:

  • This skips aclocal directories from compilers in general, e.g. some toolchains might come with an "foreign" aclocal directory, which we would not want to add to spack.
  • Prefixes for external packages are already ordered last in the aclocal search order, so they are not a problem even when their prefix is /usr.
  • The effect is that the compiler prefixes are no longer included in the reglar aclocal search purely because they are dependencies, a prefix has to come from a non-compiler package to be added.
    • If an external package uses prefix: /usr, /usr/share/aclocal would still be added for such external packages, but it would be at the end of the search order, after the internal spack prefixes.

PS: I considered also a wider check for inaccessible directories, but I don't propose it because:

  • The compiler check is the targeted check for this change (no further code and unit-test needed - which had written already)
  • Silently discarding non-accessible/non-scannable directores which might be wrongly blocked by a sandbox tool would silently remove the inclusions of potentially needed aclocal directories, leading to build failures where you don't see the permission error but have to trace back from the resulting build failure to the missing aclocal path to ultimatively find the permission access denial as the root cause, which could affect external packages.

@spackbot-triage spackbot-triage Bot added tests General test capability(ies) build-systems Related to package build systems labels Aug 29, 2026
@bernhardkaindl bernhardkaindl changed the title autotools: skip compiler prefixes in autoreconf search path autotools: skip compiler prefixes during aclocal directory search Aug 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-systems Related to package build systems tests General test capability(ies)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant