Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to install Ruby in my home directory on a Linux server (without root access), which of course requires using gcc. The closest thing I can find is a directory by that name which (if you go deep enough) contains cc1:

>: find / -iname gcc 2> /dev/null
/usr/libexec/gcc


>: tree -if /usr/libexec/gcc
/usr/libexec/gcc
/usr/libexec/gcc/x86_64-redhat-linux
/usr/libexec/gcc/x86_64-redhat-linux/4.1.1
/usr/libexec/gcc/x86_64-redhat-linux/4.1.1/cc1
/usr/libexec/gcc/x86_64-redhat-linux/4.1.2 -> 4.1.1

The fact that CC1 redirects to GCC on Wikipedia seems to imply something close to identity, however there's no other mention of CC1 on the GCC page besides the note about redirection, and Googling hasn't gotten me anything useful, and my attempts to use cc1 in place of gcc have failed.

What exactly is the relationship between them? And does it offer me any hope of compiling Ruby on this machine?

share|improve this question

2 Answers 2

up vote 9 down vote accepted

GCC has a number of phases to its compilation, and it uses different internal commands to do each phase. C in particular is first preprocessed with cpp, then is compiled into assembly, assembled into machine language, and then linked together.

cc1 is the internal command which takes preprocessed C-language files and converts them to assembly. It's the actual part that compiles C. For C++, there's cc1plus, and other internal commands for different languages.

There is a book on Wikibooks that explains the process with pictures.

Unfortunately, cc1 is an internal command and only one piece of the installation, and if that's all you have, you will not be able to compile things.

share|improve this answer
    
The usual term is "front end". –  Keith Thompson May 31 '13 at 16:05

gcc is the name of the suite cc is just the C compiler from this suite.

the word cc it's also a generic name for any given c compiler under unix systems, for example it's not rare to find an environment variable called CC in a given building script or configure script, and if you want to be pedantic, this variable usually points to a c compiler that doesn't necessarily performs the linking of your compiled object, it's usually used to refer to a compiler that "just" compiles. cc from gcc is, however, able to output a finished executable so is able to perform this final step with its linker too.

the word cc1 it's often times used "internally" or when reading GNU docs ( example ), it's also used to name gcc-related library based on what language or compiler they belong to ( in this case cc1 = belongs to the c compiler ).

infact if you ask gcc what is the meaning of the word cc1

gcc -print-prog-name=cc1

it should answer with the path for the library for the cc compiler, so you are trying to execute something that is a library and not a real executable.

it's much simpler to remember CC as c compiler and simplify everything, bypass this cc1, you don't need to know how things work internally unless you want to start a long journey.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.