问题描述
我有一个可执行项目,它使用一个共享库,包括一个静态库。然后从可执行文件,我尝试加载另一个共享库与 dlopen
。找到该库,但无法从静态库中找到符号。
I have an executable project which uses a shared library, that includes a static library. Then from the executable, I try to load another shared library with dlopen
. That library is found but it cannot find symbols from static library.
这里是结构:
-- SHARED LIB 1
-- (compiled with) Static Lib 1
-- EXECUTABLE
-- SHARED LIB 1
-- dlopen SHARED LIB 2 XX ERROR: SHARED LIB 2 cannot find symbols of Static Lib 1
两者 SHARED LIB 1
和 SHARED LIB 2
是从 / usr / lib
似乎我错过了一些标志。
It seems that I miss some flags.
我如何解决这个问题? >
How could I solve this issue?
推荐答案
什么标志用于构建共享的LIB 1?
AFAIK -fvisibility不会影响静态库。
what flags are used to build the "SHARED LIB 1"?AFAIK -fvisibility won't affect static libs.
但是如果你使用 - exclude-libs
希望此问题可能有帮助:
Hope this Question may help: How to apply gcc -fvisibility option to symbols in static libraries?
这篇关于linux dlopen找不到静态库的符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!