1
Fork 0

--extra_toolchains also needs to know the platform

This commit is contained in:
Motiejus Jakštys 2021-06-20 15:00:17 +03:00 committed by Motiejus Jakštys
parent f65969f038
commit 0944357d54
2 changed files with 5 additions and 1 deletions

View File

@ -22,6 +22,7 @@ tasks:
grep -q "ELF 64-bit.* x86-64.* dynamically linked"
- test_x86_64-linux-musl: |
cd bazel-zig-cc; ./build-and-file \
--platforms @io_bazel_rules_go//go/toolchain:linux_amd64_cgo \
--extra_toolchains @zig_sdk//:x86_64-linux-musl_toolchain //test:hello | \
grep -q "ELF 64-bit.* x86-64.* statically linked"
- test_aarch64-linux-gnu: |
@ -30,6 +31,7 @@ tasks:
grep -q "ELF 64-bit.* ARM aarch64.* dynamically linked"
- test_aarch64-linux-musl: |
cd bazel-zig-cc; ./build-and-file \
--platforms @io_bazel_rules_go//go/toolchain:linux_arm64_cgo \
--extra_toolchains @zig_sdk//:aarch64-linux-musl_toolchain //test:hello | \
grep -q "ELF 64-bit.* ARM aarch64.* statically linked"
- test_x86_64-macos-gnu: |

View File

@ -31,7 +31,9 @@ bazel-bin/test/gognu_/gognu: ELF 64-bit LSB executable, x86-64, version 1 (SYSV)
## linux cgo + musl
```
$ bazel build --extra_toolchains @zig_sdk//:x86_64-linux-musl_toolchain //test:hello
$ bazel build \
--platforms @io_bazel_rules_go//go/toolchain:linux_amd64_cgo \
--extra_toolchains @zig_sdk//:x86_64-linux-musl_toolchain //test:hello
...
$ file ../bazel-out/k8-fastbuild-ST-d17813c235ce/bin/test/hello_/hello
../bazel-out/k8-fastbuild-ST-d17813c235ce/bin/test/hello_/hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, Go BuildID=redacted, with debug_info, not stripped