I put up a simple repro project that anyone can clone:
~/src/github.com/jarreds $ git clone [email protected]:jarreds/toomanyfiles.git
Cloning into 'toomanyfiles'...
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 0), reused 5 (delta 0), pack-reused 0
Receiving objects: 100% (5/5), done.
~/src/github.com/jarreds $ cd toomanyfiles/
~/src/github.com/jarreds/toomanyfiles $ bazel build //:toomanyfiles
Loading:
Loading: 0 packages loaded
Analyzing: target //:toomanyfiles (1 packages loaded, 0 targets configured)
INFO: Analysed target //:toomanyfiles (3 packages loaded, 30 targets configured).
INFO: Found 1 target...
bazel: Entering directory `/private/var/tmp/_bazel_jward/f47a410108a7b6bad68cd01a437e2533/execroot/__main__/'
[0 / 7] [-----] BazelWorkspaceStatusAction stable-status.txt
ERROR: /private/var/tmp/_bazel_jward/f47a410108a7b6bad68cd01a437e2533/external/com_github_awslabs_goformation/cloudformation/resources/BUILD.bazel:3:1: GoCompile external/com_github_awslabs_goformation/cloudformation/resources/darwin_amd64_stripped/go_default_library%/github.com/awslabs/goformation/cloudformation/resources.a failed (Exit 1) builder failed: error executing command bazel-out/host/bin/external/go_sdk/builder ... (remaining 4 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
compile: error starting compiler: fork/exec external/go_sdk/pkg/tool/darwin_amd64/compile: argument list too long
bazel: Leaving directory `/private/var/tmp/_bazel_jward/f47a410108a7b6bad68cd01a437e2533/execroot/__main__/'
Target //:toomanyfiles failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 1.137s, Critical Path: 0.40s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully
Marking as a bug. Might be able to shorten arguments a little bit.
However, this package has 1223 files. Seems like an extreme edge case.
I'm running into this too when trying to work with https://github.com/awslabs/goformation
Same issue here for this https://github.com/awslabs/goformation repository. This repository generates class code from AWS Cloudformation template schema. So I assume to many classes in the same folder is the issue.
same here. Any workarounds for this?
Hey all. awslabs/goformation maintainer here...
v3.0.0 of goformation now splits up the AWS resources into separate packages (directories) by AWS service name. While this doesn't address the Bazel bug, it will stop people who are using goformation from hitting it.
Thanks so much @PaulMaddox !!!! This is amazing work!
We are seeing a similar error when using rules_go 7d825a39a9c5fc49f4dfe7b09c8ce8ec59ea6be8
ERROR: /Users/danlei/go-code/src/.../BUILD.bazel:3:1: GoCompilePkg src/.../darwin_amd64_stripped/go_default_library%/.../module.a failed (Exit 1) sandbox-exec failed: error executing command
(cd /private/var/tmp/_bazel_danlei/cca83b827ef1975bef03823d2f7a8745/sandbox/darwin-sandbox/1997/execroot/__main__ && \
exec env - \
APPLE_SDK_PLATFORM=MacOSX \
APPLE_SDK_VERSION_OVERRIDE=10.15 \
CGO_ENABLED=1 \
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \
GOARCH=amd64 \
GOOS=darwin \
GOPATH='' \
GOROOT=external/go_sdk \
GOROOT_FINAL=GOROOT \
PATH=external/local_config_cc:/bin:/usr/bin \
SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk \
TMPDIR=/var/folders/mx/ryng158x0l1645kjkcl43mn00000gn/T/ \
XCODE_VERSION_OVERRIDE=11.2.1.11B500 \
/usr/bin/sandbox-exec -f /private/var/tmp/_bazel_danlei/cca83b827ef1975bef03823d2f7a8745/sandbox/darwin-sandbox/1997/sandbox.sb /var/tmp/_bazel_danlei/install/4f12cbbb3a294bfa314e578758559d54/process-wrapper '--timeout=0' '--kill_delay=15' bazel-out/host/bin/external/go_sdk/builder '-param=bazel-out/darwin-fastbuild/bin/src/.../module/darwin_amd64_stripped/go_default_library%/.../module.a-0.params')
compilepkg: error running nogo: fork/exec bazel-out/darwin-opt-exec-2B5CBBC6/bin/darwin_amd64_stripped/default_nogo: argument list too long
Do you think nogo failing is the same issue seen here? Or should I open another ticket?
Most helpful comment
Hey all. awslabs/goformation maintainer here...
v3.0.0 of goformation now splits up the AWS resources into separate packages (directories) by AWS service name. While this doesn't address the Bazel bug, it will stop people who are using goformation from hitting it.