opened
coryan
username_0
When compiling shared libraries the object libraries also need to compile with `-fPIC`.
Support shared libraries.
issue
created
coryan
username_0
Ping.  Is there any feedback on this PR?
comment
created
pwnall
username_1
@username_0 Do you happen to have a pointer to the docs that explain why this needs to be done? I expected that CMake would set all the necessary flags to reasonable values when enabling shared libraries. Am I using the wrong master switch?
comment
created
coryan
username_0
The [CMake documentation](https://cmake.org/cmake/help/latest/prop_tgt/POSITION_INDEPENDENT_CODE.html) says the property is set to `False` for `OBJECT` libraries. And this property controls whether `-fPIC` is set or not.

This is a good discussion on the general problem:

https://stackoverflow.com/questions/50600708/combining-cmake-object-libraries-with-shared-libraries

You may want to turn on shared libraries for at least one build, I would be happy to do that in a future PR too.
comment
created
pwnall
username_1
Thanks for looking into it!

For this PR -- can you please add comments above the set_property blocks explaining why they need to be there?
`# CMake only enables PIC by default in SHARED and MODULE targets.` should suffice.

For CI changes -- based on experience maintaining LevelDB and Snappy, I am really not looking forward to supporting a shared library build for this project. I'd like this project's guarantees to be similar to https://abseil.io/about/compatibility which I think reflects a lot of collective wisdom. Adding shared libraries to CI would imply support. Can you please follow up internally and explain the need, so I can know why I'd be taking on this burden?
comment