Using Boost libraries with ns3

492 views
Skip to first unread message

HA

unread,
Mar 6, 2014, 7:59:53 PM3/6/14
to ns-3-...@googlegroups.com
Hello,

I am trying to run the following script "test"cc" which is located in scratch folder:

#include "ns3/core-module.h"
#include <boost/asio.hpp>

NS_LOG_COMPONENT_DEFINE ("HelloSimulator");

using namespace ns3;

int
main (int argc, char *argv[])
{
  NS_LOG_UNCOND ("Hello Linux");
}

Since I am using boost libraries I used the following command to determine the boost include and libraries:

root@ubuntu:/home/ha/workspace/source/ns-3.19# export BOOSTDIR=/home/ha/boost_1_49_0/
root@ubuntu:/home/ha/workspace/source/ns-3.19# ./waf configure --boost-includes=$BOOSTDIR/include --boost-libs=$BOOSTDIR/lib

And the output was OK:
Checking boost includes                                                                      : 1_49 
Checking boost libs                                                                              : ok 
Checking for boost linkage                                                                  : ok

But when I run ./waf I get the following errors, below you can see also that boost path is different from what I configured before

Waf: Entering directory `/home/ha/workspace/source/ns-3.19/build'
scratch/test.cc.2.o: In function `__static_initialization_and_destruction_0':=================================================>     ][4m26.759s]
/usr/local/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
/usr/local/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
/usr/local/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
scratch/test.cc.2.o: In function `boost::asio::error::get_system_category()':
/usr/local/include/boost/asio/error.hpp:216: undefined reference to `boost::system::system_category()'
collect2: ld returned 1 exit status
[48/48][100%][|][==================================================================================================================>][5m22.577s]
Waf: Leaving directory `/home/ha/workspace/source/ns-3.19/build'
Build failed
 -> task in 'test' failed (exit status 1): 
{task 46775952: cxxprogram test.cc.2.o -> test}
['/usr/bin/g++', '-pthread', '-pthread', '-Wl,-Bsymbolic-functions', '-Wl,-z,relro', 'scratch/test.cc.2.o', '-o', '/home/ha/workspace/source/ns-3.19/build/scratch/test', '-Wl,-Bstatic', '-Wl,-Bdynamic', '-Wl,--no-as-needed', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L.', '-L/usr/lib', '-lns3.19-test-debug', '-lns3.19-csma-layout-debug', '-lns3.19-point-to-point-layout-debug', '-lns3.19-netanim-debug', '-lns3.19-lte-debug', '-lns3.19-spectrum-debug', '-lns3.19-antenna-debug', '-lns3.19-aodv-debug', '-lns3.19-dsdv-debug', '-lns3.19-dsr-debug', '-lns3.19-mesh-debug', '-lns3.19-olsr-debug', '-lns3.19-csma-debug', '-lns3.19-wimax-debug', '-lns3.19-wave-debug', '-lns3.19-applications-debug', '-lns3.19-virtual-net-device-debug', '-lns3.19-uan-debug', '-lns3.19-energy-debug', '-lns3.19-flow-monitor-debug', '-lns3.19-nix-vector-routing-debug', '-lns3.19-sixlowpan-debug', '-lns3.19-tap-bridge-debug', '-lns3.19-visualizer-debug', '-lns3.19-internet-debug', '-lns3.19-bridge-debug', '-lns3.19-point-to-point-debug', '-lns3.19-mpi-debug', '-lns3.19-wifi-debug', '-lns3.19-buildings-debug', '-lns3.19-propagation-debug', '-lns3.19-mobility-debug', '-lns3.19-config-store-debug', '-lns3.19-emu-debug', '-lns3.19-fd-net-device-debug', '-lns3.19-topology-read-debug', '-lns3.19-network-debug', '-lns3.19-stats-debug', '-lns3.19-core-debug', '-lrt', '-lgsl', '-lgslcblas', '-lm', '-lsqlite3', '-lgtk-x11-2.0', '-lgdk-x11-2.0', '-latk-1.0', '-lgio-2.0', '-lpangoft2-1.0', '-lpangocairo-1.0', '-lgdk_pixbuf-2.0', '-lcairo', '-lpango-1.0', '-lfreetype', '-lfontconfig', '-lgobject-2.0', '-lglib-2.0', '-lxml2', '-lpython2.7']


So how can I solve this problem?

I want to use the boost libraries to implement a TCP client, so during the simulation when I have a certain callback, I use the TCP client to send some values to a TCP server and get back a response.


Thanks a lot in advance.
Message has been deleted

Craig Dowell

unread,
Aug 11, 2016, 1:58:20 PM8/11/16
to ns-3-...@googlegroups.com
Looks like you need to Google "linker error when compiling boost.asio example"

On Aug 11, 2016, at 9:13 AM, Matthias Kreileder <matthias....@gmail.com> wrote:

Hi,

Have you managed to solve this linker issue? I would be of great help if you could share your solution with me.

Kindest,
Matt

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages