Undefined symbol errors when consuming the library as shared/dynamic

未关闭
#205 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
cmake, cpp
领域
build-system

调研方向

从 CMakeLists.txt#L77 中的可见性设置开始,并在以 shared object 形式使用库时重现 undefined-symbol 错误。比较列出的可见性方案,并确认所选更改在保留静态库使用方式的同时,公开 shared-library consumers 所需的符号。

由索引模型根据 Issue 内容生成。

描述

The "-fvisibility=hidden" (see 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")))
主要语言
C++
星标
465
派生
98
平均合并
1 小时 16 分钟
30 天内合并 PR
2

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

awslabs/aws-lambda-cpp 的其他 Issue

查看 awslabs/aws-lambda-cpp 的全部 Issue

相似的 Issue

更多 C++ Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。