Search code examples
cgccsolariscc

what is CC compiler in Solaris 11 for compiling c programs. make file specifies something like " CC=cc -Xa -mt -xc99=no_lib"


I have these lines in my make file:

ifeq ($(SYSTEM),SOLARIS)
    # SUN Solaris 8 no c99
    ifeq ($(OSVER),510)
        CC=c99 -Xa -mt 
        LD=c99
    else
        CC=cc -Xa -mt -xc99=no_lib
        LD=cc 

I have to compile my code in Solaris 11. Previously someone compiled in Solaris 10 or 9. Not sure which.

If I execute which CC its giving "no CC in user/bin" error. But my Solaris 11 has GCC installed in it. Do I have change CC=GCC or I have install new CC. If i have to install new CC which one I have to install?


Solution

  • cc typically points to the system default compiler. On Solaris this would be part of SolarisStudio (which may or may not be installed).

    If cc is not available (test with which cc), but gcc is, then your Makefile should be adjusted to point to the gcc location.

    Your Makefile may now look like:

    ifeq ($(SYSTEM),SOLARIS)
        # SUN Solaris 8 no c99
        ifeq ($(OSVER),510)
            CC=c99 -Xa -mt 
            LD=c99
        else ifeq ($(OSVER),11)
            CC:=/usr/sfw/bin/gcc
        else
            CC=cc -Xa -mt -xc99=no_lib
            LD=cc