protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Linking failure with Clang 17.0.3 on macOS

Open LucienXian opened this issue 2 years ago • 1 comments

Description

Encountering a linking failure when building Protobuf with Clang version 17.0.3 on macOS. TLV relocation error for symbol __ZN6google8protobuf8internal15ThreadSafeArena13thread_cache_E.

Environment

  • OS: macOS Sonoma 14.1
  • Compiler: Homebrew Clang version 17.0.3
  • Bazel version: bazel 6.4.0-homebrew

Error Message

ERROR:  /fab439a82c8e3d5a73fad6272d52597a/external/com_google_protobuf/src/google/protobuf/BUILD.bazel:365:11: 
Linking external/com_google_protobuf/src/google/protobuf/libprotobuf_lite.dylib failed: (Exit 1): 
cc_wrapper.sh failed: error executing command (from target @com_google_protobuf//src/google/protobuf:protobuf_lite) external/local_config_cc/cc_wrapper.sh @bazel-out/darwin-fastbuild/bin/external/com_google_protobuf/src/google/protobuf/libprotobuf_lite.dylib-2.params

ld64.lld: error: bazel-out/darwin-fastbuild/bin/external/com_google_protobuf/src/google/protobuf/_objs/protobuf_lite/extension_set.pic.o:(symbol google::protobuf::internal::ThreadSafeArena::thread_cache()+0x7): 
TLV relocation requires that symbol __ZN6google8protobuf8internal15ThreadSafeArena13thread_cache_E be thread-local

Bazel Message

cc_proto_library(
    name = "raft_cc_proto",
    deps = [":raft_proto"],
    visibility = ["//visibility:public"],
)

proto_library(
    name = "raft_proto",
    srcs = ["proto/raft.proto"],
)

cc_test(
    name = "mem_storage_test",
    size = "small",
    srcs = ["mem_storage_test.cc"],
    deps = [
        "@com_google_googletest//:gtest_main",
        "//src:raft_cc_proto",
    ],
    copts = ["-std=c++20", "-Isrc/"],
)
workspace(name = "raftlib")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "com_google_protobuf",
    sha256 = "616bb3536ac1fff3fb1a141450fa28b875e985712170ea7f1bfe5e5fc41e2cd8",
    strip_prefix = "protobuf-24.4",
    urls = ["https://github.com/protocolbuffers/protobuf/archive/v24.4.tar.gz"],
)

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

# rules_cc defines rules for generating C++ code from Protocol Buffers.
http_archive(
    name = "rules_cc",
    urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"],
    sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf",
    strip_prefix = "rules_cc-0.0.9",
)

# rules_proto defines abstract rules for building Protocol Buffers.
http_archive(
    name = "rules_proto",
    sha256 = "903af49528dc37ad2adbb744b317da520f133bc1cbbecbdd2a6c546c9ead080b",
    strip_prefix = "rules_proto-6.0.0-rc0",
    url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.0-rc0/rules_proto-6.0.0-rc0.tar.gz",
)

http_archive(
  name = "com_google_googletest",
  urls = ["https://github.com/google/googletest/archive/f8d7d77c06936315286eb55f8de22cd23c188571.zip"],
  strip_prefix = "googletest-f8d7d77c06936315286eb55f8de22cd23c188571",
)

load("@rules_cc//cc:repositories.bzl", "rules_cc_dependencies")
rules_cc_dependencies()

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
rules_proto_dependencies()
rules_proto_toolchains()

LucienXian avatar Nov 16 '23 19:11 LucienXian

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.

This issue is labeled inactive because the last activity was over 90 days ago.

github-actions[bot] avatar Feb 15 '24 10:02 github-actions[bot]

We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.

This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.

github-actions[bot] avatar Feb 29 '24 10:02 github-actions[bot]