This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: could help me to fix the problem when install the gcc-7.2


Yubin Ruan kirjoitti 5.10.2017 klo 9:25:


It is normal that a Unix-like system has a "kernel compiler" always, for
compiling the system's "kernel" (base operating system). But not the
"development system" for making even very simple C applications like
the "Hello World"...
That is strange. Why would a "kernel" compiler cannot be used to a
simple C application (and I can't find any kernel compiler in my Linux
system)

Compiling the Unix/Linux kernel shouldn't need the standard C headers (in '/usr/include') and to link against the system's standard C libraries ('libc', 'libm'), the startups (crt*.o) etc.
But producing even a simple C application needs them.

It is adviced that all newbies would try using the '-v' (verbose) option when "compiling" their first apps in order to see what phases will happen during the process :

1. preprocessing the user code and standard headers ('#include <a_header>' in the user
    code)
2. compiling the preprocessed source code into assembly code ('.s')
3. using the assembler ('as') to produce object code ('.o')
4. using the linker ('ld') to link all the "lego pieces" into an executable program

There are those options for 'partial compile' too, for instance the '-S' for leaving the result to the assembly level. Normally it will be produced to as temporary file in '/usr/tmp' or somewhere but quite many times one wants to see the symbolic machine code being
produced from the C source code.

The minimum (kernel) C compiler would include the 'gcc' compiler driver, the 'cc1' real compiler - now including the 'cpp' preprocessor, the assembler ('as') and the linker ('collect2' and 'ld') executables plus the "Linux kernel headers". But not the Standard C Library (glibc) development libraries, startups etc.  And not the Standard C headers in '/usr/include'.  The 'runtime libraries' ('.so' files) of course are always there (in '/lib*')
for running all the executables coming as default.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]