Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid "Argument list is too large" on building via nix. #2733

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion nix/buildLeanPackage.nix
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,19 @@ with builtins; let
cPath = relpath + ".c";
inherit leanFlags leanPluginFlags;
leanLoadDynlibFlags = map (p: "--load-dynlib=${pathOfSharedLib p}") (loadDynlibsOfDeps deps);
passAsFile = [
# When building a package with too many dependencies,
# this variable become huge, which cause "Argument list is too large" error,
# so it should be passed as a file to avoid such errors.
"leanLoadDynlibFlags"
];
buildCommand = ''
# Increase stack limit to avoid "Argument list is too large" error.
ulimit -s unlimited
dir=$(dirname $relpath)
mkdir -p $dir $out/$dir $ilean/$dir $c/$dir
if [ -d $src ]; then cp -r $src/. .; else cp $src $leanPath; fi
lean -o $out/$oleanPath -i $ilean/$ileanPath -c $c/$cPath $leanPath $leanFlags $leanPluginFlags $leanLoadDynlibFlags
lean -o $out/$oleanPath -i $ilean/$ileanPath -c $c/$cPath $leanPath $leanFlags $leanPluginFlags $(cat $leanLoadDynlibFlagsPath)
'';
}) // {
inherit deps;
Expand Down