[Xorp-hackers] undefined reference problem

Selçuk Cevher cevhers at gmail.com
Mon Jun 30 08:12:36 PDT 2008


I resolved most of the udefined reference errors exceot the one below:

../libxipc/.libs/libxipc.a(xrl_pf_kill.o)(.text+0x254): In function
`XrlPFKillSender::send(Xrl const&, bool, ref_ptr<XorpCallback2<void,
XrlError const&, XrlArgs*> > const&)':
/home/scevher/xorp/libxipc/xrl_pf_kill.cc:101: undefined reference to
`__cxa_get_exception_ptr'
../libxipc/.libs/libxipc.a(xrl_pf_sudp.o)(.text._ZNSs12_S_constructIN9__gnu_cxx17__normal_iteratorIPKcSsEEEEPcT_S6_RKSaIcESt20forward_iterator_tag[char*
std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::_S_construct<__gnu_cxx::__normal_iterator<char const*,
std::basic_string<char, std::char_traits<char>, std::allocator<char> > >
>(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >,
__gnu_cxx::__normal_iterator<char const*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >, std::allocator<char>
const&, std::forward_iterator_tag)]+0x13a): In function `char*
std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::_S_construct<__gnu_cxx::__normal_iterator<char const*,
std::basic_string<char, std::char_traits<char>, std::allocator<char> > >
>(__gnu_cxx::__normal_iterator<char const*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >,
__gnu_cxx::__normal_iterator<char const*, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > >, std::allocator<char>
const&, std::forward_iterator_tag)':
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../../include/c++/4.1.2/bits/basic_string.tcc:158:
undefined reference to `std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::_Rep::_M_set_length_and_sharable(unsigned int)'
../libxipc/.libs/libxipc.a(finder_tcp.o)(.text+0x1645): In function
`FinderTcpBase::read_callback(AsyncFileOperator::Event, unsigned char
const*, unsigned int, unsigned int)':
/home/scevher/xorp/libxipc/finder_tcp.cc:161: undefined reference to
`__cxa_get_exception_ptr'
collect2: ld returned 1 exit status

Here is the order in which I include the libraries in Makefile.am file:

LDADD           += $(top_builddir)/policy/backend/libpolicybackend.la
LDADD           += $(top_builddir)/xrl/interfaces/
libfindereventnotifierxif.la
LDADD           += $(top_builddir)/xrl/interfaces/libfeaifmgrmirrorxif.la
LDADD           += $(top_builddir)/xrl/interfaces/
libfeaifmgrreplicatorxif.la
LDADD           += $(top_builddir)/xrl/interfaces/libospfv2xif.la
LDADD           += $(top_builddir)/xrl/targets/libfeaifmgrmirrorbase.la
LDADD           += $(top_builddir)/libxipc/libxipc.la
LDADD           += $(top_builddir)/libcomm/libcomm.la
LDADD           += $(top_builddir)/libxorp/libxorp.la
LDADD           += $(top_builddir)/ospf/libospf.la
LDADD          += $(top_builddir)/libfeaclient/libfeaclient.la
LDADD           += $(top_builddir)/xrl/interfaces/libribxif.la
LDADD           += $(top_builddir)/xrl/targets/libospfv2base.la
LDADD           += $(top_builddir)/xrl/targets/libospfv3base.la
LDADD           += $(top_builddir)/xrl/interfaces/libprofileclientxif.la
LDADD           += $(top_builddir)/xrl/interfaces/libfearawpkt4xif.la
LDADD           += $(top_builddir)/xrl/interfaces/libfearawpkt6xif.la
LDADD           += $(top_builddir)/xrl/targets/libfeaifmgrmirrorbase.la
LDADD           += $(top_builddir)/libproto/libproto.la


and here are the source files included in my own Makefile.am file:

# -- Program Sources
xorp_pname_SOURCES = xorp_pname.cc
# -- Library Sources
libpname_la_SOURCES        = pname_module.h
libpname_la_SOURCES       += pname_node.hh
libpname_la_SOURCES       += xrl_pname_node.hh
libpname_la_SOURCES  += $(top_builddir)/ospf/policy_varrw.hh
libpname_la_SOURCES  += $(top_builddir)/ospf/xrl_io.hh
libpname_la_SOURCES  += $(top_builddir)/ospf/external.hh
libpname_la_SOURCES  += $(top_builddir)/ospf/routing_table.hh
libpname_la_SOURCES  += $(top_builddir)/ospf/policy_varrw.cc
libpname_la_SOURCES  += $(top_builddir)/ospf/xrl_io.cc
libpname_la_SOURCES  += $(top_builddir)/ospf/external.cc
libpname_la_SOURCES  += $(top_builddir)/ospf/routing_table.cc
libpname_la_SOURCES       += pname_node.cc
libpname_la_SOURCES       += xrl_pname_node.cc

Thanks,
Selcuk
On Mon, Jun 30, 2008 at 10:49 AM, Bruce M. Simpson <bms at icir.org> wrote:

>  Selçuk Cevher wrote:
>
>> I am trying to resolve an undefined reference problem which I had after
>> integrating some certain functions from area_router.cc with a newly created
>> xorp process.
>>  To make it work, I also included all the libraries contained in
>> Makefile.am file of ospf process in my own Makefile.am file.
>>  Even though it successfully compiles after the adaptation of functions
>> from area_router.cc, it gives "undefined reference" errors while linking
>> some certain functions such as SingleVarRW::initialize(int const&,
>> Element*), SingleVarRW::~SingleVarRW(), PolicyTags::PolicyTags(Element
>> const&), IfMgrIfTree::find_interface(std::basic_string<char,
>> std::char_traits<char>, std::allocator<char> > const&) const,
>> IfMgrXrlMirror::~IfMgrXrlMirror(), etc. along with some others.
>>  Why doesn't it work even though I exactly use the same libraries as ospf
>> does ?
>>
>
> You need to post your linker error output so someone can help you in more
> detail.
>
> The link order is important, and you need to be sure you're using the same
> automake primaries for a C++ program target to link.
>
> thanks
> BMS
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/xorp-hackers/attachments/20080630/0502bbb6/attachment.html 


More information about the Xorp-hackers mailing list