1
Fork 0

Update README with rules_go workaround

It will be better advertised/documented after it's tested with
`go_binary`, `go_library` and `go_test`.
This commit is contained in:
Motiejus Jakštys 2021-11-05 19:49:24 +02:00
parent 34b85cf57f
commit 22b5d3e8e3
1 changed files with 1 additions and 27 deletions

View File

@ -96,33 +96,6 @@ Background: when glibc 2.27 or older is selected, it may miss `fcntl64`. A
workaround is applied for `x86_64`, but not for aarch64. The same workaround
may apply to aarch64, but the author didn't find a need to test it (yet).
## cgo for darwin (macos)
**Severity: Low**
**Task:** [rules/go #2894 Per-arch_target linker flags](https://github.com/bazelbuild/rules_go/issues/2894)
Background: until there is a better "global" way (i.e. the task is solved), all
`go_binary` targets destined for Darwin (macos) need an extra `gc_linkopts`
flag:
```
go_binary(
<...>
gc_linkopts = select({
"@platforms//os:macos": ["-s", "-w", "-buildmode=pie"],
"//conditions:default": [],
}),
)
```
A workaround with [gazelle](https://github.com/bazelbuild/bazel-gazelle) `map_kind` directive is possible. This will override rules_go `go_binary` rule with `go_binary` which contains default `gc_linkopts` parameters. Add this line to your BUILD files (usually adding to root BUILD file will suffice) and run `gazelle` to automatically generate `load` statements.
```
# gazelle:map_kind go_binary go_binary @bazel-zig-cc//rules:go_binary_override.bzl
```
## incorrect glibc version autodetection
**Severity: Low**
@ -143,6 +116,7 @@ use musl.
- [ziglang/zig #9050 golang linker segfault](https://github.com/ziglang/zig/issues/9050) (CLOSED, thanks kubkon)
- [ziglang/zig #7917 [meta] better c/c++ toolchain compatibility](https://github.com/ziglang/zig/issues/7917) (CLOSED, thanks andrewrk)
- [ziglang/zig #7915 ar-compatible command for zig cc](https://github.com/ziglang/zig/issues/7915) (CLOSED, thanks andrewrk)
- [rules/go #2894 Per-arch_target linker flags](https://github.com/bazelbuild/rules_go/issues/2894) (CLOSED, thanks mjonaitis)
# Testing