编译Bazel过程中提示error: ambiguating new declaration of 'long int gettid()
问题现象描述
编译Bazel 0.26.0过程中,提示“error: ambiguating new declaration of 'long int gettid()”,详细信息如下图所示。
关键过程、根本原因分析
上述报错信息是因为Bazel源码定义的gettid()函数与glibc库冲突。需要将Bazel源码中的函数名gettid改为gettid_sys,再重新编译Bazel。
结论、解决方案及效果
- 查询替换前Bazel源码中的函数名。
grep -nr gettid
- 替换函数名gettid为gettid_sys。
grep -rl 'gettid' third_party/grpc/src/ | xargs sed -i 's/\bgettid/gettid_sys/g'
- 查询替换后Bazel源码中的函数名。
grep -nwr gettid_sys
- 重新执行编译Bazel命令。
父主题: 故障排除