Rate This Document
Findability
Accuracy
Completeness
Readability

Failed to Compile Bazel 0.26.1

Symptom

When compiling Bazel 0.26.1, an error is reported stating "error: ambiguating new declaration of 'long int gettid()'":

Key Process and Cause Analysis

The gettid() function defined in the Bazel source code conflicts with the glibc library.

Conclusion and Solution

Change the function name gettid in the Bazel source code to gettid_sys, and then recompile Bazel.

Before:

Replace gettid.

1
grep -rl 'gettid' third_party/grpc/src/ | xargs sed -i 's/\bgettid/gettid_sys/g'

After: