Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 738918 - autotools.eclass breaks aclocal macro search order if $SYSROOT is used
Summary: autotools.eclass breaks aclocal macro search order if $SYSROOT is used
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 724318 756211
  Show dependency tree
 
Reported: 2020-08-25 10:43 UTC by Hasso Tepper
Modified: 2022-03-26 05:44 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hasso Tepper 2020-08-25 10:43:20 UTC
The fix for https://bugs.gentoo.org/710792 committed broke several ebuilds if SYSROOT is used. 

If aclocal is called with -I arguments, these paths are prepended to the system macros path: https://www.gnu.org/software/automake/manual/automake.html#Macro-Search-Path

But if $SYSROOT is used, autotools.eclass puts now the system directory from it (autotools_m4sysdir_include()) into aclocal command line BEFORE the local arguments.

This breaks apps which contain local macros which should override the system ones. At the moment it breaks several apps which contain local macros which should override the ones from autoconf-archive:

dev-util/strace
media-libs/harfbuzz
media-libs/tiff

Reproducible: Always
Comment 1 David Michael 2020-08-25 17:01:13 UTC
I suggested a fix in bug #677002 but did not get any response.  It's been a while since I looked at this, but I recall there being a race somewhere (i.e. the packages you listed don't fail for me).  When I was able to trigger it, I was able to reorder the arguments through the environment to make it work by setting AT_M4DIR="m4".
Comment 2 Larry the Git Cow gentoo-dev 2022-01-22 22:22:47 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5593ef751758f5e45b470f678134b93dd6b17078

commit 5593ef751758f5e45b470f678134b93dd6b17078
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-01-14 19:21:28 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-01-22 22:22:23 +0000

    autotools.eclass: use --system-acdir for aclocal
    
    We need to instruct aclocal that it might find macros in both
    ${BROOT} _and_ ${SYSROOT}.
    
    - A classic example within BROOT is autoconf-archive.
    
    - A classic example within SYSROOT is, say, libogg. A fair amount of
      codec software installs its own macro to help locating it (but this
      is in no ways limited to that genre/area).
    
      The correct position for a dependency like libogg is DEPEND, and yet
      the status quo doesn't mean that aclocal is obligated to check in ${ESYSROOT}
      which is where DEPEND-class dependencies are guaranteed to be installed.
    
      We can't rely on these being in BDEPEND -- in fact, most of the time,
      they won't be. If we wanted to rely on macros always being provided by
      BDEPEND, we'd have to duplicate a considerable number of dependencies
      in both BDEPEND + DEPEND, with the unnecessary cross-compilation that would
      entail too: it makes far more sense to just tell aclocal to look in the
      right place (an extra location).
    
    Bug: https://bugs.gentoo.org/710792
    Closes: https://bugs.gentoo.org/677002
    Closes: https://bugs.gentoo.org/738918
    Thanks-to: David Michael <fedora.dm0@gmail.com> (for the suggestion)
    Thanks-to: James Le Cuirot <chewi@gentoo.org> (rubberducking & sounding board)
    Signed-off-by: Sam James <sam@gentoo.org>

 eclass/autotools.eclass | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=553191db3544b3c9960c47283329cb315649dfa3

commit 553191db3544b3c9960c47283329cb315649dfa3
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-01-12 02:53:04 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-01-22 22:21:15 +0000

    autotools.eclass: don't inject -I${SYSROOT} to aclocal
    
    When -I${SYSROOT} is injected, it'll override the default of -Im4, which
    results in trying to install macros to ${SYSROOT} (a sandbox violation)
    when they can't be found.
    
    From aclocal(1):
    ```
           -I DIR add directory to search list for .m4 files
    
           --install
                  copy third-party files to the first -I directory
    ```
    
    The first directory is normally -Im4 if anything, whereas when injected
    (when ${SYSROOT} is defined), it ends up being ${SYSROOT}, not m4 (so
    we try to copy macros to somewhere outside of the build directory).
    
    [We could drop this just for > EAPI 7, but I'm not sure there's much
    point there either. As Chewi observed in bug 677002, you can't
    assume they'll be present in ${SYSROOT} anyway, and frankly,
    the cross-compilation (and --root, --sysroot, and so on) situation
    is rather bleak for earlier EAPIs, which is why we did all that
    work for 7.]
    
    Bug: https://bugs.gentoo.org/710792
    Closes: https://bugs.gentoo.org/677002
    Closes: https://bugs.gentoo.org/738918
    Thanks-to: James Le Cuirot <chewi@gentoo.org>
    Signed-off-by: Sam James <sam@gentoo.org>

 eclass/autotools.eclass | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)