The implementation of bpsf_0_1_set_nexthop4() is missing the class name: XrlCmdError bpsf_0_1_set_nexthop4( ...
It should be: XrlCmdError XrlBpsfNode::bpsf_0_1_set_nexthop4( ... The same issues seems to apply for the other methods as well. A hint: if the return type is on separate line, then it will be easier to spot such omissions: XrlCmdError XrlBpsfNode::bpsf_0_1_set_nexthop4( ... Pavlin Victor Faion <[email protected]> wrote: > Hello, > > I was trying to create a simple XORP process by following the > xorpdev_101 document but I ran into this error when running make, > something about a ``non-virtual thunk''. > > /bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. > -I.. -I.. -g -Werror -W -Wall -Wwrite-strings -Wcast-qual > -Wpointer-arith -Wcast-align -Woverloaded-virtual -ftemplate-depth-25 > -pipe -MT xrl_bpsf_node.lo -MD -MP -MF .deps/xrl_bpsf_node.Tpo -c -o > xrl_bpsf_node.lo xrl_bpsf_node.cc > g++ -DHAVE_CONFIG_H -I. -I.. -I.. -g -Werror -W -Wall -Wwrite-strings > -Wcast-qual -Wpointer-arith -Wcast-align -Woverloaded-virtual > -ftemplate-depth-25 -pipe -MT xrl_bpsf_node.lo -MD -MP -MF > .deps/xrl_bpsf_node.Tpo -c xrl_bpsf_node.cc -o xrl_bpsf_node.o > mv -f .deps/xrl_bpsf_node.Tpo .deps/xrl_bpsf_node.Plo > /bin/sh ../libtool --tag=CXX --mode=link g++ -g -Werror -W -Wall > -Wwrite-strings -Wcast-qual -Wpointer-arith -Wcast-align > -Woverloaded-virtual -ftemplate-depth-25 -pipe -o libbpsf.la > xrl_bpsf_node.lo -lpcap -lcrypto -lrt > rm -fr .libs/libbpsf.a .libs/libbpsf.la > ar cru .libs/libbpsf.a xrl_bpsf_node.o > ranlib .libs/libbpsf.a > creating libbpsf.la > (cd .libs && rm -f libbpsf.la && ln -s ../libbpsf.la libbpsf.la) > g++ -DHAVE_CONFIG_H -I. -I.. -I.. -g -Werror -W -Wall > -Wwrite-strings -Wcast-qual -Wpointer-arith -Wcast-align > -Woverloaded-virtual -ftemplate-depth-25 -pipe -MT xorp_bpsf.o -MD -MP > -MF .deps/xorp_bpsf.Tpo -c -o xorp_bpsf.o xorp_bpsf.cc > mv -f .deps/xorp_bpsf.Tpo .deps/xorp_bpsf.Po > /bin/sh ../libtool --tag=CXX --mode=link g++ -g -Werror -W -Wall > -Wwrite-strings -Wcast-qual -Wpointer-arith -Wcast-align > -Woverloaded-virtual -ftemplate-depth-25 -pipe -o xorp_bpsf > xorp_bpsf.o libbpsf.la ../xrl/targets/libbpsfbase.la > ../libxipc/libxipc.la ../libcomm/libcomm.la ../libxorp/libxorp.la > -lpcap -lcrypto -lrt > g++ -g -Werror -W -Wall -Wwrite-strings -Wcast-qual -Wpointer-arith > -Wcast-align -Woverloaded-virtual -ftemplate-depth-25 -pipe -o > xorp_bpsf xorp_bpsf.o ./.libs/libbpsf.a > ../xrl/targets/.libs/libbpsfbase.a ../libxipc/.libs/libxipc.a > ../libcomm/.libs/libcomm.a ../libxorp/.libs/libxorp.a -lpcap -lcrypto > -lrt > ./.libs/libbpsf.a(xrl_bpsf_node.o):(.rodata._ZTV11XrlBpsfNode[vtable > for XrlBpsfNode]+0xa8): undefined reference to > `XrlBpsfNode::bpsf_0_1_set_nexthop4(std::basic_string<char, > std::char_traits<char>, std::allocator<char> > const&, unsigned int > const&, std::basic_string<char, std::char_traits<char>, > std::allocator<char> > const&, unsigned int const&, IPv4 const&)' > ./.libs/libbpsf.a(xrl_bpsf_node.o):(.rodata._ZTV11XrlBpsfNode[vtable > for XrlBpsfNode]+0xb0): undefined reference to > `XrlBpsfNode::bpsf_0_1_print_hello_world_and_msg(std::basic_string<char, > std::char_traits<char>, std::allocator<char> > const&, > std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)' > ./.libs/libbpsf.a(xrl_bpsf_node.o):(.rodata._ZTV11XrlBpsfNode[vtable > for XrlBpsfNode]+0x180): undefined reference to `non-virtual thunk to > XrlBpsfNode::bpsf_0_1_set_nexthop4(std::basic_string<char, > std::char_traits<char>, std::allocator<char> > const&, unsigned int > const&, std::basic_string<char, std::char_traits<char>, > std::allocator<char> > const&, unsigned int const&, IPv4 const&)' > ./.libs/libbpsf.a(xrl_bpsf_node.o):(.rodata._ZTV11XrlBpsfNode[vtable > for XrlBpsfNode]+0x188): undefined reference to `non-virtual thunk to > XrlBpsfNode::bpsf_0_1_print_hello_world_and_msg(std::basic_string<char, > std::char_traits<char>, std::allocator<char> > const&, > std::basic_string<char, std::char_traits<char>, std::allocator<char> > >&)' > collect2: ld returned 1 exit status > make: *** [xorp_bpsf] Error 1 > > > I'm not sure what is causing this. Here are the xrl_bpsf_node.{hh,cc} files: > > #ifndef __BPSF_XRL_BPSF_NODE_HH__ > #define __BPSF_XRL_BPSF_NODE_HH__ > > #include "libxipc/xrl_std_router.hh" > #include "xrl/targets/bpsf_base.hh" > > class XrlBpsfNode : public XrlStdRouter, > public XrlBpsfTargetBase { > public: > XrlBpsfNode(EventLoop& eventloop, > const string& class_name, > const string& finder_hostname, > uint16_t finder_port); > ~XrlBpsfNode(); > /** > * Get a reference to the XrlRouter instance. > * > * @return a reference to the XrlRouter (@ref XrlRouter) instance. > */ > XrlRouter& xrl_router() { return *this; } > /** > * Startup the node operation. > * > * @return XORP_OK on success, otherwise XORP_ERROR. > */ > int startup(); > > int shutdown(); > > /** > * Test if the node processing is done. > * > * @return true if the node processing is done, otherwise false. > */ > bool is_done() const { return true; } > > > protected: > // > // XRL target methods > // > > /** > * Get name of Xrl Target > */ > XrlCmdError common_0_1_get_target_name( > // Output values, > string& name); > > /** > * Get version string from Xrl Target > */ > XrlCmdError common_0_1_get_version( > // Output values, > string& version); > > /** > * Get status of Xrl Target > */ > XrlCmdError common_0_1_get_status( > // Output values, > uint32_t& status, > string& reason); > > /** > * Request clean shutdown of Xrl Target > */ > XrlCmdError common_0_1_shutdown(); > > /** > * Enable/disable/start/stop Bpsf. > * > * @param enable if true, then enable Bpsf, otherwise disable it. > */ > XrlCmdError bpsf_0_1_enable_bpsf( > // Input values, > const bool& enable); > > XrlCmdError bpsf_0_1_start_bpsf(); > > XrlCmdError bpsf_0_1_stop_bpsf(); > > /** > * Set the peer's AS number. > * > * @param next_hop IPv4 nexthop. > */ > XrlCmdError bpsf_0_1_set_nexthop4( > // Input values, > const string& local_ip, > const uint32_t& local_port, > const string& peer_ip, > const uint32_t& peer_port, > const IPv4& next_hop); > > XrlCmdError bpsf_0_1_print_hello_world_and_msg( > // Input values, > const string& msg, > // Output values, > string& num); > > /** > * Enable/disable the Bpsf trace log for all operations. > * > * @param enable if true, then enable the trace log, otherwise disable > it. > */ > XrlCmdError bpsf_0_1_enable_log_trace_all( > // Input values, > const bool& enable); > > }; > > #endif // __BPSF_XRL_BPSF_NODE_HH__ > > > ----------------- > > > > #include "bpsf_module.h" > > #include "libxorp/xorp.h" > //#include "libxorp/xlog.h" > //#include "libxorp/debug.h" > //#include "libxorp/ipvx.hh" > #include "libxorp/status_codes.h" > > #include "xrl_bpsf_node.hh" > > XrlBpsfNode::XrlBpsfNode(EventLoop& eventloop, > const string& class_name, > const string& finder_hostname, > uint16_t finder_port) > : XrlStdRouter(eventloop, class_name.c_str(), finder_hostname.c_str(), > finder_port), > XrlBpsfTargetBase(&xrl_router()) > { > printf("%s\n", "creating XrlBpsfNode"); > } > > XrlBpsfNode::~XrlBpsfNode() { > printf("%s\n", "deleting XrlBpsfNode"); > } > > int XrlBpsfNode::shutdown() { > printf("%s\n", "shutting down XrlBpsfNode"); > return (XORP_OK); > } > > int XrlBpsfNode::startup() { > printf("%s\n", "starting up XrlBpsfNode"); > return (XORP_OK); > } > > // > // XRL target methods > // > > /** > * Get name of Xrl Target > */ > XrlCmdError XrlBpsfNode::common_0_1_get_target_name( > // Output values, > string& name) > { > name = xrl_router().class_name(); > > return XrlCmdError::OKAY(); > } > > /** > * Get version string from Xrl Target > */ > XrlCmdError XrlBpsfNode::common_0_1_get_version( > // Output values, > string& version) > { > version = XORP_MODULE_VERSION; > > return XrlCmdError::OKAY(); > } > > /** > * Get status of Xrl Target > */ > XrlCmdError XrlBpsfNode::common_0_1_get_status( > // Output values, > uint32_t& status, > string& reason) > { > status = NULL; > reason = "testing protocol"; > > return XrlCmdError::OKAY(); > } > > /** > * Request clean shutdown of Xrl Target > */ > XrlCmdError XrlBpsfNode::common_0_1_shutdown() > { > string error_msg; > > if (shutdown() != XORP_OK) { > error_msg = c_format("Failed to shutdown Bpsf"); > return XrlCmdError::COMMAND_FAILED(error_msg); > } > > return XrlCmdError::OKAY(); > } > > /** > * Enable/disable/start/stop Bpsf. > * > * @param enable if true, then enable Bpsf, otherwise disable it. > */ > XrlCmdError XrlBpsfNode::bpsf_0_1_enable_bpsf( > // Input values, > const bool& enable) > { > printf("%s\n", enable ? "enabling bpsf" : "disabling bpsf"); > return XrlCmdError::OKAY(); > } > > XrlCmdError XrlBpsfNode::bpsf_0_1_start_bpsf() > { > // XLOG_UNFINISHED(); > printf("%s\n", "starting up XrlBpsfNode xrl"); > > return XrlCmdError::OKAY(); > } > > XrlCmdError XrlBpsfNode::bpsf_0_1_stop_bpsf() { > // XLOG_UNFINISHED(); > > printf("%s\n", "stopping XrlBpsfNode"); > return XrlCmdError::OKAY(); > } > > /** > * Pure-virtual function that needs to be implemented to: > * > * Set the peer's AS number. > * > * @param next_hop IPv4 nexthop. > */ > XrlCmdError bpsf_0_1_set_nexthop4( > // Input values, > const string& local_ip, > const uint32_t& local_port, > const string& peer_ip, > const uint32_t& peer_port, > const IPv4& next_hop) { > printf("%s: %s %d %s %d %s \n", "setting nexthop now...", > local_ip.c_str(), local_port, peer_ip.c_str(), > peer_port, next_hop.str().c_str()); > return XrlCmdError::OKAY(); > } > > XrlCmdError bpsf_0_1_print_hello_world_and_msg( > // Input values, > const string& msg, > // Output values, > string& num) { > printf("%s: %s\n", "hello world", msg.c_str()); > num = "return message from bpsf_0_1_print_hello_world_and_msg"; > return XrlCmdError::OKAY(); > } > > /** > * Enable/disable the Bpsf trace log for all operations. > * > * @param enable if true, then enable the trace log, otherwise disable it. > */ > XrlCmdError XrlBpsfNode::bpsf_0_1_enable_log_trace_all( > // Input values, > const bool& enable) > { > printf("%s\n", enable ? "enabling bpsf logging" : "disabling bpsf logging"); > > return XrlCmdError::OKAY(); > } > > > I am using xorp-1.6 compiled from source on Linux kernel > 2.6.20.3-ubuntu1 x86_64, but I think I'm just making a stupid mistake > somewhere, has anyone had this problem or know how to fix it? > > Cheers, > Victor > > _______________________________________________ > Xorp-hackers mailing list > [email protected] > http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers _______________________________________________ Xorp-hackers mailing list [email protected] http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers
