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 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?
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=['.',])
Relevant output from env.Dump():
'SHLIBSUFFIX': '.dll',
'SHLINK': '$LINK',
'SHLINKCOM': <SCons.Action.CommandGeneratorAction object at 0x02DDF770>,
'SHLINKFLAGS': ['$LINKFLAGS', '-shared'],
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.
I tried using string substitution env['SHLINKCOM']='${TEMPFILE("%s")}' % (env['SHLINKCOM'],)
, but the result was an incomplete command line and now response file anyhow.
EDIT
I have seen the LongCmdLinesOnWin32 workaround. I would prefer to use the TEMPFILE, TempFileMunge, commandline indirection mechanism if possible.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With