It turned out the problem was caused by debug flags.
Calling configure with --enable-ndebug solved the problem.

On Tue, Feb 7, 2012 at 3:43 PM, Allan Vidal <all...@cpqd.com.br> wrote:

> Hi,
>
> I'm trying to run a component on NOX that uses MongoDB. I've created an
> empty application using nox-new-c-app.py and compiled it successfully.
> However, when I try to run it I get a segmentation fault.
>
> The problem seems to be in Mongo, but I don't know if the error is caused
> by a bug in Mongo itself, because I've managed to use it successfully in
> several projects when compiling directly. Could it be that there's an error
> in the linking process using Nox? How should I link it?
>
> src$ ./nox_core routeflowc
> NOX 0.9.0(zaku)~full~beta (nox_core), compiled Feb  7 2012 15:28:53
> Compiled with OpenFlow 0x01
> Caught signal 11.
>   0x00da92be   64 (vigil::fault_handler(int)+0x4e)
>   0x00110400 2922598944 (__kernel_sigreturn+0x0)
>   0x0693f24c  256 (mongo::DBClientConnection::connect(mongo::HostAndPort
> const&, std::string&)+0x2c)
>   0x00ae4bac  240 (vigil::routeflowc::install()+0x2ac)
>   0x0051f995   32 (vigil::DSO_component_context::install()+0x25)
>   0x0052889d   32
> (boost::detail::function::void_function_obj_invoker0<boost::_bi::bind_t<void,
> boost::_mfi::mf0<void, vigil::DSO_component_context>,
> boost::_bi::list1<boost::_bi::value<vigil::DSO_component_context*> > >,
> void>::invoke(boost::detail::function::function_buffer&)+0x1d)
>   0x005354c6   96
> (vigil::Component_context::install(vigil::Component_state)+0x66)
>   0x00535c9f 10880 (vigil::Kernel::resolve(vigil::Component_state,
> vigil::Component_state)+0x56f)
>   0x0053732a   48 (vigil::Kernel::resolve()+0x5a)
>   0x005374d3  192 (vigil::Kernel::change(vigil::Component_context*,
> vigil::Component_state)+0x183)
>   0x00538206 2096 (vigil::Kernel::install(std::string const&,
> vigil::Component_state)+0x9f6)
>   0x0805a158
>   0x0806044f   96
> (boost::detail::function::void_function_obj_invoker0<boost::_bi::bind_t<void,
> void (*)(vigil::Kernel*, std::__debug::list<std::pair<std::string,
> std::__debug::list<std::string, std::allocator<std::string> > >,
> std::allocator<std::pair<std::string, std::__debug::list<std::string,
> std::allocator<std::string> > > > > const&,
> std::__debug::vector<std::string, std::allocator<std::string> >, bool),
> boost::_bi::list4<boost::_bi::value<vigil::Kernel*>,
> boost::_bi::value<std::__debug::list<std::pair<std::string,
> std::__debug::list<std::string, std::allocator<std::string> > >,
> std::allocator<std::pair<std::string, std::__debug::list<std::string,
> std::allocator<std::string> > > > > >,
> boost::_bi::value<std::__debug::vector<std::string,
> std::allocator<std::string> > >, boost::_bi::value<bool> > >,
> void>::invoke(boost::detail::function::function_buffer&)+0x3f)
>   0x00e1af35
>   0x00132e99
> Segmentation fault
>
>
> The part of Makefile.am that I modified to suit Mongo is as follows:
> [...]
> routeflowc_la_CPPFLAGS = $(AM_CPPFLAGS) -I $(top_srcdir)/src/nox -I
> $(top_srcdir)/src/nox/netapps/ -I/usr/local/include/mongo
> routeflowc_la_SOURCES = routeflowc.hh routeflowc.cc
> routeflowc_la_LIBADD = -lmongoclient -lboost_thread -lboost_filesystem
> -lboost_program_options -lboost_system
> routeflowc_la_LDFLAGS = -module -export-dynamic
> [...]
> The include directory of Mongo was specified in CPPFLAGS, along with
> several libraries in LIBADD.
>
>
> And the only part I changed in the main module file was the install method:
> [...]
>   void routeflowc::install()
>   {
>     lg.dbg(" Install called ");
>     try {
>         mongo::DBClientConnection c;
>         c.connect("localhost");
>         cout << "Connection established" << endl;
>     } catch( mongo::DBException &e ) {
>         cout << "Exception: " << e.what() << endl;
>     }
>   }
> [...]
>
> The crash happens at the line:
>   c.connect("localhost");
>
_______________________________________________
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev

Reply via email to