Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make gcc show the internal commands called?

Tags:

gcc

Is there a possibility to let gcc (MinGW/Windows) to show all command lines called?

Example:

gcc -o test.exe test.c -desiredOption

... should output something like this:

cc1 -o intermediate.s test.c
as -o intermediate.o intermediate.s
ld - o test.exe intermediate.o crt0.o -lsomelibrary -e __start

Background:

Sometimes some assembler-related options work well when I call "gcc" but they do not work at all when I try to call "ld.exe" directly. Therefore I want to know which option is really passed to "ld.exe" by "gcc.exe".

Under Linux I would use something like:

strace -f gcc -o test.exe test.c

... to see the command lines (as arguments of the execve system calls).

like image 708
Martin Rosenau Avatar asked Nov 13 '16 08:11

Martin Rosenau


People also ask

How do you resolve gcc is not recognized as an internal or external command?

Make sure to set value in the System variable and not in the user variable. Add gcc compiler path upto bin folder in the variable value as shown below and click OK. Close all windows and open new command prompt and compile your program. Now it will compile your program without any error.

How can I tell if gcc is working?

In the Command Prompt window type “gcc” and hit enter. If the output says something like “gcc: fatal error: no input files”, that is good, and you pass the test. Save this answer.

Where is cc1 located?

Location and Overview: City Centre 1 in Salt Lake City Sector 1, Kolkata is a top player in the category Malls in the Kolkata.

What is cc1 in gcc?

cc1 is also referred to as the compiler proper. cc1 preprocesses a c translation unit and compiles it into assembly code. The assembly code is converted into an object file with the assembler. Earlier versions of cc1 used /usr/bin/cpp for the preprocessing stage.


1 Answers

Read the Invoking GCC chapter of the GCC documentation.You want the -v option:

Print (on standard error output) the commands executed to run the stages of compilation. Also print the version number of the compiler driver program and of the preprocessor and the compiler proper.

Notice that on Linux, strace(1) does not show command lines, but system calls.

like image 133
Basile Starynkevitch Avatar answered Sep 29 '22 12:09

Basile Starynkevitch