bazel-contrib / bazel-contrib/rules_go

Build failure when enabling msan via --@io_bazel_rules_go//go/config:msan

Open
#2,896 0 comments 0 reactions 0 assignees View on GitHub
cgo
Dominant language
Go
Stars
1.5k
Forks
760
Avg merge
1d 11h
Merged PRs (30d)
12

Description

### What version of rules_go are you using?

0.27.0

### What version of gazelle are you using?

https://github.com/bazelbuild/bazel-gazelle/archive/d038863ba2e096792c6bb6afca31f6514f1aeecd.zip (Master as of 2021-06-18)

### What version of Bazel are you using?

```
Bazelisk version: v1.7.3
Build label: 4.1.0
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri May 21 11:11:34 2021 (1621595494)
Build timestamp: 1621595494
Build timestamp as int: 1621595494
```

### Does this issue reproduce with the latest releases of all the above?

Yes

### What operating system and processor architecture are you using?

Ubuntu 20.04.2 LTS x86_64

### Any other potentially useful information about your toolchain?

Running wsl 1

### What did you do?

Run `bazel test --@io_bazel_rules_go//go/config:msan //path/to/some/tests/...`

For reference, running with `--@io_bazel_rules_go//go/config:race` does work as expected.

Passing `--features=msan` instead does build (with the expected warning that it is no longer supported, and suggestion to use the above non-functioning command instead)

### What did you expect to see?

I expected the tests to build and run with msan.

### What did you see instead?

```
ERROR: /home/[name]/.cache/bazel/_bazel_[name]/77c5d270e081446f818b7ff6ca1d88c0/external/org_golang_google_protobuf/internal/pragma/BUILD.bazel:3:11: GoCompilePkg external/org_golang_google_protobuf/internal/pragma/pragma.a failed: (E
Use --sandbox_debug to see verbose messages from the sandbox
external/org_golang_google_protobuf/internal/pragma/pragma.go:9:8: can't open import: "sync": open bazel-out/k8-test-dbg/bin/external/io_bazel_rules_go/stdlib_/pkg/linux_amd64_msan/sync.a: no such file or directory
compilepkg: error running subcommand external/go_sdk/pkg/tool/linux_amd64/compile: exit status 2
```

With `--sandbox_debug`:

```
ERROR: /home/[name]/.cache/bazel/_bazel_[name]/77c5d270e081446f818b7ff6ca1d88c0/external/com_github_golang_mock/mockgen/model/BUILD.bazel:3:11: GoCompilePkg external/com_github_golang_mock/mockgen/model/model.a failed: (Exit 1
): process-wrapper failed: error executing command
(cd /home/[name]/.cache/bazel/_bazel_[name]/77c5d270e081446f818b7ff6ca1d88c0/sandbox/processwrapper-sandbox/361/execroot/[dir] && \
exec env - \
CGO_ENABLED=1 \
GOARCH=amd64 \
GOOS=linux \
GOPATH='' \
GOROOT=bazel-out/k8-test-dbg/bin/external/io_bazel_rules_go/stdlib_ \
GOROOT_FINAL=GOROOT \
PATH=/home/[name]/.cache/bazel/_bazel_[name]/77c5d270e081446f818b7ff6ca1d88c0/external/standalone_local_config_cc/v17_clang-10.0.1-centos7/x86_64-unknown-linux-gnu/bin:/bin:/usr/bin \
TMPDIR=/tmp \
/home/[name]/.cache/bazel/_bazel_[name]/install/f95ca91ebc34d56aa0f8ad499de91220/process-wrapper '--timeout=0' '--kill_delay=15' bazel-out/host/bin/external/go_sdk/builder compilepkg -sdk external/go_sdk -installsuffix linux
_amd64_msan -tags msan -src external/com_github_golang_mock/mockgen/model/model.go -importpath github.com/golang/mock/mockgen/model -p github.com/golang/mock/mockgen/model -package_list bazel-out/host/bin/external/go_sdk/p
ackages.txt -o bazel-out/k8-test-dbg/bin/external/com_github_golang_mock/mockgen/model/model.a -x bazel-out/k8-test-dbg/bin/external/com_github_golang_mock/mockgen/model/model.x -gcflags -msan -asmflags '')
external/com_github_golang_mock/mockgen/model/model.go:19:2: can't open import: "encoding/gob": open bazel-out/k8-test-dbg/bin/external/io_bazel_rules_go/stdlib_/pkg/linux_amd64_msan/encoding/gob.a: no such file or directo
ry
compilepkg: error running subcommand external/go_sdk/pkg/tool/linux_amd64/compile: exit status 2
```

`ls -l` in `bazel-out/k8-test-dbg/bin/external/io_bazel_rules_go/stdlib_/pkg/` produces the following, no `linux_amd64_msan`:

```
dr-xr-xr-x 1 [name] [name] 512 Jun 18 13:14 include
dr-xr-xr-x 1 [name] [name] 512 Jun 18 13:15 linux_amd64
dr-xr-xr-x 1 [name] [name] 512 Jun 18 13:14 tool
```

Contributor guide

Open the contributing guide

Research direction

Reproduce with `bazel test --@io_bazel_rules_go//go/config:msan //path/to/some/tests/...`, then inspect the referenced external `BUILD.bazel` targets and the generated `external/io_bazel_rules_go/stdlib_/pkg/` directory. Done means the `linux_amd64_msan` standard-library packages are available and the tests build and run with msan.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.