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

link error, where should I put the flag of -fPIC #1

Open
druidfund opened this issue Jun 16, 2020 · 1 comment
Open

link error, where should I put the flag of -fPIC #1

druidfund opened this issue Jun 16, 2020 · 1 comment
Assignees

Comments

@druidfund
Copy link

druidfund commented Jun 16, 2020

/usr/bin/ld: ../IceUtil/libIceUtil.a(ConsoleUtil.cpp.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../IceUtil/libIceUtil.a(CtrlCHandler.cpp.o): relocation R_X86_64_32 against symbol `_ZTVN7IceUtil21CtrlCHandlerExceptionE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../IceUtil/libIceUtil.a(FileUtil.cpp.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../IceUtil/libIceUtil.a(MutexProtocol.cpp.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../IceUtil/libIceUtil.a(Options.cpp.o): relocation R_X86_64_32 against symbol `_ZTVN15IceUtilInternal12APIExceptionE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../IceUtil/libIceUtil.a(Random.cpp.o): relocation R_X86_64_32 against symbol `childAtFork' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../IceUtil/libIceUtil.a(RecMutex.cpp.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../IceUtil/libIceUtil.a(Shared.cpp.o): relocation R_X86_64_32 against symbol `_ZTVN7IceUtil12SimpleSharedE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../IceUtil/libIceUtil.a(StringConverter.cpp.o): relocation R_X86_64_32 against symbol `__pthread_key_create@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../IceUtil/libIceUtil.a(StringUtil.cpp.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../IceUtil/libIceUtil.a(ThreadException.cpp.o): relocation R_X86_64_32 against symbol `_ZTVN7IceUtil22ThreadSyscallExceptionE' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../IceUtil/libIceUtil.a(Time.cpp.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../IceUtil/libIceUtil.a(UtilException.cpp.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../IceUtil/libIceUtil.a(UUID.cpp.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
@druidfund druidfund changed the title link error when build as shared library, where should I put the flag of -fPIC link error, where should I put the flag of -fPIC Jun 16, 2020
@davidebeatrici
Copy link
Member

I apologize, we missed this.

Adding

set_property(TARGET IceUtil PROPERTY POSITION_INDEPENDENT_CODE ON)

in https://github.com/mumble-voip/ice/blob/3.7/cpp/src/IceUtil/CMakeLists.txt should work.

@ghost ghost assigned davidebeatrici Jun 11, 2022
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

2 participants