Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3rd-party source code can't be built as shared library on Linux #158

Open
harokyang opened this issue Jun 12, 2018 · 0 comments
Open

3rd-party source code can't be built as shared library on Linux #158

harokyang opened this issue Jun 12, 2018 · 0 comments

Comments

@harokyang
Copy link

I added some source code of 3rd-party libraries into the project
Everything is OK if they are built with static link
But if build as shared library and dynamic linked on Linux platform, I got a lot of "undefined reference" error

After some investigation I found "-fvisibility=hidden" in root CMakeLists.txt, which turn off global symbol exportation on shared library by default
In Baikal source code we have: attribute((visibility ("default"))), so any specified symbol can still be exported

That's why any 3rd-party source code without attribute((visibility ("default"))) can't be built as shared library

And in my case, the worst part is:
This library did not define any API_ENTRY macro
On Windows, CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS is set, so CMAKE will help to export all symbols
On Linux, the default behavior of gcc is expected to export all symbols

So I have to modify all function declaration to make it work
Or just remove -fvisibility=hidden, and add it back as individual compiler flag to Baikal targets, which is more reasonable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant