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

Compilation error when linking against 11Zip with CMake #29

Open
davidelahoz opened this issue Apr 18, 2024 · 0 comments
Open

Compilation error when linking against 11Zip with CMake #29

davidelahoz opened this issue Apr 18, 2024 · 0 comments

Comments

@davidelahoz
Copy link

When adding 11Zip to a scikit-build-core CMake project using add_subdirectory, the following error is thrown:

/usr/bin/ld: extlibs/11Zip/libelzip.a(elzip.cpp.o): warning: relocation against `_ZTVSt9basic_iosIcSt11char_traitsIcEE@@GLIBCXX_3.4' in read-only section `.text.unlikely'
/usr/bin/ld: extlibs/11Zip/libelzip.a(elzip.cpp.o): relocation R_X86_64_PC32 against symbol `_ZNSs4_Rep20_S_empty_rep_storageE@@GLIBCXX_3.4' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status

In order to fix it, the following command needs to be added to 11Zip CMakeLists.txt:
target_compile_options(elzip PRIVATE -fPIC)

Probably, the reason for this error is that scikit-build-core generates a dynamic library, which is then called by python

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