[Scons-users] 回复: 回复: 回复: 回复: 回复: Ninja compilation fails after using include path file instead of "-I" option
liruncong2018
liruncong2018 at qq.com
Mon Apr 11 21:41:21 EDT 2022
Hi,
[Not sure what you mean by this "Currently, scons needs to set up Depends when using @file."
Are you suggesting that we scan the command line and add any files prefixed by @ as a dependency?]
:: Yes
[If so, that's not universally workable. As "@" isn't alway a prefix to a "response file" on every command line.]
:: default setting:
env['_CC_FILE_PREFIX']='@'
env['_CXX_FILE_PREFIX']='@'
env['_AS_FILE_PREFIX']='@'
env['_LINK_FILE_PREFIX']='--via='
Defining some default prefixes like above and allowing users to change the prefixes should be generic right?
[Is that always going to be "--cpu XYZ", and never "--cpu"?]
:: always "--cpu=xxx"
[Then with a modified TEMPFILE for your links you should be good to go?]
::I'll test this change soon to see if it works
------------------ 原始邮件 ------------------
发件人: "SCons users mailing list" <bill at baddogconsulting.com>;
发送时间: 2022年4月12日(星期二) 凌晨1:19
收件人: "SCons users mailing list"<scons-users at scons.org>;
主题: Re: [Scons-users] 回复: 回复: 回复: 回复: Ninja compilation fails after using include path file instead of "-I" option
Re the linking issue, there's no reason you can't reimplement TEMPFILE such that the --cpu is not included in the temporary response file which is created by SCons...
Not sure what you mean by this "Currently, scons needs to set up Depends when using @file."
Are you suggesting that we scan the command line and add any files prefixed by @ as a dependency?
If so, that's not universally workable. As "@" isn't alway a prefix to a "response file" on every command line.
In your case you want to generate a file with include path once, and then have every compile depend on that.
The best way to do that would be (likely) to modify the emitter for those compilers.
That said since the command line limit is 32k for cmd, you can set MAXLINELENGTH to that, and then skip generating your cpp path file.
Then with a modified TEMPFILE for your links you should be good to go?
See this for the current implementation:
https://github.com/SCons/scons/blob/master/SCons/Platform/__init__.py#L130
In your custom copy, you'd likely want to modify this bit to strip the --cpu out of the args.
https://github.com/SCons/scons/blob/master/SCons/Platform/__init__.py#L266
Is that always going to be "--cpu XYZ", and never "--cpu"?
Also note you can use this: https://scons.org/doc/production/HTML/scons-man.html#cv-TEMPFILEARGESCFUNC to swap the slashes in your paths for the contents of the tempfile.
-Bill
On Mon, Apr 11, 2022 at 8:44 AM Daniel Moody <dmoody256 at gmail.com> wrote:
I have a potential fix to the ninja tool so that it can decide to use response files or not. This should allow you to use your own shared response file.
https://github.com/SCons/scons/pull/4133
On Mon, Apr 11, 2022 at 10:01 AM Mats Wichmann <mats at wichmann.us> wrote:
On 4/11/22 08:57, liruncong2018 via Scons-users wrote:
> Hi,
> Even using msys2 does not solve all problems. The 32K limit solves my
> compilation problems (.cpp -> .o) but not linking (.o -> target) because
> the link command line has around 137K (about 2500 .o files). So
> compilers such as gcc/clang/armclang will support "@file".
> Currently, scons needs to set up Depends when using @file. This
> dependency suggestion is still directly supported by scons, and users do
> not need to write dependencies. It should also be supported when ninja
> is enabled.
> When LINKCOM uses "TEMPFILE", I get a link failure because armlink.exe
> checks if --cpu is specified on the command line, so it is not
> reasonable for "TEMPFILE" to put all options to a temporary file.
Right... thus my suggestion - well, let's call it "musing" rather than
"suggestion" because this might not work at all:
> 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...
_______________________________________________
Scons-users mailing list
Scons-users at scons.org
https://pairlist4.pair.net/mailman/listinfo/scons-users
_______________________________________________
Scons-users mailing list
Scons-users at scons.org
https://pairlist4.pair.net/mailman/listinfo/scons-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20220412/44a041f9/attachment.htm>
More information about the Scons-users
mailing list