Bug 2177728

Summary: Cannot link boost-program-options static library to a shared library due to not being compiled with -fPIC option
Product: [Fedora] Fedora Reporter: Hedayat Vatankhah <hedayatv>
Component: boostAssignee: Jonathan Wakely <jwakely>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: codonell, denis.arnaud_fedora, jwakely, laurent.rineau__fedora, mcermak, trodgers
Target Milestone: ---Keywords: FutureFeature, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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

Comment 4 Aoife Moloney 2023-11-23 01:26:39 UTC
This message is a reminder that Fedora Linux 37 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 37 on 2023-12-05.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '37'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 37 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 5 Jonathan Wakely 2023-11-23 08:06:52 UTC
This change is still needed in rawhide.