Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 797367 - sys-devel/crossdev: poor handling of error in .eclass sourcing, renders broken environment (was: fails to compile cross-gcc-stage1)
Summary: sys-devel/crossdev: poor handling of error in .eclass sourcing, renders broke...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Crossdev team
URL:
Whiteboard: stabilize >=crossdev-20210621, remove...
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-21 13:31 UTC by Marco Scardovi (scardracs)
Modified: 2022-09-13 17:14 UTC (History)
5 users (show)

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


Attachments
cross log (cross-aarch64-unknown-linux-gnu-gcc-stage1.tar.xz,65.18 KB, application/x-xz)
2021-06-21 13:31 UTC, Marco Scardovi (scardracs)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Scardovi (scardracs) 2021-06-21 13:31:09 UTC
Created attachment 717456 [details]
cross log

Running both --stable or not it fails to compile. Posting log
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2021-06-21 13:37:33 UTC
> ../image/usr/lib/libcc1*': No such file or directory"

It should be a ../image/usr/lib64/libcc1* for amd64 host. Probably related to https://gitweb.gentoo.org/repo/gentoo.git/commit/eclass/multilib.eclass?id=596e7156811e60ed8850db940e85a318a47615f7
Comment 2 Larry the Git Cow gentoo-dev 2021-06-21 13:46:24 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=279f37e6f42a9ee83d797c8ca350aaf7ac7279e9

commit 279f37e6f42a9ee83d797c8ca350aaf7ac7279e9
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2021-06-21 13:44:42 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2021-06-21 13:46:20 +0000

    multilib.eclass: store EAPI=0 support used by crossdev
    
    Reported-by: Marco Scardovi (scardracs)
    Bug: https://bugs.gentoo.org/797367
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 eclass/multilib.eclass | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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

commit f7b715c14cd9af2686b1da5be1e677de048a6178
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2021-06-21 13:43:50 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2021-06-21 13:46:20 +0000

    toolchain-funcs.eclass: restore EAPI=0 support used by crossdev
    
    Reported-by: Marco Scardovi (scardracs)
    Bug: https://bugs.gentoo.org/797367
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 eclass/toolchain-funcs.eclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Comment 3 Larry the Git Cow gentoo-dev 2021-06-21 21:23:23 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=b40ebcdb89f19d2fd0c563590f30d7574cfe0755

commit b40ebcdb89f19d2fd0c563590f30d7574cfe0755
Author:     David Seifert <soap@gentoo.org>
AuthorDate: 2021-06-21 13:30:46 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2021-06-21 21:04:16 +0000

    crossdev, emerge-wrapper: request EAPI=7 on eclass imports
    
    Today ::gentoo dropped support for EAPI=0 from multilib.eclass
    and toolchain-funcs.eclass. Due to lack of error handling on
    crossdev side srossdev derived wrong environment for $CTARGET
    (and mostly fell back to CHOST).
    
    This caused at best failing early on gcc-stage1 build. At worst
    crossdev installed libraries into a wrong $(get_libdir), installed
    symlinks from wrong host and other disasters.
    
    Previous crossdev commits make crossdev crash earlier instead of
    generating wrong environment. This commit allows dropping EAI=0
    support for eclasses eventually.
    
    Reported-by: Marco Scardovi (scardracs)
    Bug: https://bugs.gentoo.org/797367
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 crossdev                | 2 +-
 wrappers/emerge-wrapper | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=c121a1faf88221af7246c45687578f5258c416af

commit c121a1faf88221af7246c45687578f5258c416af
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2021-06-21 20:56:09 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2021-06-21 20:56:09 +0000

    wrappers/emerge-wrapper: fail crossdev setup when toolchain-funcs.eclass sourcing fails
    
    Before the change toolchain-funcs.eclass import failure did not fail hard
    and generated suboptimal default ARCH. It's not as bad as crossdev's
    equivalent 'multilib.eclass' source failure, but still not perfect.
    
    The change exposes die() calls to be visible in crossdev run:
    ```
    $ rm -rf '@GENTOO_PORTAGE_EPREFIX@/usr/foo/etc'; ./emerge-wrapper --target foo --init
    emerge-wrapper: ERROR: toolchain-funcs.eclass: EAPI 0 not supported
    emerge-wrapper: ERROR: Failed calling 'tc-arch' from toolchain-funcs.eclass.
    ```
    
    Reported-by: Marco Scardovi (scardracs)
    Bug: https://bugs.gentoo.org/797367
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 wrappers/emerge-wrapper | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

