Skip to content

Running bazel test on Linux fails on dynamically linked cc_test targets #192

@FabianHahn

Description

@FabianHahn

Running bazel test on cc_test targets that do not specify linkstatic = 1 seems to be broken since v2.1.0. The last working version was v2.0.0.

Minimal reproduction case: https://github.com/FabianHahn/dynamic_test_repro

Example output:

$ bazel test //:dynamic --config=zig_linux --test_output=streamed
INFO: Invocation ID: 24da0913-0973-4b94-b8f7-b978523b237f
WARNING: Streamed test output requested. All tests will be run locally, without sharding, one at a time
INFO: Analyzed target //:dynamic (24 packages loaded, 168 targets configured).
INFO: Found 1 test target...
/home/fabian/.cache/bazel/_bazel_fabian/2cc9cc00e657a7c72ea56ec288228eca/sandbox/linux-sandbox/51/execroot/__main__/bazel-out/k8-fastbuild/bin/dynamic.runfiles/__main__/dynamic: error while loading shared libraries: bazel-out/k8-fastbuild/bin/_solib_k8/liblib_Sliblib.so: cannot open shared object file: No such file or directory
FAIL: //:dynamic (see /home/fabian/.cache/bazel/_bazel_fabian/2cc9cc00e657a7c72ea56ec288228eca/execroot/__main__/bazel-out/k8-fastbuild/testlogs/dynamic/test.log)
Target //:dynamic up-to-date:
  bazel-bin/dynamic
INFO: Elapsed time: 0.371s, Critical Path: 0.20s
INFO: 2 processes: 2 linux-sandbox.
INFO: Build completed, 1 test FAILED, 2 total actions
//:dynamic                                                               FAILED in 0.0s
  /home/fabian/.cache/bazel/_bazel_fabian/2cc9cc00e657a7c72ea56ec288228eca/execroot/__main__/bazel-out/k8-fastbuild/testlogs/dynamic/test.log

Executed 1 out of 1 test: 1 fails locally.

Environment details:

$ lsb_release -ds
Ubuntu 20.04.6 LTS
$ bazel --version
bazel 6.3.0

From the error message, I suspect this is the same issue as #188.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions