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.
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...
(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.
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(-)
crossdev-99999999 should work now. Testing would be appreciated!
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(+)
(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?