forked from arduino/arduino-cli
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
builder: use the @ syntax to reduce command line length if needed
This is required if the number of object files is too high. Fix arduino#839
- Loading branch information
Showing
1 changed file
with
8 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,14 @@ func link(ctx *types.Context, objectFiles paths.PathList, coreDotARelPath *paths | |
quotedObjectFiles := utils.Map(objectFiles.AsStrings(), wrapWithDoubleQuotes) | ||
objectFileList := strings.Join(quotedObjectFiles, " ") | ||
|
||
// If the number of object files is too big, write it down into a file and reference | ||
// it using the @ parameter "@path/to/object_files.txt". | ||
if len(objectFileList) > 500 { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
cmaglie
Author
Owner
|
||
objectFilesTxt := ctx.BuildPath.Join("object_files.txt") | ||
objectFilesTxt.WriteFile([]byte(strings.Join(quotedObjectFiles, "\n") + "\n")) | ||
objectFileList = "@" + objectFilesTxt.String() | ||
} | ||
|
||
properties := buildProperties.Clone() | ||
properties.Set(constants.BUILD_PROPERTIES_COMPILER_C_ELF_FLAGS, properties.Get(constants.BUILD_PROPERTIES_COMPILER_C_ELF_FLAGS)) | ||
properties.Set(constants.BUILD_PROPERTIES_COMPILER_WARNING_FLAGS, properties.Get(constants.BUILD_PROPERTIES_COMPILER_WARNING_FLAGS+"."+ctx.WarningsLevel)) | ||
|
This should probably be a lower value. I had roughly 64k characters with ~500 files. To get less than 32k characters something around 200 files should be better (also depends on the filenames)