c – Building GCC: Is there a way to only build cpp?-ThrowExceptions

Exception or error:

I am attempting to build GCC however what I really want is only c pre-processor.

Is there a way to build c pre processor on its own?

How to solve:

It seems that CPP is not a separate program all it does is execv cc1 as captured with the following strace command

execve("/usr/lib/gcc/x86_64-linux-gnu/9/cc1", ["/usr/lib/gcc/x86_64-linux-gnu/9/"..., "-E", "-quiet", "-imultiarch", "x86_64-linux-gnu", "-", "-mtune=generic", "-march=x86-64", "-fasynchronous-unwind-tables", "-fstack-protector-strong", "-Wformat", "-Wformat-security", "-fstack-clash-protection", "-fcf-protection"]

# Which results into the following command line
/usr/lib/gcc/x86_64-linux-gnu/9/cc1 -E -quiet -imultiarch x86_64-linux-gnu --mtune=generic -march=x86-64 -fasynchronous-unwind-tables -fstack-protector-strong -Wformat -Wformat-security -fstack-clash-protection -fcf-protection

This is confirmed using from the following link:

https://en.wikibooks.org/wiki/GNU_C_Compiler_Internals/GNU_C_Compiler_Architecture

Program cc1 includes both the preprocessor and C compiler. It compiles
a C source file and generates an assembly (.S) file.

Leave a Reply

Your email address will not be published. Required fields are marked *