Ticket #30434 (closed enhancement: wontfix)
Should port select gcc also set ${prefix}/bin/cc?
| Reported by: | ionic@… | Owned by: | mww@… |
|---|---|---|---|
| Priority: | Low | Milestone: | |
| Component: | ports | Version: | 2.0.0 |
| Keywords: | Cc: | jeremyhu@…, krischik@…, raimue@…, ryandesign@…, Peter.Danecek@… | |
| Port: | gcc_select apple-gcc42 gcc41 gcc42 gcc43 gcc44 gcc45 gcc46 gnat-gcc |
Description
Hi,
currently port select gcc only changes the binaries in $PREFIX/bin.
However, at least some ports use /usr/bin/cc as the default compiler. This ports will likely end up using whatever /usr/bin/cc is set to - for instance llvm-gcc42 if XCode 4 was installed, although the user MAY have selected gcc42 manually and lives under the impression it's used.
Then again, I don't know, whether it's a good thing to fiddle outside of $PREFIX, so I'll open this for discussion.
I'd vote for yes and moreover possibly also change all other symlinks in /usr/bin as gcc, g++, c++ etc. BUT symlink them to their /opt/local/bin counterparts, so we don't need to keep two places in sync.
Best regards,
Mihai
Change History
comment:2 follow-up: ↓ 4 Changed 4 years ago by ionic@…
"Software by default builds using "gcc" (or, equivalently, "cc") and this can be a problem if the user has changed what this is." - and that's what I'm adressing.
I think port select gcc should set the default compiler and given that, also at least to some degree make sure it's used.
At the very least, it should create $PREFIX/bin/cc too (does not currently).
comment:4 in reply to: ↑ 2 Changed 4 years ago by ryandesign@…
Replying to ionic@…:
"Software by default builds using "gcc" (or, equivalently, "cc") and this can be a problem if the user has changed what this is." - and that's what I'm adressing.
The correct way to address this issue is for the authors of every port to ensure they're UsingTheRightCompiler.
Neither "port select gcc" nor anything else in MacPorts should modify /usr/bin/anything. /usr/bin is for Apple to modify, and nobody else.
comment:5 Changed 4 years ago by ionic@…
Yes, I see how this is bad.
Changed my mind, but we should really link $PREFIX/bin/cc (e.g. /opt/local/bin/cc) to the selected GCC version as well. port select gcc won't do that currently and this triggered my "problems".
comment:6 Changed 4 years ago by jmr@…
- Keywords select gcc removed
- Owner changed from macports-tickets@… to mww@…
- Port set to gcc_select apple-gcc42 gcc41 gcc42 gcc43 gcc44 gcc45 gcc46 gnat-gcc
- Cc jeremyhu@…, krischik@… added
comment:7 Changed 4 years ago by jmr@…
- Summary changed from Should port select gcc also set /usr/bin/cc? to Should port select gcc also set ${prefix}/bin/cc?
comment:9 Changed 4 years ago by ionic@…
If you add support for llvm-clang, maybe... otherwise I don't see any reason, as it literally switched between gcc versions only. :)
comment:11 Changed 4 years ago by ionic@…
bump... ${prefix}/bin/cc is still not touched/symlinked. :)
comment:12 Changed 4 years ago by raimue@…
I am thinking about a separate group for cc. This would allow to choose between:
- clang => /usr/bin/clang
- llvm-gcc42 => /usr/bin/llvm-gcc-4.2
- mp-clang => ${prefix}/bin/clang
- mp-llvm-gcc42 => ${prefix}/bin/llvm-gcc-4.2
- mp-gcc => ${prefix}/bin/gcc
Adding a single symlink for gcc should be flexible enough as the version can be selected with the gcc group.
comment:14 Changed 3 years ago by ryandesign@…
With Xcode 4.4 on Mountain Lion, /usr/bin/cc is a link to Apple Clang 4.0, while /usr/bin/gcc is a link to llvm-gcc 4.2. This seems designed to guarantee that /usr/bin/gcc actually behaves mostly like the GNU C compiler, whereas /usr/bin/cc is merely a C compiler, that does not necessarily conform to the GNU C compiler's quirks. This distinction seems valuable.
comment:15 Changed 12 months ago by ryandesign@…
- Cc ryandesign@…, Peter.Danecek@… added
Has duplicate #43734.
comment:16 Changed 12 months ago by jeremyhu@…
- Status changed from new to closed
- Resolution set to wontfix
Absolutely not. If you want a new select option (port select cc), that is another story... but I'd also reccomend against that as well.


ports shouldn't be using the gcc_select'd compiler, see UsingTheRightCompiler