SCons的:GCC忽略-c
-
11-09-2019 - |
题
我使用基于MinGW的-GCC交叉编译器来编译该使用SCons作为其构建系统的一个项目。
在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之间有一个空格)。
有没有人有任何想法是怎么回事?有什么我可以做,以解决这个问题?
解决方案
该项目采用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环境。改变到中性平台,和显式指定的扩展,解决了这个问题。
不隶属于 StackOverflow