Skip to content

bazel build failure: error: ambiguating new declaration of 'long int gettid()' #8666

@vbatts

Description

@vbatts

Description of the problem / feature request:

https://copr.fedorainfracloud.org/coprs/vbatts/bazel/ || https://github.com/vbatts/copr-build-bazel

This build issue has been happening since around v0.25.1, but since this is on fedora rawhide which is their rolling development head, this could be due to a latest gcc, glibc, etc

full build log bazel-fedora-rawhide.log
relevant log snippet:

+ cd bazel-0.27.0
+ /usr/bin/unzip -qq /builddir/build/SOURCES/bazel-0.27.0-dist.zip
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.zxDZux
+ umask 022
+ cd /builddir/build/BUILD
+ cd bazel-0.27.0
+ export CC=gcc
+ CC=gcc
+ export CXX=g++
+ CXX=g++
+ export 'EXTRA_BAZEL_ARGS= --host_javabase=@local_jdk//:jdk --verbose_failures'
+ EXTRA_BAZEL_ARGS=' --host_javabase=@local_jdk//:jdk --verbose_failures'
+ ./compile.sh
Building Bazel from scratch..find: 'src/tools/xcode-common/java/com/google/devtools/build/xcode/common': No such file or directory
find: 'src/tools/xcode-common/java/com/google/devtools/build/xcode/util': No such file or directory
....
Building Bazel with Bazel.
.WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/tmp/bazel_DXiOpeRe/archive/libblaze.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
    Fetching @io_bazel_skydoc; fetching
Loading: 0 packages loaded
Loading: 0 packages loaded
    Fetching @build_bazel_rules_nodejs; fetching
Loading: 0 packages loaded
Loading: 0 packages loaded
[...]
[314 / 323] 2 actions running
    Compiling third_party/grpc/src/cpp/server/server_context.cc; 1s local
    //third_party/grpc:grpc_client_channel; 0s local
[315 / 324] 2 actions, 1 running
    Compiling third_party/grpc/src/cpp/server/server_context.cc; 1s local
    [Scann] Compiling third_party/grpc/src/core/lib/gpr/log_linux.cc
ERROR: /builddir/build/BUILD/bazel-0.27.0/third_party/grpc/BUILD:386:1: C++ compilation of rule '//third_party/grpc:gpr_base' failed (Exit 1): gcc failed: error executing command
  (cd /tmp/bazel_DXiOpeRe/out/execroot/io_bazel && \
  exec env - \
    PATH=/builddir/.local/bin:/builddir/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin \
    PWD=/proc/self/cwd \
  /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out
/k8-opt/bin/third_party/grpc/_objs/gpr_base/log_linux.d '-frandom-seed=bazel-out/k8-opt/bin/third_party/grpc/_objs/gpr_base/log_linux.o' '-DGRPC_ARES=0' -iquote . -iquote bazel-out/k8-opt/bin -isystem third_party/grpc -isystem bazel-out/k
8-opt/bin/third_party/grpc -isystem third_party/grpc/include -isystem bazel-out/k8-opt/bin/third_party/grpc/include -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME_
_="redacted"' -c third_party/grpc/src/core/lib/gpr/log_linux.cc -o bazel-out/k8-opt/bin/third_party/grpc/_objs/gpr_base/log_linux.o)
Execution platform: //:default_host_platform
[316 / 324] Compiling .../grpc/src/cpp/server/server_context.cc; 1s local
third_party/grpc/src/core/lib/gpr/log_linux.cc:43:13: error: ambiguating new declaration of 'long int gettid()'
   43 | static long gettid(void) { return syscall(__NR_gettid); }
      |             ^~~~~~
In file included from /usr/include/unistd.h:1170,
                 from third_party/grpc/src/core/lib/gpr/log_linux.cc:41:
/usr/include/bits/unistd_ext.h:34:16: note: old declaration '__pid_t gettid()'
   34 | extern __pid_t gettid (void) __THROW;
      |                ^~~~~~
third_party/grpc/src/core/lib/gpr/log_linux.cc:43:13: warning: 'long int gettid()' defined but not used [-Wunused-function]
   43 | static long gettid(void) { return syscall(__NR_gettid); }
      |             ^~~~~~
[316 / 324] Compiling .../grpc/src/cpp/server/server_context.cc; 1s local
Target //src:bazel_nojdk failed to build
[317 / 324] checking cached actions
INFO: Elapsed time: 284.963s, Critical Path: 13.70s
[317 / 324] checking cached actions
INFO: 308 processes: 308 local.
[317 / 324] checking cached actions
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

build fedora rawhide rpm
docker run -it fedora:rawhide

What operating system are you running Bazel on?

fedora rawhide x86_64

What's the output of bazel info release?

n/a

If bazel info release returns "development version" or "(@Non-Git)", tell us how you built Bazel.

n/a

What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?

this is from v0.27.0 release zip archive

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-EngProdBazel CI, infrastructure, bootstrapping, release, and distribution toolingteam-OSSIssues for the Bazel OSS team: installation, release processBazel packaging, websiteuntriaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions