码迷,mamicode.com
首页 > 其他好文 > 详细

GCC compile debug: print include files and compile stage info.

时间:2015-07-02 01:09:43      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:gcc

Sample code:

#include <stdio.h>
#include <stdlib.h>

extern void foo() __attribute__((weak));
int main() {
  if (foo) foo();
  printf("this is a test\n");
}

Compile command:

gcc -H -v sample.c 

Compile options:

-H tells you that the right include files (in /usr/local/) are used.
Official document:

Print the name of each header file used, in addition to other normal
activities. Each name is indented to show how deep in the ‘#include’
stack it is. Precompiled header files are also printed, even if they
are found to be invalid; an invalid precompiled header file is printed
with ‘…x’ and a valid one with ‘…!’ .

-v (or even maybe -Wl,-v) tells you that the right libraries (in /usr/local/) are used.
Official document:

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.

Sample output:

…………………….
/usr/include/x86_64-linux-gnu/bits/waitflags.h
/usr/include/x86_64-linux-gnu/bits/waitstatus.h
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h
/usr/include/x86_64-linux-gnu/gnu/stubs.h COLLECT_GCC_OPTIONS=’-o’
‘hello’ ‘-H’ ‘-v’ ‘-mtune=generic’ ‘-march=x86-64’ as -v –64 -o
/tmp/ccwD1DYA.o /tmp/cc8CU0IV.s GNU assembler version 2.24
(x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.24
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/lib/:./:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../:/lib/:/usr/lib/
…………..

Ref:

  1. https://gcc.gnu.org/onlinedocs/
  2. http://stackoverflow.com/questions/28563263/c-compiling-errors-on-debian

版权声明:本文为博主原创文章,未经博主允许不得转载。

GCC compile debug: print include files and compile stage info.

标签:gcc

原文地址:http://blog.csdn.net/stpallas/article/details/46717221

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!