[jamming] Link actions too long (max 996)!
Stephen Farrar
stephen.farrar at cisra.canon.com.au
Sun Jun 4 15:40:07 PDT 2006
Hi Klaus,
The Microsoft linker gets around this problem by using response files.
Instead of using a really long command line, the command line arguments
are written to a "response file" and the linker reads that.
You need to modify your Jambase so that the Link rule uses response
files. Here are some snippets of code:
(Maybe something like this should be put into the standard Jambase.
This problem must come up all the time on windows, surely!)
# This rule creates a response file for the given target. The name of the
# response file is saved in RESPONSEFILE on $(1) so that actions can use it.
# The sources for this rule are written to the response file. If the
sources
# are file names, the bound filenames will be written.
# If this rule is called multiple times for the same target, the new sources
# will be appended to the response file.
# This must be called BEFORE the action that uses the response file. If you
# want to delete the response file after it has been used (a good idea) then
# you can call RemoveResponseFile after the action that uses it.
rule ResponseFile # target-requiring-response-file : files-to-write ;
{
local responsefile = $(1).rsp ;
if ! [ on $(1) FReturn $(RESPONSEFILE) ]
{
on $(1) MakeLocate $(responsefile) : $(LOCATE) ;
Depends $(1) : $(responsefile) ;
Temporary $(responsefile) ;
EmptyResponseFile $(1) ;
RESPONSEFILE on $(1) = $(responsefile) ;
}
AppendResponseFile $(1) : $(2) ;
}
rule FReturn
{
return $(1) ;
}
actions quietly ignore EmptyResponseFile bind RESPONSEFILE
{
$(RM) $(RESPONSEFILE) 2> NUL
}
actions quietly together piecemeal AppendResponseFile bind RESPONSEFILE
{
echo "$(>)" >> $(RESPONSEFILE)
}
actions together quietly ignore RemoveResponseFile bind RESPONSEFILE
{
$(RM) $(RESPONSEFILE) 2> NUL
}
rule Link
{
ResponseFile $(<) : $(>) ;
win32-Link $(<) : $(>) ;
RemoveResponseFile $(<) ;
MODE on $(<) = $(EXEMODE) ;
Chmod $(<) ;
}
actions win32-Link bind RESPONSEFILE
{
$(LINK) $(LINKFLAGS) /out:$(<) $(UNDEFS) @$(RESPONSEFILE)
$(NEEDLIBS) $(LINKLIBS)
}
If you have to link with lots of libraries, you might have to modify
LinkLibraries and put NEEDLIBS in the response file too.
Hope this helps,
Stephen
Klaus Meier wrote:
> I've ported a project under Windows from make to jam.
> Now there is the problem that there are to much characters in the
> commandline for the linker or something else.
> I've also tried to set MAXLINE to something higher but nothing positive
> happened.
>
> Does anybody know a solution of this problem?
>
> Best regards,
>
>
> Winston
More information about the jamming
mailing list