Skip to content

Build Error "variable does not have a constant initializer" in percpu #148

@botengyao

Description

@botengyao
ERROR: /home/runner/.cache/bazel/_bazel_runner/232997f8e2d32d79d849393f4fd56253/external/com_github_google_tcmalloc/tcmalloc/internal/BUILD:544:11: Compiling tcmalloc/internal/percpu.cc failed: (Exit 1): clang-11 failed: error executing command (from target @com_github_google_tcmalloc//tcmalloc/internal:percpu) /home/runner/work/envoy/envoy/bin/clang11/bin/clang-11 -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer '-stdlib=libc++' -MD -MF ... (remaining 33 arguments skipped)
external/com_github_google_tcmalloc/tcmalloc/internal/percpu.cc:57:5: error: variable does not have a constant initializer
    __rseq_abi = {
    ^            ~
external/com_github_google_tcmalloc/tcmalloc/internal/percpu.cc:56:1: note: required by 'require_constant_initialization' attribute here
ABSL_CONST_INIT thread_local ABSL_ATTRIBUTE_WEAK volatile kernel_rseq
^~~~~~~~~~~~~~~
external/com_google_absl/absl/base/attributes.h:714:27: note: expanded from macro 'ABSL_CONST_INIT'
#define ABSL_CONST_INIT [[clang::require_constant_initialization]]
Build command:
       sudo apt-get update --error-on=any
       sudo apt-get install --yes libtool cmake automake autoconf make ninja-build curl unzip virtualenv openjdk-11-jdk build-essential libc++1
       mkdir -p bin/clang11
       cd bin/clang11
       wget https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.1/clang+llvm-11.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz
       tar -xf clang+llvm-11.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz --strip-components 1
       export PATH=bin/clang11/bin:$PATH
bazelisk build -c fastbuild --spawn_strategy=local --discard_analysis_cache --nouse_action_cache --config clang --config libc++ $BUILD_TARGETS

Can someone help me understand if this is an error from tcmalloc? Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions