You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
gopackagesdriver is used to allow the language server (gopls) to resolve go libraries managed by bazel. The setup instructions is documented in https://github.com/bazelbuild/rules_go/wiki/Editor-setup, however following it results in the standard library packages unable to be resolved.
Running the below command gives more information
koonpeng@koonpeng:~/ws/googlecloudrobotics/core$ echo {} | bazel run -- @io_bazel_rules_go//go/tools/gopackagesdriver
std
...
ERROR: /usr/local/google/home/koonpeng/.cache/bazel/_bazel_koonpeng/ae7eebad1ef4062c3ff22e4722fa5b41/external/io_bazel_rules_go/BUILD.bazel:42:7: GoStdlibList external/io_bazel_rules_go/stdlib_/stdlib.pkg.json failed: (Exit 1): builder failed: error executing command (from target @io_bazel_rules_go//:stdlib) bazel-out/k8-opt-exec-2B5CBBC6/bin/external/go_sdk/builder_reset/builder stdliblist -sdk external/go_sdk -installsuffix linux_amd64 -sdk external/go_sdk -out ... (remaining 3 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
# runtime/cgo
_cgo_export.c:3:10: fatal error: 'stdlib.h' file not found
stdliblist: error running subcommand external/go_sdk/bin/go: exit status 1
{"NotHandled":false,"Compiler":"gc","Arch":"amd64","Packages":[]}
gopackagesdriver is trying to build something which fails with stdlib.h not found. Our custom toolchain might be causing the issue, according to bazel-contrib/rules_go#3886 (comment), the CGO flags should be converted to absolute paths but for some reason it is not happening.
Disabling --incompatible_enable_cc_toolchain_resolution and --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1 fixes the issue as it removes the --sysroot flag, so for now we can use this to workaround.
GOPACKAGESDRIVER_BAZEL_BUILD_FLAGS="--noincompatible_enable_cc_toolchain_resolution --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=0" exec bazel run -- @io_bazel_rules_go//go/tools/gopackagesdriver "${@}"
The text was updated successfully, but these errors were encountered:
gopackagesdriver
is used to allow the language server (gopls) to resolve go libraries managed by bazel. The setup instructions is documented in https://github.com/bazelbuild/rules_go/wiki/Editor-setup, however following it results in the standard library packages unable to be resolved.Running the below command gives more information
gopackagesdriver
is trying to build something which fails withstdlib.h not found
. Our custom toolchain might be causing the issue, according to bazel-contrib/rules_go#3886 (comment), the CGO flags should be converted to absolute paths but for some reason it is not happening.(notice that the sysroot is using relative path)
Disabling
--incompatible_enable_cc_toolchain_resolution
and--action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
fixes the issue as it removes the--sysroot
flag, so for now we can use this to workaround.The text was updated successfully, but these errors were encountered: