macos - 解决方法 --exclude-libs 在 OS X 的 clang 上不可用
问题描述
我需要创建一个需要使用不同版本的 OpenSSL (BoringSSL) 的包装器库,原因在 [1] 的“包装器共享对象”中提供。
问题是--exclude-libs 在 OS X 的 clang 中不可用,因此我必须避免导出符号。
我有什么选项可以解决这个问题,例如在构建库后剥离符号?
解决方案
macOSld
链接器允许您通过-hidden-l
而不是-l
. man ld
这是Mac上的报价:
-hidden-lx This is the same as the -lx for locating a static library,
but treats all global symbols from the static library as if
they are visibility hidden. Useful when building a dynamic
library that uses a static library but does not want to
export anything from that static library.
所以,不要-lssl
在你的链接器标志中使用。使用-hidden-lssl
.
推荐阅读
- javascript - 你会如何在 Angular 6 中设计这个组件?
- opencv - 在 ARM Docker 容器中构建 OPENCV 时出现问题
- jquery - 基于国家代码的jquery简单重定向代码
- css - 加载 CSS 后渲染 SVG (React styled-components)
- python - 在 python 中打印图像中对象的边界大小时出现错误
- java - 当出现异常时,回滚完成的操作,但将异常存储在表中
- ios - PageViewController 不工作
- python - Tkinter - 如何在按下按钮时制作弹出框
- javascript - 基于JS中数组中的字符数组拆分字符串
- javascript - 从提及中获取用户 ID