New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Ticket #30434 (new enhancement)

Opened 22 months ago

Last modified 9 months ago

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@…
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:1 Changed 22 months ago by dluke@…

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

comment:2 follow-up: ↓ 4 Changed 22 months 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:3 Changed 22 months ago by macsforever2000@…

  • Type changed from request to enhancement

comment:4 in reply to: ↑ 2 Changed 22 months 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 22 months 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 22 months ago by jmr@…

  • Cc jeremyhu@…, krischik@… added
  • Owner changed from macports-tickets@… to mww@…
  • Port set to gcc_select apple-gcc42 gcc41 gcc42 gcc43 gcc44 gcc45 gcc46 gnat-gcc
  • Keywords select gcc removed

comment:7 Changed 22 months 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:8 Changed 22 months ago by jeremyhu@…

maybe replace gcc_select with compiler_select ... ?

comment:9 Changed 22 months 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:10 Changed 22 months ago by jmr@…

  • Component changed from base to ports

comment:11 Changed 21 months ago by ionic@…

bump... ${prefix}/bin/cc is still not touched/symlinked. :)

comment:12 Changed 21 months 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:13 Changed 21 months ago by raimue@…

  • Cc raimue@… added

comment:14 Changed 9 months 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.

Note: See TracTickets for help on using tickets.