用MinGW命令长命令行TEMPFILE [英] SCons long command line TEMPFILE with MinGW
问题描述
我正在尝试在Windows上使用SCons和MinGW从gcc和gfortran对象构建共享库,但是在最终链接期间,命令行太长,超过18000个字符.我知道我需要使用一个临时文件(响应文件?)来传递命令行,但是我找不到让SCons直接执行此操作的方法.我在该库中使用CMake,它在没有干扰的情况下处理了响应文件.
I'm trying to build a shared library from gcc and gfortran objects using SCons and MinGW on Windows, but during the final link the command line is too long, in excess of 18000 characters. I know I need to use a tempfile (response file?) to pass the command line, but I can't find a way to get SCons to do this directly. I was using CMake for this library and it handled the response file without my interference.
SCons似乎正在使用CommandGeneratorAction生成共享库命令行.有没有办法告诉该操作使用响应文件机制?还有另一种方法可以处理我忽略的长命令行吗?
SCons appears to be using the CommandGeneratorAction to generate the shared library command line. Is there a way to tell this action to use the response file mechanism? Is there another method for handling long command lines that I'm overlooking?
相关的SConscript:
Relevant SConscript:
sqllib = env.SharedLibrary(target='fvssql', source=sqllib_sources, LIBS=['odbc32',])
ffelib = env.SharedLibrary(target='fvspncffe', source=ffelib_sources, LIBS=[sqllib,], LIBPATH=['.',])
fvsobjs = env.SharedObject(fvslib_sources)
fvsobjs = [obj for obj in fvsobjs if obj.get_suffix()=='.o']
fvslib = env.SharedLibrary(target='fvspnc', source=fvsobjs, LIBS=sqllib+ffelib, LIBPATH=['.',])
env.Dump()的相关输出:
Relevant output from env.Dump():
'SHLIBSUFFIX': '.dll',
'SHLINK': '$LINK',
'SHLINKCOM': <SCons.Action.CommandGeneratorAction object at 0x02DDF770>,
'SHLINKFLAGS': ['$LINKFLAGS', '-shared'],
我可以在环境env['SHLINKCOM']="${TEMPFILE('$SHLINK -o $TARGET ... $SOURCE')}"
中准备命令行模板,但这似乎很脆弱,如果可能的话,我宁愿让SCons对其进行处理.
I could prepare the command line template in my environment env['SHLINKCOM']="${TEMPFILE('$SHLINK -o $TARGET ... $SOURCE')}"
, but this seems fragile and I'd prefer to let SCons handle it if possible.
我尝试使用字符串替换env['SHLINKCOM']='${TEMPFILE("%s")}' % (env['SHLINKCOM'],)
,但是结果是命令行不完整,现在无论如何都响应文件.
I tried using string substitution env['SHLINKCOM']='${TEMPFILE("%s")}' % (env['SHLINKCOM'],)
, but the result was an incomplete command line and now response file anyhow.
编辑
我已经看到了 LongCmdLinesOnWin32 解决方法.如果可能的话,我宁愿使用TEMPFILE,TempFileMunge,命令行间接机制.
I have seen the LongCmdLinesOnWin32 workaround. I would prefer to use the TEMPFILE, TempFileMunge, commandline indirection mechanism if possible.
推荐答案
您是否看到过 http://scons.org /wiki/LongCmdLinesOnWin32 ?在链接阶段,长命令处理似乎可以解决您的确切问题.
Have you seen http://scons.org/wiki/LongCmdLinesOnWin32? It looks like there is an answer to your exact problem with long command ling during the link phase.
这篇关于用MinGW命令长命令行TEMPFILE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!