[Scons-users] 回复: 回复: 回复: Ninja compilation fails after using include path file instead of "-I" option

Mats Wichmann mats at wichmann.us
Mon Apr 11 10:02:25 EDT 2022


On 4/11/22 07:18, liruncong2018 via Scons-users wrote:
> How long is your normally expanded compile command line (not using
> @__cpp_path.txt) ?  -- About 16K bytes(armclang cmd line) or 137K
> bytes(armlink cmd line).
> If you're building with a flavor of mingw (in msys shell?), what's that
> shells maximum? -- The actual compiler armclang, executed on windows,
> windows cmd supports about 2047 bytes.
> You could potentially change the shell being used by SCons and avoid the
> need for response files altogether. -- Wonder if an unrestricted shell
> exists and can be used on windows? cmd.exe is a widely used shell on
> windows.

If you're running in an msys2 bash shell, the limit is a lot longer:

$ getconf ARG_MAX
32000

However, at the moment, SCons doesn't use the msys bash for executing
the compile commands, so this is kind of a moot point.  I've been an
advocate of changing to do this, but apparently other build tools have
found problems doing so - bazel now recommends not using the msys bash
when building with mingw.

> In addition, the "TEMPFILE" method cannot be linked here, because the
> linker armlink checks whether there is the --cpu option on the command
> line, and if not, an error is reported. "TEMPFILE" puts all options in a
> temporary file, so linking fails.

That's interesting, we should have that recorded somewhere. We already
have some issues that suggest the command name should not be inside the
response file (#1705), perhaps the basic options should not be, either.
That's probably easier for linker commands than compiler commands - for
link commands it's usually a massive list of sources (object files) that
causes the overflow, while for compilers, there can be lots of include
directory paths and other non-source-file stuff that goes into the
command line.

For ninja it currently looks like this:

env["LINKCOM"] = '${TEMPFILE("$LINK $LINKFLAGS /OUT:$TARGET.windows
$_LIBDIRFLAGS $_LIBFLAGS $_PDB $SOURCES.windows", "$LINKCOMSTR")}'

env["SHLINKCOM"] = '${TEMPFILE("$SHLINK $SHLINKFLAGS $_SHLINK_TARGETS
$_LIBDIRFLAGS $_LIBFLAGS $_PDB $_SHLINK_SOURCES", "$SHLINKCOMSTR")}'

So I'm curious if moving $LINK $LINKFLAGS to the left of ${TEMPFILE
would help...



More information about the Scons-users mailing list