鲲鹏社区首页
中文
注册
我要评分
文档获取效率
文档正确性
内容完整性
文档易理解
在线提单
论坛求助

编译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。

结论、解决方案及效果

  1. 查询替换前Bazel源码中的函数名。
    grep -nr gettid

  2. 替换函数名gettid为gettid_sys。
    grep -rl 'gettid' third_party/grpc/src/ | xargs sed -i 's/\bgettid/gettid_sys/g'
  3. 查询替换后Bazel源码中的函数名。
    grep -nwr gettid_sys

  4. 重新执行编译Bazel命令。