Seems that USE cxx is here to switch off g++ and ability to compile c++ code, however with the latest gcc I can do it. I didn't test previous [ebuild R ~] sys-devel/gcc-9.2.0:9.2.0::gentoo USE="fortran lto (multilib) nptl openmp pch (-altivec) -cxx -d -debug -doc (-fixed-point) -go -graphite (-hardened) (-jit) (-libssp) -nls -objc -objc++ -objc-gc -pgo -pie -sanitize -ssp -systemtap -test -vanilla -vtv" 0 KiB # g++-9.2.0 hello.cpp -o hello && ./hello Hello, World!
https://gitweb.gentoo.org/repo/gentoo.git/tree/eclass/toolchain.eclass?id=84fc5c9d1092eeacdf29900874d83fedca5bdacc#n2374: is_cxx() { gcc-lang-supported 'c++' || return 1 ! is_crosscompile && tc_version_is_at_least 4.8 && return 0 use_if_iuse cxx } This allows to disable support for C++ only for cross-compiled GCC >=4.8. eclass/toolchain.eclass CVS log: https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/toolchain.eclass?view=log - Revision 1.616: "For 4.8+ C++ is always enabled. We should eventually drop the cxx USE flag, but who knows what that would break." https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/toolchain.eclass?r1=1.615&r2=1.616 - Revision 1.618: "fix cross-compiling a stage1 with gcc-4.8 -- we can't enable c++ right away" https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/toolchain.eclass?r1=1.617&r2=1.618 I do not know what was the problem with cross-compiling. If there is no longer a problem, then "cxx" USE flag could be dropped from IUSE in GCC >=4.8.
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #1) > https://gitweb.gentoo.org/repo/gentoo.git/tree/eclass/toolchain. > eclass?id=84fc5c9d1092eeacdf29900874d83fedca5bdacc#n2374: > > is_cxx() { > gcc-lang-supported 'c++' || return 1 > ! is_crosscompile && tc_version_is_at_least 4.8 && return 0 > use_if_iuse cxx > } > > > This allows to disable support for C++ only for cross-compiled GCC >=4.8. > > > eclass/toolchain.eclass CVS log: > https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/toolchain. > eclass?view=log > > - Revision 1.616: > "For 4.8+ C++ is always enabled. We should eventually drop the cxx USE flag, > but who knows what that would break." > https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/toolchain. > eclass?r1=1.615&r2=1.616 > > - Revision 1.618: > "fix cross-compiling a stage1 with gcc-4.8 -- we can't enable c++ right away" > https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/toolchain. > eclass?r1=1.617&r2=1.618 > > > I do not know what was the problem with cross-compiling. > If there is no longer a problem, then "cxx" USE flag could be dropped from > IUSE in GCC >=4.8. USE=-cxx is useful for cross-compilers because: - Some targets (like bare metal) don't support C++ as there is no complete OS interface available. - Sometimes the only thing you need it a bare minimum of a cross-compiler for C only. Without need to build c++/libstdc++. For native case USE=-cxx does not make sense because gcc is written in c++. It would brick your system.
Maybe it would make sense for profiles/base/package.use.force to have this entry?: # C++ support can be disabled only for cross-compilers. sys-devel/gcc cxx
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=006c932930706e3d1aed08c9b2270ea7c456050d commit 006c932930706e3d1aed08c9b2270ea7c456050d Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2019-08-17 22:49:01 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2019-08-17 22:56:07 +0000 base/package.use.force: force sys-devel/gcc[cxx] Modern gcc needs c++ to boostrap. Self-hosted Gentoo system can't do it with USE=-cxx gcc. Historically toolchain.eclass prevented from disabling the flag by accident. Reported-by: Agostino Sarubbo Closes: https://bugs.gentoo.org/692126 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> profiles/base/package.use.force | 6 ++++++ 1 file changed, 6 insertions(+) Additionally, it has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=908c4163cd990303aa7ffc2241f058eefffe91ff commit 908c4163cd990303aa7ffc2241f058eefffe91ff Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2019-08-17 22:52:48 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2019-08-17 22:56:07 +0000 toolchain.eclass: obey user's USE=cxx option, bug #692126 USE=cxx presence on typical systems is maintained by profiles/base/package.use.force entry. Let's drop silent override from the eclass. Reported-by: Agostino Sarubbo Bug: https://bugs.gentoo.org/692126 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> eclass/toolchain.eclass | 1 - 1 file changed, 1 deletion(-)
*** Bug 828678 has been marked as a duplicate of this bug. ***
Following up on the comment from duplicate bug report: (In reply to Sam James from comment #3) > It's forced on. Have you verified the build.log / emerge actually says -cxx? Yes, emerge --info sys-devel/gcc shows cxx is disabled. build.log shows: Languages: c Configuring GCC with: blah blah blah --enable-languages=c blah blah blah
(In reply to Alec Ari from comment #6) > Following up on the comment from duplicate bug report: > > (In reply to Sam James from comment #3) > > It's forced on. Have you verified the build.log / emerge actually says -cxx? > > Yes, emerge --info sys-devel/gcc shows cxx is disabled. > > build.log shows: > > Languages: c > > Configuring GCC with: > > blah blah blah > --enable-languages=c > blah blah blah If you are certain it's actually disabled and it's still being built, please upload the build.log in the other bug and I guess it's not a duplicate.