[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cc vs gcc



On Sun, Jun 21, 2009 at 10:29:37PM +0300, Peter Eisentraut wrote:
> There is a bit of discussion in bug #487546 about whether using cc or gcc as 
> the compiler is appropriate.
> 
> Particular questions:
> 
> * Are Debian packages supposed to be built by default using /usr/bin/gcc (or 
> whatever gcc is first in the path)?  Or is it valid to use cc?

cc has traditionally been the system-default compiler for a Unix system.
Generally, it will support those options specified by POSIX for c99,
since those are a fairly barebones set of options, but it is not
mandated to (since it is not specified).

Since Debian has it specified as an alternative, I would assume that any
C compiler which implements those options would be satisfactory.
Whether cc is a valid choice depends on whether the code will work with
any such compiler.  If a program requires GCC, then it should specify
gcc; if any old compiler will work, then cc should be fine.

> * What interface is the "cc" alternative offering?  Is it a GCC-compatible 
> compiler, or a POSIX/SUS-compatible compiler?

If you want a POSIX-compatible compiler, then you need to use c99;
that's the interface that POSIX mandates.  I would assume that all C
compilers used for cc will at least support C89/C90 and the POSIX
options, since, as I said before, those are a very minimal set of
options.

Also note that POSIX specifies that "the -W (capital-W) option shall be
reserved for vendor options."

> Currently, packages using cdbs will usually end up using CC=cc as their 
> compiler, which is typically gcc, but doesn't have to.  The submitter of the 
> bug isn't really telling what exactly he is doing, but I guess it's 
> a ruling to the contrary on the above questions.

I would consider it a bug if a package that specified CC=cc (whether
intentionally or unintentionally) failed to build with a non-GCC
compiler.  I think the matter is really a package-specific matter.

I see it much like the /bin/sh issue: if a script requires bash, it
should specify bash.  If any /bin/sh will do, then /bin/sh is fine.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 713 440 7475 | http://crustytoothpaste.ath.cx/~bmc | My opinion only
OpenPGP: RSA v4 4096b 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187

Attachment: signature.asc
Description: Digital signature


Reply to: