Bug 213851 - libboost -fPIC compile error on x86_64
libboost -fPIC compile error on x86_64
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: boost (Show other bugs)
4.4
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Benjamin Kosnik
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-11-03 09:09 EST by Paul Dwyer
Modified: 2013-08-09 01:48 EDT (History)
2 users (show)

See Also:
Fixed In Version: RHBA-2007-0312
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-05-01 18:58:07 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
boost -fPIC patch (539 bytes, patch)
2006-11-07 10:09 EST, Paul Dwyer
no flags Details | Diff

  None (edit)
Description Paul Dwyer 2006-11-03 09:09:33 EST
Description of problem:
When compiling the code below, linking against boost libraries, it throws the
following link error
usr/bin/ld:
/usr/lib/gcc/x86_64-redhat-linux/3.4.3/../../../../lib64/libboost_serialization.a(basic_iarchive.o):
relocation R_X86_64_32S against `vtable for
boost::archive::detail::basic_iarchive' can not be used when making a shared
object; recompile with -fPIC
/usr/lib/gcc/x86_64-redhat-linux/3.4.3/../../../../lib64/libboost_serialization.a:
could not read symbols: Bad value
collect2: ld returned 1 exit status

Version-Release number of selected component (if applicable):
x86_64 version of boost

How reproducible:
evey compile

Steps to Reproduce:
> cat S.cpp
#include  <iostream>
#include  <vector>

#include <boost/archive/tmpdir.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/binary_iarchive.hpp>

using namespace std;
using namespace boost::archive;
using namespace boost::serialization;

using std::setw;
using std::left;

class DebugInfo_t
{
public:
template<class Archive> void serialize(Archive & ar,
                                       const unsigned int=0 /*
file_version */);
};

class DebugInfo_m
{
public:
template<class Archive> void serialize(Archive & ar,
                                       const unsigned int=0 /*
file_version */) const;
bool serialize(std::ostream & out) const;
bool deserialize(std::istream & is);  
}; // DebugInfo_m

bool DebugInfo_m::deserialize(istream & is)
{
boost::archive::binary_iarchive ar(is);
serialize (ar);
return true;
} 

Compile using
/usr/bin/g++ -shared -fPIC S.cpp -lboost_serialization -o S.so

Actual results:
usr/bin/ld:
/usr/lib/gcc/x86_64-redhat-linux/3.4.3/../../../../lib64/libboost_serialization.a(basic_iarchive.o):
relocation R_X86_64_32S against `vtable for
boost::archive::detail::basic_iarchive' can not be used when making a shared
object; recompile with -fPIC
/usr/lib/gcc/x86_64-redhat-linux/3.4.3/../../../../lib64/libboost_serialization.a:
could not read symbols: Bad value
collect2: ld returned 1 exit status

Expected results:
Clean compile

Additional info:
This compiles under RHEL5 Beta1
Comment 25 Benjamin Kosnik 2006-11-13 05:41:50 EST
Fixed.
Comment 27 Benjamin Kosnik 2006-11-22 04:37:07 EST
Suzanne. 

Consider this devel_ack.

This has been fixed in CVS (See comment #13) and has been rebuilt (See Comment #23).

-benjamin
Comment 35 Red Hat Bugzilla 2007-05-01 18:58:07 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2007-0312.html

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