Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys-devel/make: default CXX to c++ instead of g++ #1982

Closed
wants to merge 1 commit into from

Conversation

lei-april
Copy link
Contributor

Bug #589894

Package-Manager: portage-2.2.28

Bug #589894

Package-Manager: portage-2.2.28
@mgorny
Copy link
Member

mgorny commented Jul 28, 2016

While I agree this is in line with how CC is defined, I don't think we ought to change this without upstream doing the same. It's not good for Gentoo make to behave different from make on other distributions.

@blueness
Copy link
Contributor

I agree with @mgorny Can you help me understand precisely why this is a problem as you say in bug #589894. Does invoking g++ on a musl/clang system fail?

@mgorny
Copy link
Member

mgorny commented Jul 28, 2016

I think his point is that if we implement the eselect logic to symlink c++ to clang++, make will still default to g++ rather than c++/clang++.

@blueness
Copy link
Contributor

@zzlei Have bounced this by upstream? GNU make releases move slowly, but if upstream OK's it, we can legitimately backport it.

@lei-april
Copy link
Contributor Author

lei-april commented Jul 29, 2016

@blueness I asked about this upstream and their rationale is: cc is the C compiler name required by POSIX (actually in the latest standard it's changed to c99), but there's no requirement for a C++ compiler. And it seems in the early days, there's only g++ but no c++ (which I don't think is valid on modern systems), so GNU Make simply picked g++ as the C++ compiler.

I've checked macOS and FreeBSD; their Make systems both default CXX to c++, and I think there're good reasons to do so on Linux as well. What about a USE flag that enables this feature optionally? @mgorny

@mgorny
Copy link
Member

mgorny commented Jul 29, 2016

Nah, this is not worth the confusion associated with USE flags. I'd say the change makes sense since CC defaults to cc and not gcc, and we can guarantee c++ will be valid. We could take this as Gentoo customization. @blueness, what do you think?

@blueness
Copy link
Contributor

I think upstream's reasoning is bad. I'd like to see it be c++. If we make the change then, yes, we as a distro will have to make sure c++ is correct. I'm not sure how to do that if a system has both clang and gcc installed since I haven't played with clang much, but I can't imagine it being difficult.

@mgorny
Copy link
Member

mgorny commented Jul 29, 2016

I agree. While this is not strictly necessary, I'd say we should ensure that cc/c++ point to the same compiler. Normally both point at gcc but if we start supporting switching that (e.g. using eselect-compiler @zzlei proposed), make should default to matching compilers.

@lei-april
Copy link
Contributor Author

FWIW, the latest POSIX spec replaces cc with c99, and GNU Make might make the switch in the future (http://lists.gnu.org/archive/html/bug-make/2016-07/msg00020.html).

The eselect-compiler module will need to handle this correctly.

@monsieurp monsieurp added bugfix assigned PR successfully assigned to the package maintainer(s). labels Jul 31, 2016
@mgorny mgorny added enhancement and removed bugfix labels Aug 5, 2016
@mgorny
Copy link
Member

mgorny commented Nov 25, 2016

@blueness, ping. Can we merge this? ;-)

@jbergstroem
Copy link
Contributor

I think Lei's argument makes sense here. Seeing how the standard doesn't define a requirement but recent (and even old) versions of gcc (g++) as well as other c++ compilers provide this I only see a win by doing so. Additionally (as Lei also mentioned), cmake defaults to it; meaning other people have also spent time thinking and validating (disqualifying) its effects.

@jbergstroem
Copy link
Contributor

Just found this by running in to the same issue a few months later. Anyone thought more about this?

gentoo-bot pushed a commit that referenced this pull request Apr 14, 2017
Now with ~arch revbump!

Closes: #1982
Package-Manager: portage-2.2.28
Reviewed-by: Anthony G. Basile <blueness@gentoo.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assigned PR successfully assigned to the package maintainer(s).
Projects
No open projects
LLVM cleanup/updates
clang as system compiler
5 participants