Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 900713 - sys-devel/crossdev: arm-none-eabi builds stage3, not stage4 (no C++ compiler)
Summary: sys-devel/crossdev: arm-none-eabi builds stage3, not stage4 (no C++ compiler)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Crossdev team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2023-03-10 12:05 UTC by Sam James
Modified: 2025-01-06 02:52 UTC (History)
4 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 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-03-10 12:05:26 UTC
In crossdev, we have:
```
[...]
                # Bare metal targets
                *-newlib|*-elf|*-eabi|*-rtems*)
                        LPKG="newlib"
                        KPKG="[none]"
                        STAGE_DEFAULT=${STAGE_LIBC}
[...]
                        ;;     
```

which means we only build a C compiler (-s3) with 'crossdev arm-none-eabi'. This ended up confusing a user in #gentoo.

I'd say it's probably common for users to not want a freestanding C++ compiler, but I'm not sure if we should warn on it or what.
Comment 1 Gil Kloepfer 2024-05-01 05:13:54 UTC
I was looking at https://forums.gentoo.org/viewtopic-p-8734819.html and this is related to what that user experienced.  It looks like when crossdev was developed, it may have been assumed that USE flags were processed such that the first one takes precedence.

It's hard to tell what is actually intended behavior in some places in crossdev and what is being done for other reasons.

In the case of the forum post above, I see clearly that cross-arm-none-abi contains:

cross-arm-none-eabi/gcc cxx -openmp -fortran -hardened -default-stack-clash-protection -ssp -sanitize -vtv -selinux -boundschecking -d -gcj -gtk -libffi -mudflap -objc -objc++ -objc-gc -fortran -go -jit -cxx -mpx -openmp -sanitize -vtv multilib

In the crossdev script, line 387, cxx is added to GUSE for -eabi, and later when the use flags are combined in line 1790:

USE="${GUSE} ${USE} ${GUSE_DISABLE_STAGE_1}"

So the GUSE flags defined are overridden by GUSE_DISABLE_STAGE_1 (which contains -cxx).  I wonder if it was intended that the GUSE flags were placed after GUSE_DISABLE_STAGE_1 flags.

Not knowing for sure what the intent of these variables are, it is impossible to determine if this was what was meant here...
Comment 2 Gil Kloepfer 2024-05-01 16:05:30 UTC
(In reply to Gil Kloepfer from comment #1)
> Not knowing for sure what the intent of these variables are, it is
> impossible to determine if this was what was meant here...

Looking at this a bit more, and with a clearer head, I retract my previous comments.  I think the forum comment, while well-intentioned (and brings-up a good point) misses the purpose of the --stage4 option.  It is definitely more efficient to build the c++ compiler at the same time as the c compiler, but whether this is the right thing to do or not is probably something the crossdev team should decide.
Comment 3 Larry the Git Cow gentoo-dev 2025-01-02 23:26:53 UTC
The bug has been referenced in the following commit(s):

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

commit 0261fe00ae660641f280144000c7b191e01936c1
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2025-01-02 23:25:18 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-01-02 23:26:45 +0000

    crossdev: build C++ by default for *-newlib/*-elf/*-avr etc
    
    These days, tutorials and classes expect a C++ compiler for arm-none-eabi
    and friends and it often confuses users. Stop overriding the crossdev
    default (which is -s4) for these targets accordingly.
    
    Bug: https://bugs.gentoo.org/900713
    Bug: https://bugs.gentoo.org/939677
    Signed-off-by: Sam James <sam@gentoo.org>

 crossdev | 2 --
 1 file changed, 2 deletions(-)
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-02 23:27:29 UTC
crossdev-99999999 should work now. Testing would be appreciated!
Comment 5 Larry the Git Cow gentoo-dev 2025-01-06 02:00:46 UTC
The bug has been closed via the following commit(s):

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

commit 2a7e458463a0bdaa179f1405048984b5198c79f9
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2025-01-06 01:59:55 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2025-01-06 01:59:55 +0000

    sys-devel/crossdev: add 20250106
    
    Sam James (26):
          crossdev, Makefile: fix version handling again
          Revert "crossdev, Makefile: fix version handling again"
          crossdev: nvptx: force on openmp & fortran
          Revert "crossdev: nvptx: force on openmp & fortran"
          crossdev: nvptx: add comment wrt GFORCE and openmp/fortran
          crossdev: drop 'nocxx' (noop)
          crossdev: small style tweaks
          crossdev: crank copyright
          crossdev: build C++ by default for *-newlib/*-elf/*-avr etc
          ci: fix whitespace
          ci: add embedded/special targets (arm-none-eabi, nvptx-none)
          ci: add avr too
          ci: fix loong and uncomment
          ci: fix comment typo
          ci: add HPPA targets
          ci: don't run loong musl
          ci: no userland for hppa64
          ci: add bpf-unknown-none
          ci: add s390-ibm-linux-gnu
          ci: adjust s390x tuple name
          ci: add alpha-unknown-linux-gnu
          ci: add powerpc64le-unknown-linux-gnu
          ci: add more arm targets
          ci: add aarch64_be-unknown-linux-gnu
          ci: try to get binpkgs for dev-vcs/git and friends (via eselect-repository)
          crossdev: special-case bpf
    
    Closes: https://bugs.gentoo.org/900713
    Closes: https://bugs.gentoo.org/939677
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/crossdev/Manifest                 |  1 +
 sys-devel/crossdev/crossdev-20250106.ebuild | 40 +++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-01-06 02:52:56 UTC
(In reply to Gil Kloepfer from comment #1)
> In the crossdev script, line 387, cxx is added to GUSE for -eabi, and later
> when the use flags are combined in line 1790:
> 
> USE="${GUSE} ${USE} ${GUSE_DISABLE_STAGE_1}"
> 
> So the GUSE flags defined are overridden by GUSE_DISABLE_STAGE_1 (which
> contains -cxx).  I wonder if it was intended that the GUSE flags were placed
> after GUSE_DISABLE_STAGE_1 flags.
> 
> Not knowing for sure what the intent of these variables are, it is
> impossible to determine if this was what was meant here...

I don't think it matters much given it's stage1, it gets overridden later, right?