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

Bug 665508

Summary: sys-devel/crossdev: report gcc version being used
Product: Gentoo Linux Reporter: Rafael Kitover <rkitover>
Component: Current packagesAssignee: Gentoo Crossdev team <crossdev>
Status: CONFIRMED ---    
Severity: normal CC: embedded, jstein, slyfox
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Rafael Kitover 2018-09-08 15:31:19 UTC
When I run:

sudo crossdev --target x86_64-w64-mingw32

I get:

* getting sys-devel/gcc from /var/lib/layman/dlang

which is my D language overlay.

The gcc it builds is 6.4.0, but I would rather have the latest.

It seems like it's getting the wrong gcc ebuild.
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2018-09-22 17:12:40 UTC
I think it's an intended behaviour to search overlays first.

This option should define overlay search list:
    -oS, --overlays list     Space delimited list of overlays to search
                                [default: `portageq repositories_configuration`]
Comment 2 Rafael Kitover 2018-10-04 00:57:56 UTC
I admit to not being a gentoo expert yet, however it seems a little counter-intuitive that some random gcc ebuild from some random overlay, which is there for who-knows-what reason, would be built instead of the regular gentoo gcc sources.
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2018-10-04 22:40:57 UTC
I would be hesitant changing behaviour. We can work on making crossdev's output to be more straightforward to understand if the effect is desired or not.
Comment 4 Rafael Kitover 2018-10-06 04:58:56 UTC
So simple solution for me was:

    crossdev --gcc 8.2.0-r3

which was my current gentoo gcc.

This also solved the problem of the wrong gcc being picked up from an overlay.

I see a couple of possiblities here:

- default to current main gcc version, this way an overlay version is still picked up for that version
- require the user to pass wanted gcc version, perhaps they need to think about which gcc version they want in some situations
Comment 5 Rafael Kitover 2018-10-06 08:44:11 UTC
Never mind, that actually did nothing.
Comment 6 Rafael Kitover 2018-10-06 09:11:08 UTC
I tried --overlays gentoo and --overlays sys-devel and it still picks up the bad gcc version from dlang overlay.
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2018-10-06 18:28:32 UTC
To have any effect you might need to delete contents of the overlay.

crossdev does not do much with overlay: on the first srun it builds minimal skeleton repo with directory symlinks pointing to original repo. It does not repoint symlinks afterwards.

You can tweak symlinks manually as well.

$ portage/cross/cross-i686-w64-mingw32:LANG=C ls -l
total 20
lrwxrwxrwx 1 root   root  41 Jan 17  2016 binutils -> /gentoo-ebuilds/gentoo/sys-devel/binutils
lrwxrwxrwx 1 root   root  36 Jan 17  2016 gcc -> /gentoo-ebuilds/gentoo/sys-devel/gcc
lrwxrwxrwx 1 root   root  36 Jan 17  2016 gdb -> /gentoo-ebuilds/gentoo/sys-devel/gdb
lrwxrwxrwx 1 slyfox users 48 Apr  2  2017 ghc -> /home/slyfox/portage/gentoo-haskell/dev-lang/ghc
lrwxrwxrwx 1 root   root  47 Jan 17  2016 mingw64-runtime -> /gentoo-ebuilds/gentoo/dev-util/mingw64-runtime
Comment 8 Rafael Kitover 2018-10-06 21:07:02 UTC
Getting further now.

First I disabled the dlang overlay with:

sudo layman -D dlang

Then I tried building the toolchain with crossdev again, but it failed on gcc stage2, because of some kind of bad interaction with the previously built toolchain most likely.

So I removed the old toolchain with:

eix -# 'cross*/*' | xargs sudo emerge -vC

Looks like crossdev --clean does the same thing.

Now it properly builds gcc 8.2.0-r3 which is my gentoo gcc.

Having some issues with mingw64-runtime 6.0.0 now I'm trying to figure out.
Comment 9 Rafael Kitover 2018-10-07 09:20:14 UTC
So now that I know how to build this with the right gcc, I wanted to make a suggestion.

This is the initial crossdev output for me with the dlang overlay enabled:

rkitover@epyc  ➤  sudo crossdev --target x86_64-w64-mingw32
-                                                                                                                                                                                                                  
 * crossdev version:      20180918
 * Host Portage ARCH:     amd64
 * Target Portage ARCH:   amd64
 * Target System:         x86_64-w64-mingw32
 * Stage:                 4 (C/C++ compiler)
 * USE=multilib:          no
 * ABIs:                  amd64

 * binutils:              binutils-[latest]
 * gcc:                   gcc-[latest]
 * libc:                  mingw64-runtime-[latest]

 * CROSSDEV_OVERLAY:      /var/lib/layman/dlang
 * PORT_LOGDIR:           /var/log/portage
 * PORTAGE_CONFIGROOT:    /
 * Portage flags:

There is no indication that some old version of gcc is being used, would it be possible to replace the [latest] tags with the actual version?

It seems that by default, some random overlay gets used for the cross symlinks, so you have no way of knowing that the wrong overlay is being used. Versions for the toolchain would at least indicate that a wrong version was being used for something for some reason.
Comment 10 Sergei Trofimovich (RETIRED) gentoo-dev 2020-02-08 11:21:18 UTC
Yeah, calling something like
    $ portageq best_version ${EPREFIX} sys-devel/gcc::${OVERLAY}
from crossdev should show exact version.