bazelbuild / continuous-integration

Bazel's Continuous Integration Setup
https://buildkite.com
Apache License 2.0
259 stars 137 forks source link

Builds seem to ignore `/workdir/.bazelrc` #1133

Open bcsgh opened 3 years ago

bcsgh commented 3 years ago

https://buildkite.com/bazel/bcsgh-stl-to-ps/builds/8#870d8fa1-5b3a-431a-b364-f0f5c1be10af << The case where this is causing problems. https://buildkite.com/bazel/bcsgh-tbd/builds/8#eea4ef7b-aa30-4b2d-a818-62f0c18924cd << Another build that shows the same issue but otherwise works.

Despite the CI logs reporting:

(22:45:59) INFO: Reading rc options for 'build' from /workdir/.bazelrc: 'build' options: --cxxopt=-std=c++17

later on the C++ version ends up being C++2011:

#define a(x) b(x)
#define b(x) #x
static_assert(__cplusplus > 201103L, a(__cplusplus));

results in:

./tbd/ast.h:3:1: error: static assertion failed: 201103L static_assert(cplusplus > 201103L, a(cplusplus)); ^

I've poked around and in my local build environment I can reproduce that failure message by updating the .bazelrc file to set -std=c++11, so I think Bazel it self is working.

My local environment, which works as expected:

$ bazel version Starting local Bazel server and connecting to it... Build label: 4.0.0 Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Thu Jan 21 07:33:24 2021 (1611214404) Build timestamp: 1611214404 Build timestamp as int: 1611214404

bcsgh commented 3 years ago

Interesting, this other build seems to correctly inject -std=c++17 into the gcc command line, where as the other one does not: https://buildkite.com/bazel/bcsgh-bazel-rules/builds/6#1df92ae5-8561-4c85-8357-fdcad2c2170b