舉例來說 如果你原本的編譯指令為
/usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/bin/msdk-linux-gcc -I.. -I../.. -I../../include -O -DOPENSSL_THREADS -pthread -D_REENTRANT -D_THREAD_SAFE -D_THREADSAFE -fPIC -c -o bss_dgram.o bss_dgram.c
如果編譯過程遇到一些問題而想查看到底gcc幫你加了什麼來編譯該檔案
可以在同樣的指令後面再加上
-E -v
如:
/usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/bin/msdk-linux-gcc -I.. -I../.. -I../../include -O -DOPENSSL_THREADS -pthread -D_REENTRANT -D_THREAD_SAFE -D_THREADSAFE -fPIC -c -o bss_dgram.o bss_dgram.c
-E -v
如此就不會真的去編譯檔案 而是列出gcc 的一些設定與參考路徑, 以上面例子在我自己的pc上為例, 會看到
Using built-in specs.
Target: mips-linux
Configured with: MSDK Builder release 4.3
Thread model: posix
gcc version 4.3.6 20110218 (prerelease) (GCC)
COLLECT_GCC_OPTIONS='-nostdinc' '-isystem' '/usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/include' '-idirafter' '/usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/include/gcc' '-mhard-float' '-EL' '-mips32r2' '-I..' '-I../..' '-I../../include' '-O' '-DOPENSSL_THREADS' '-pthread' '-D_REENTRANT' '-D_THREAD_SAFE' '-D_THREADSAFE' '-fPIC' '-c' '-o' 'bss_dgram.o' '-E' '-v' '-mllsc'
/usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/bin/../libexec/gcc/mips-linux/4.3.6/cc1 -E -quiet -nostdinc -v -I.. -I../.. -I../../include -imultilib el -iprefix /usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/bin/../lib/gcc/mips-linux/4.3.6/ -D_REENTRANT -DOPENSSL_THREADS -D_REENTRANT -D_THREAD_SAFE -D_THREADSAFE -isystem /usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/include -idirafter /usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/include/gcc bss_dgram.c -o bss_dgram.o -mel -mhard-float -mips32r2 -mllsc -fPIC -O
#include "..." search starts here:
#include <...> search starts here:
..
../..
../../include
/usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/include
/usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/include/gcc
End of search list.
COMPILER_PATH=/usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/bin/../libexec/gcc/mips-linux/4.3.6/:/usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/bin/../libexec/gcc/:/usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/bin/../lib/gcc/mips-linux/4.3.6/../../../../mips-linux/bin/
LIBRARY_PATH=/usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/bin/../lib/gcc/mips-linux/4.3.6/el/:/usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/bin/../lib/gcc/mips-linux/4.3.6/:/usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/bin/../lib/gcc/:/usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/bin/../lib/gcc/mips-linux/4.3.6/../../../../mips-linux/lib/
COLLECT_GCC_OPTIONS='-nostdinc' '-isystem' '/usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/include' '-idirafter' '/usr/local/msdk-4.3.6-mips-EL-2.6.34-0.9.30.3_hwfpu/include/gcc' '-mhard-float' '-EL' '-mips32r2' '-I..' '-I../..' '-I../../include' '-O' '-DOPENSSL_THREADS' '-pthread' '-D_REENTRANT' '-D_THREAD_SAFE' '-D_THREADSAFE' '-fPIC' '-c' '-o' 'bss_dgram.o' '-E' '-v' '-mllsc'