Opened 13 years ago

Closed 10 years ago

#30434 closed enhancement (wontfix)

Should port select gcc also set ${prefix}/bin/cc?

Reported by: Ionic (Mihai Moldovan) Owned by: mww@…
Priority: Low Milestone:
Component: ports Version: 2.0.0
Keywords: Cc: jeremyhu (Jeremy Huddleston Sequoia), krischik@…, raimue (Rainer Müller), ryandesign (Ryan Carsten Schmidt), petrrr
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 (16)

comment:1 Changed 13 years ago by danielluke (Daniel J. Luke)

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

comment:2 Changed 13 years ago by Ionic (Mihai Moldovan)

"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 13 years ago by mf2k (Frank Schima)

Type: requestenhancement

comment:4 in reply to:  2 Changed 13 years ago by ryandesign (Ryan Carsten Schmidt)

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 13 years ago by Ionic (Mihai Moldovan)

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 13 years ago by jmroot (Joshua Root)

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

comment:7 Changed 13 years ago by jmroot (Joshua Root)

Summary: Should port select gcc also set /usr/bin/cc?Should port select gcc also set ${prefix}/bin/cc?

comment:8 Changed 13 years ago by jeremyhu (Jeremy Huddleston Sequoia)

maybe replace gcc_select with compiler_select ... ?

comment:9 Changed 13 years ago by Ionic (Mihai Moldovan)

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 13 years ago by jmroot (Joshua Root)

Component: baseports

comment:11 Changed 13 years ago by Ionic (Mihai Moldovan)

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

comment:12 Changed 13 years ago by raimue (Rainer Müller)

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 13 years ago by raimue (Rainer Müller)

Cc: raimue@… added

comment:14 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

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 10 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: ryandesign@… Peter.Danecek@… added

Has duplicate #43734.

comment:16 Changed 10 years ago by jeremyhu (Jeremy Huddleston Sequoia)

Resolution: wontfix
Status: newclosed

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.

Note: See TracTickets for help on using tickets.