awslabs / awslabs/aws-lambda-cpp
Undefined symbol errors when consuming the library as shared/dynamic
- 主要語言
- C++
- 星號
- 465
- 分支
- 98
- 平均合併
- 12 小時 47 分鐘
- 30 天內合併 PR
- 3
描述
The `"-fvisibility=hidden"` (see [CMakeLists.txt#L77](https://github.com/awslabs/aws-lambda-cpp/blob/master/CMakeLists.txt#L77)) in `CMakeLists.txt` causes undefined symbols errors when using this library as shared object.
It's not a problem when using it as a static library because visibility settings doesn't affect that by design.
There are multiple solutions for this problem:
1. Just remove `"-fvisibility=hidden"`. We are currently using this approach as a workaround because we currently don't have many symbols to be considered private, this may be a viable option.
2. Keep `"-fvisibility=hidden"` and manually annotate symbols intended to be public with: `__attribute__((visibility("default")))`, however, this will require a significant amount of effort.
3. Replace `"-fvisibility=hidden"` with `"-fvisibility=default"` and manually annotate symbols intended to be private with `__attribute__((visibility("hidden")))`
貢獻指南
研究方向
從 CMakeLists.txt#L77 中的可見性設定開始,並在以 shared object 形式使用函式庫時重現 undefined-symbol 錯誤。比較列出的可見性方案,並確認所選變更在保留靜態函式庫使用方式的同時,公開 shared-library consumers 所需的符號。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- cmake, cpp
- 領域
- build-system
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 35/100