abseil / abseil/abseil-cpp

Have Bazel rules for creating shared libraries

未關閉
#1,746 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
C++
星號
18.1k
分支
3.2k
平均合併
20 小時 36 分鐘
30 天內合併 PR
1

描述

### Describe the issue

it is possible to build shared libraries with cmake with BUILD_SHARED_LIBS=ON

AFAIK, it is not possible to create them with Bazel.
According to https://ltekieli.com/linux-shared-libraries-with-cmake-and-bazel/
it requires additional cc_shared_library rules to setup up the needed dynamic deps.

The reason why it is important to have this feature setup, it is to allow to build other projects linking with abseil that are exclusively using bazel.

For example, https://github.com/google/tcmalloc is such project.

It currently statically links with abseil. This makes it impossible to build tcmalloc as a shared library and use the resulting so lib file in a project also linking with cmake generated Abseil libraries without breaking the ODR rule.

Being able to build Abseil shared libraries within Bazel is a prerequisite to be able to build tcmalloc shared libraries that can be used with projects already dynamically linking with Abseil.

### Steps to reproduce the problem

there is no cc_shared_library rules in abseil BUILD files or if it is possible to create shared libraries, it is not well documented.

I could not find anything on the topic.

### What version of Abseil are you using?

20240722 LTS

### What operating system and version are you using?

ArchLinux kernel 6.10.4

### What compiler and version are you using?

gcc version 14.2.1 20240805 (GCC)

### What build system are you using?

bazel 7.2.1

### Additional context

_No response_

貢獻指南

開啟貢獻指南

研究方向

Look at the existing BUILD files to understand the current cc_library rules. Research how cc_shared_library works in Bazel and examine the linked blog post for guidance. The goal is to add rules that produce shared libraries compatible with projects like tcmalloc, ensuring they don't break ODR when used with CMake-built Abseil.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
cpp
領域
build-system
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
30/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。