Closed janreitz closed 1 year ago
Hi!
First of all thank you all for providing such a nice library, it is a joy to use!
Thank you for using this library! 😄
I just ran into a little trouble when creating a shared library on linux that linked against
libbit7z64.a
, which I created following the default build instruction in the readme. The errors looked similar to the ones described in this SO Question. TIL about position independent code.
Interesting! I never experienced this issue, probably because this library wasn't initially meant to be used inside a shared library.
Adding
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
to the top level CMakeLists.txt solved the issue for me.
Yeah, this fixes the issue indeed! However, as far as I understand, enabling PIC is not always desirable, so I don't think it should be enabled by default.
I just pushed a commit (https://github.com/rikyoz/bit7z/commit/a6248c0fe8fc938f1aa207703adcf720017b2644) that adds a BIT7Z_GENERATE_PIC
option (OFF
by default), which allows enabling the generation of Position Independent Code when building bit7z.
It seems like this would be relevant for a lot of other users, hence this issue. I wasn't sure if a pull request would be more suitable for this minor suggestion. Just let me know if you would prefer that.
No problem, it's just a minor change! I hope to have helped. Thank you for the feedback! 🙏
Feature description
First of all thank you all for providing such a nice library, it is a joy to use!
I just ran into a little trouble when creating a shared library on linux that linked against
libbit7z64.a
, which I created following the default build instruction in the readme. The errors looked similar to the ones described in this SO Question. TIL about position independent code.Adding
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
to the top level CMakeLists.txt solved the issue for me.It seems like this would be relevant for a lot of other users, hence this issue. I wasn't sure if a pull request would be more suitable for this minor suggestion. Just let me know if you would prefer that.
Additional context
Interestingly, I did not experience this issue on windows where I integated your library first without problems.
Code of Conduct