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

bazel build //:clotestbin-cc fails with .../copy-closure: paths["$lib"]: unbound variable #55

Open
hofbi opened this issue Jun 13, 2024 · 3 comments

Comments

@hofbi
Copy link
Contributor

hofbi commented Jun 13, 2024

Describe the bug
Fresh bazel build //:clotestbin-cc fails

To Reproduce

  • Clone the repo
  • Install the requirements
  • cd tests
  • bazel build //:clotestbin-cc

Expected behavior
The target is corecctly built

Environment

  • OS name + version: Ubuntu 20.04
  • Version of the code: Latest master

Additional context

WARNING: Option 'host_javabase' is deprecated
WARNING: Option 'host_javabase' is deprecated
INFO: Analyzed target //:clotestbin-cc (0 packages loaded, 0 targets configured).
ERROR: ~/clodl/tests/BUILD:109:15: Action clotestbin-cc-closure.zip failed: (Exit 1): bash failed: error executing Action command (from target //:clotestbin-cc-closure) /bin/bash -c ... (remaining 4 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
bazel-out/k8-opt-exec-ST-879f06706572/bin/external/io_tweag_clodl/copy-closure: line 76: paths["$lib"]: unbound variable
Target //:clotestbin-cc failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 0.321s, Critical Path: 0.07s
INFO: 2 processes: 2 internal.
ERROR: Build did NOT complete successfully
@aherrmann
Copy link
Member

The build succeeds for me if I use the Nix shell

$ nix-shell ../shell.nix --run 'bazel build //:clotestbin-cc'

Without Nix I observe

ERROR: /home/aj/tweag.io/clodl/tests/BUILD:109:15: output 'scanelf' was not created
ERROR: /home/aj/tweag.io/clodl/tests/BUILD:109:15: Action bash failed: not all outputs were created or valid
Target //:clotestbin-cc failed to build

@hofbi
Copy link
Contributor Author

hofbi commented Jun 21, 2024

Using the nix shell, it works for me as well. Is this how people should use this? Should we update the README here?

@facundominguez
Copy link
Member

Thanks for the report, @hofbi.

bazel-out/k8-opt-exec-ST-879f06706572/bin/external/io_tweag_clodl/copy-closure: line 76: paths["$lib"]: unbound variable

This looks like a bug. It would need to be investigated why paths is undefined for the given lib, before deciding a remedy. This is the location of the failure. paths maps library names to their paths, and it is computed by calling to ldd. The missing $lib is coming from the needed array, which is computed by scanelf.

ERROR: /home/aj/tweag.io/clodl/tests/BUILD:109:15: output 'scanelf' was not created

I can reproduce this in the nix-shell if I remove pax-utils from the dependencies. Which hints to me that this is caused by scanelf being missing from the path. This is mentioned as a requirement in the readme, but I'd expect the build to fail in a more telling way when scanelf is missing, so it would be another thing to improve. I think the error comes from executing this action.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants