Boost logo

Boost Users :

From: Toni (tonitonae_at_[hidden])
Date: 2008-04-10 05:53:43


Hi to everyone in the list.

First of all, thanks in advance for your help and your time, that I'm pretty
sure is
very valuable.

I will try to describe the problem I'm getting while using boost graph's
library.

I've been developping an algorithm that makes use of the boost graph
library. During
the development, I coded everything in a cpp file and made some testing. In
this phase
all my code was compiled and linked within an executable file and everything
worked
fine.

Imagine that my code was the following one (this code actually does nothing
but
it is enough to explain the problems I'm experiencing):

void f1 (void) {

   Graph g (100);

   for (unsigned i = 1; i < 100; i++)
      boost::add_edge (i - 1, i, g);

   boost::graph_traits<Graph>::edge_iterator it, it_end;
   for (boost::tie (it, it_end) = boost::edges (g); (it != it_end); it++);

}

int main (void) {

   f1 ();
   return 0;

}

This example program compiled, linked and executed fine.

Once my code was ready, I decided to integrate this code into the library it
should go.
This library is a dynamic library that is loaded by another program with
dlopen, and some
symbols are read from it and used. So, imagine the following scenario
(again, very simplified,
but enough to explain the problem):

main.cc:

int main (void) {

   char* libpath = "mylib.so";
   void* handle;
   handle = dlopen (libpath, RTLD_NOW | RTLD_GLOBAL);

   // Some symbols are read with dlsym

   return 0;

}

mylib.cc:

extern "C" bool someFunction (int* data) {

   // do some things
   return true;

}

void f1 (void) {

   Graph g (100);

   for (unsigned i = 1; i < 100; i++)
      boost::add_edge (i - 1, i, g);

   boost::graph_traits<Graph>::edge_iterator it, it_end;
   for (boost::tie (it, it_end) = boost::edges (g); (it != it_end); it++);

}

Both the main program and the library compile fine, but when I try to
execute
the program I get undefined symbols errors:

/home/me/lib/mylib.so: undefined symbol:
_ZneIN5boost6detail20undirected_edge_iterISt14_List_iteratorINS0_9list_edgeIjNS0_11no_propertyEEEENS1_14edge_desc_implINS0_14undirected_tagEjEEiEEEiRKT_SE_

If I demangle the symbol I get:

c++filt
_ZneIN5boost6detail20undirected_edge_iterISt14_List_iteratorINS0_9list_edgeIjNS0_11no_propertyEEEENS1_14edge_desc_implINS0_14undirected_tagEjEEiEEEiRKT_SE_

int
operator!=<boost::detail::undirected_edge_iter<std::_List_iterator<boost::list_edge<unsigned
int, boost::no_property> >,
boost::detail::edge_desc_impl<boost::undirected_tag, unsigned int>, int>
>(boost::detail::undirected_edge_iter<std::_List_iterator<boost::list_edge<unsigned
int, boost::no_property> >,
boost::detail::edge_desc_impl<boost::undirected_tag, unsigned int>, int>
const&,
boost::detail::undirected_edge_iter<std::_List_iterator<boost::list_edge<unsigned
int, boost::no_property> >,
boost::detail::edge_desc_impl<boost::undirected_tag, unsigned int>, int>
const&)

The problem is, I think, that the operator!= is not compiled within the
dynamic library for some reason.

Any hints or ideas to solve the problem?

Thanks again for your time.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net