2009-08-06 95 views
1

我正在使用基於MinGW的GCC交叉編譯器來編譯使用SCons作爲其構建系統的項目。SCons:GCC忽略-c

Python是本機2.6.2版本,並未專門爲MinGW(或Cygwin)編譯。

不過,我正在與構建一個問題:

F:/pedigree/compilers/bin/i686-elf-gcc -o build\src\user\applications\apptest\ma 
in.obj -c -std=gnu99 -march=i486 -fno-builtin -m32 -g0 -O3 -Wno-long-long -Wnest 
ed-externs -Wall -Wextra -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-long- 
long -Wno-variadic-macros -Wno-unused -Wno-unused-variable -Wno-conversion -Wno- 
format -Wno-empty-body -fno-stack-protector -DTHREADS -DDEBUGGER -DDEBUGGER_QWER 
TY -DSERIAL_IS_FILE -DECHO_CONSOLE_TO_SERIAL -DKERNEL_NEEDS_ADDRESS_SPACE_SWITCH 
-DADDITIONAL_CHECKS -DBITS_32 -DKERNEL_STANDALONE -DVERBOSE_LINKER -DX86 -DX86_ 
COMMON -DLITTLE_ENDIAN -D__UD_STANDALONE__ -DINSTALLER -Isrc\subsys\posix\includ 
e -Ibuild\src\user\applications\apptest -Isrc\user\applications\apptest src\user 
\applications\apptest\main.c 
f:/pedigree/compilers/bin/../lib/gcc/i686-elf/4.4.1/../../../../i686-elf/bin/ld. 
exe: crt0.o: No such file: No such file or directory 

如果我添加 -c到CFLAGS,我會得到一個名爲編譯對象「main.obj -c」(有一個obj和-c之間的空間)。

有沒有人有任何想法發生了什麼?我能做些什麼來解決這個問題嗎?

回答

2

該項目採用POSIX平臺執行progarm和目標文件的擴展名,但是POSIX平臺SCons的定義一個函數「越獄」:

def escape(arg): 
    "escape shell special characters" 
    slash = '\\' 
    special = '"$()' 

    arg = string.replace(arg, slash, slash+slash) 
    for c in special: 
     arg = string.replace(arg, c, slash+c) 

    return '"' + arg + '"' 

一旦泄漏出來的反斜槓,它肆虐在Windows環境。更改爲中性平臺並明確指定擴展名可修復問題。