Bug 2177728 - Cannot link boost-program-options static library to a shared library due to not being compiled with -fPIC option
Summary: Cannot link boost-program-options static library to a shared library due to n...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: boost
Version: 37
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jonathan Wakely
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-03-13 14:17 UTC by Hedayat Vatankhah
Modified: 2023-06-27 13:26 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Hedayat Vatankhah 2023-03-13 14:17:05 UTC
Description of problem:
Trying to link boost program options static library to a shared library, I get the following error:

/usr/bin/ld: /usr/lib64/libboost_program_options.a(value_semantic.o): warning: relocation against `_ZTIN5boost10wrapexceptINS_15program_options18invalid_bool_valueEEE' in read-only section `.text._ZNK5boost10wrapexceptINS_15program_options18invalid_bool_valueEE7rethrowEv[_ZNK5boost10wrapexceptINS_15program_options18invalid_bool_valueEE7rethrowEv]'
/usr/bin/ld: /usr/lib64/libboost_program_options.a(options_description.o): relocation R_X86_64_PC32 against symbol `_ZTVNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEEE@@GLIBCXX_3.4.21' can not be used when making a shared object; recompile with -fPIC


Version-Release number of selected component (if applicable):
boost-static-1.78.0-9.fc37.x86_64

How reproducible:
100%

Comment 1 Jonathan Wakely 2023-03-15 21:11:21 UTC
I don't think Boost's build system actually supports this:
https://github.com/boostorg/build/issues/366

It might need to be done by patching the build in Fedora to force it to always use -fPIC.

Comment 2 Jonathan Wakely 2023-03-15 21:14:18 UTC
Then again, maybe it just needs something like:

./b2 cxxflags=-fPIC cflags=-fPIC

https://lists.boost.org/boost-build/2016/08/28769.php


Note You need to log in before you can comment on or make changes to this bug.