https://gitweb.gentoo.org/proj/crossdev.git/commit/?id=0f2a105de5c407a2fa0113d0815d54e0067bbb4b

commit 0f2a105de5c407a2fa0113d0815d54e0067bbb4b
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2021-06-21 18:42:28 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2021-06-21 18:42:28 +0000

    crossdev: fail eval when multilib.eclass sourcing fails
    
    Before the change failure to source 'multilib.eclass' resuled in
    a fallback mode to be used instead of hard failure.
    
    It was caused by two expansion layers of 'eval $(...)'.
    
    After the change falure to source 'mmultilib.eclass' hard fails early:
    
    ```
    $ PORTAGE_CONFIGROOT=$(pwd)/foo EPREFIX=$(pwd)/foo PORT_LOGDIR=$(pwd)/foo ./crossdev -t mmix -P -p
     * error: : EAPI 0 not supported
     *
     * If you file a bug, please attach the following logfiles:
     * /home/slyfox/dev/git/crossdev/foo/cross--info.log
     *
     * error: could not load multilib settings for 'HCHOST'
     *
     * If you file a bug, please attach the following logfiles:
     * /home/slyfox/dev/git/crossdev/foo/cross-mmix-info.log
    ```
    
    Reported-by: Marco Scardovi (scardracs)
    Bug: https://bugs.gentoo.org/797367
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 crossdev | 5 +++++
 1 file changed, 5 insertions(+)
Comment 4 Larry the Git Cow gentoo-dev 2021-06-21 21:53:55 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=768f0db9a6ee8f01d527b6f38bedc95ad3fe0dfb

commit 768f0db9a6ee8f01d527b6f38bedc95ad3fe0dfb
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2021-06-21 21:53:35 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2021-06-21 21:53:52 +0000

    sys-devel/crossdev: bump up to 20210621
    
    The important changes are error mandling around .eclass sourcing
    and explicit request for recent EAPI=7 for eclass sourcing:
    - crossdev, emerge-wrapper: request EAPI=7 on eclass imports
    - crossdev: fail eval when multilib.eclass sourcing fails
    - wrappers/emerge-wrapper: fail crossdev setup when toolchain-funcs.eclass
      sourcing fails
    
    Reported-by: Marco Scardovi (scardracs)
    Bug: https://bugs.gentoo.org/797367
    Package-Manager: Portage-3.0.20, Repoman-3.0.3
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 sys-devel/crossdev/Manifest                 |  1 +
 sys-devel/crossdev/crossdev-20210621.ebuild | 35 +++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2021-06-21 21:59:29 UTC
Next steps:
1. stabilize >=crossdev-20210621 following usual 30 day period
2. remove #c2 hack when it's likely safe

[2.] is tricky as people might not update world for a while and yet still sync ::gentoo and use crossdev. I hope one month would would be enough time to update for most people.
Comment 6 Larry the Git Cow gentoo-dev 2021-07-05 07:05:27 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5e55d2ce12d3364a66077b58aca2f36247b8511b

commit 5e55d2ce12d3364a66077b58aca2f36247b8511b
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2021-07-05 07:05:12 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2021-07-05 07:05:21 +0000

    sys-devel/crossdev: stabilize 20210621 early everywhere
    
    New crossdev looks working. Let's give people time to migrate to it.
    
    Reported-by: Marco Scardovi (scardracs)
    Bug: https://bugs.gentoo.org/797367
    Package-Manager: Portage-3.0.20, Repoman-3.0.3
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 sys-devel/crossdev/crossdev-20210621.ebuild | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 7 Marco Scardovi (scardracs) 2022-09-13 17:10:28 UTC Comment hidden (obsolete)
Comment 8 Marco Scardovi (scardracs) 2022-09-13 17:10:38 UTC
Can we consider it fixed after 1+ year?
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-09-13 17:14:43 UTC
(In reply to Marco Scardovi (scardracs) from comment #8)
> Can we consider it fixed after 1+ year?

There's still the nasty issue of crossdev faking EAPI 7 which should be fixed somehow to something more reliable, I think.

But yes, the main issue is gone.