Bug 213851

Summary: libboost -fPIC compile error on x86_64
Product: Red Hat Enterprise Linux 4 Reporter: Paul Dwyer <pdwyer>
Component: boostAssignee: Benjamin Kosnik <bkoz>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 4.4CC: mnewsome, tao
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2007-0312 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-05-01 22:58:07 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
boost -fPIC patch none

Description Paul Dwyer 2006-11-03 14:09:33 UTC
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 10:41:50 UTC
Fixed.

Comment 27 Benjamin Kosnik 2006-11-22 09:37:07 UTC
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 22:58:07 UTC
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