is this ns-3 error?

590 views
Skip to first unread message

Kemal Kilic

unread,
Oct 20, 2016, 5:41:39 AM10/20/16
to ns-3-users
Hello Folks,

I tried to compile ns-3 version 3.26 with nano-sim module. This is the message (only the error part of it of course) I got:
Why it is giving me error for the /ns3/object.h?
Any help?

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[1704/1816] Compiling src/nanonetworks/model/nanonode-nano-device.cc
In file included from ./ns3/object-factory.h:24:0,
                from ../src/nanonetworks/helper/nano-helper.h:25,
                from ../src/nanonetworks/helper/nano-helper.cc:22:
./ns3/object.h: In instantiation of ‘ns3::Ptr<T> ns3::CreateObject() [with T = ns3::TsOokBasedNanoSpectrumPhy]’:
../src/nanonetworks/helper/nano-helper.cc:69:85:   required from here
./ns3/object.h:533:29: error: invalid new-expression of abstract class type ‘ns3::TsOokBasedNanoSpectrumPhy’
  return CompleteConstruct (new T ());
                            ^~~~~~~~
In file included from ../src/nanonetworks/helper/nano-helper.cc:31:0:
./ns3/ts-ook-based-nano-spectrum-phy.h:52:7: note:   because the following virtual functions are pure within ‘ns3::TsOokBasedNanoSpectrumP
hy’:
class TsOokBasedNanoSpectrumPhy : public NanoSpectrumPhy
      ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./ns3/nano-spectrum-phy.h:30:0,
                from ../src/nanonetworks/helper/nano-helper.h:31,
                from ../src/nanonetworks/helper/nano-helper.cc:22:
./ns3/spectrum-phy.h:70:26: note:       virtual ns3::Ptr<ns3::NetDevice> ns3::SpectrumPhy::GetDevice() const
  virtual Ptr<NetDevice> GetDevice () const = 0;
                         ^~~~~~~~~

Waf: Leaving directory `/home/kemal/my_dir/my_prog/ns-3-dev/build'
Build failed
-> task in 'ns3-nanonetworks' failed (exit status 1):                                                                                     
       {task 139924334687760: cxx nano-helper.cc -> nano-helper.cc.1.o}                                                                   
['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-std=c++11', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wst
rict-aliasing', '-fPIC', '-pthread', '-I.', '-I..', '-DNS3_BUILD_PROFILE_DEBUG', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IO
CTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_IF_TUN_H=1', '-DHAVE_=1', '-DHAVE_GSL=1', '-DHAVE_
SQLITE3=1', '../src/nanonetworks/helper/nano-helper.cc', '-c', '-o', '/home/kemal/my_dir/my_prog/ns-3-dev/build/src/nanonetworks/helper/na
no-helper.cc.1.o']   

---------------------------------------------------------------------------------------------------------------------------

                                                  

Konstantinos

unread,
Oct 20, 2016, 5:52:44 AM10/20/16
to ns-3-users
Hi Kemal,

The error is clear and it is related to the added module.

error: invalid new-expression of abstract class type ‘ns3::TsOokBasedNanoSpectrumPhy’ because the following virtual functions are pure within ‘ns3::TsOokBasedNanoSpectrumPhy’: class TsOokBasedNanoSpectrumPhy : public NanoSpectrumPhy virtual ns3::Ptr<ns3::NetDevice> ns3::SpectrumPhy::GetDevice() const 

This is a standard C++ error. You are trying to initialize an abstract class. You have to implement all the pure virtual methods of the base abstract class in your own inherited class.
In this case, you have not implemented the GetDevice() method.

Regards
K.

Abdul Wahab KR

unread,
Oct 12, 2018, 1:35:44 PM10/12/18
to ns-3-users
Hi Brother,
Brother i am getting similar error like this why  building ns3 and as you mentioned i checked the file for pure virtual functions  but everything is working fine. i don't know whats causing the issue.

Build failed
 -> task in 'ns3-nanonetworks' failed with exit status 1:
    {task 140126677056160: cxx nano-mac-entity.cc -> nano-mac-entity.cc.1.o}
['/usr/bin/g++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-std=c++11', '-fstrict-aliasing', '-Wstrict-aliasing', '-fPIC', '-pthread', '-I.', '-I..', '-DNS3_BUILD_PROFILE_DEBUG', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DHAVE_SYS_IOCTL_H=1', '-DHAVE_IF_NETS_H=1', '-DHAVE_NET_ETHERNET_H=1', '-DHAVE_PACKET_H=1', '-DHAVE_IF_TUN_H=1', '../src/nanonetworks/model/nano-mac-entity.cc', '-c', '-o/home/wahab26/Desktop/ns-allinone-3.29/ns-3.29/build/src/nanonetworks/model/nano-mac-entity.cc.1.o']

                                                  

Kemal Kilic

unread,
Oct 12, 2018, 3:39:45 PM10/12/18
to ns-3-users
Here is the tutorial once I prepared
You need to figure out which steps you should take and which steps you should skip
Also, I guess they recently updated nanosim
Probably these steps will not work
But take them as a generic guideline

You need Linux!

Assume that you have ubuntu the first step is to install
required packages for this the command is :

--------------paste it to terminal-----------------------
sudo apt-get install gcc g++ python python-dev mercurial bzr gdb valgrind gsl-bin libgsl-dev libgsl0ldbl flex bison tcpdump sqlite sqlite3 libsqlite3-dev libxml2 libxml2-dev libgtk2.0-0 libgtk2.0-dev uncrustify doxygen graphviz imagemagick texlive texlive-latex-extra texlive-generic-extra texlive-generic-recommended texinfo dia texlive texlive-latex-extra texlive-extra-utils texlive-generic-recommended texi2html python-pygraphviz python-kiwi python-pygoocanvas libgoocanvas-dev python-pygccxml

--------------------------------------------



After that :
---------------------------------------------------------------------------------------------
nanosim works with ns3 version 3.20! I guess also with 3.21 too
Here is a step by step guide for Linux. Let me know if anything goes wrong:

---------------------------------------------------------------------------------------
Download ns-3 version 3.20:


************************************************************************************
FOR UBUNTU:

install (not all of them of course, cmake is necessary) packages listed on this page:





NOTE THAT:

Python API scanning support: cmake libc6-dev libc6-dev-i386 g++-multilib
To rescan Python bindings requires gccxml and pygccxml, which are installed by bake. 
However, for Ubuntu 16.04, gccxml will not build without a patch and a 




You may skip this gccxml step!!!
*************************************************************************************
Download gccxml from https://github.com/gccxml/gccxml :


unzip master.zip like this:

unzip master.zip
mv gccxml-master gccxml




save it to a text file called "gccxml-patch.txt" in the same dir as master.zip

replace in the patch file :

"gccxml-0.9.0-20150423.orig" to "gccxml.orig"  
"gccxml-0.9.0-20150423" to "gccxml"


then:

cd gccxml
patch -p1 < ../gccxml-patch.txt

now build gccxml in gccxml dir:

cmake ../gccxml -DCMAKE_INSTALL_PREFIX:PATH=../../build -DCMAKE_C_FLAGS=-fgnu89-inline

make -j4 
or
make -j8


as root install it
sudo make install

Now gccxml will be in let say:

/home/<your user name>/Desktop/build/bin
Check it!

you must add "/home/<your user name>/Desktop/build/bin"   to your PATH

add line to your .bashrc as

export PATH=/home<your user name>/build/bin:$PATH

now ready to compile ns3


*************************************************************************************


Download nanosim package:





unzip ns-allinone-3.20.tar.bz2:

tar xvjf ns-allinone-3.20.tar.bz2





go to ns-3.20 dir in ns-allinone-3.20:

cd ns-allinone-3.20/ns-3.20/





configure ns-3.20 :

CXXFLAGS="-Wall" ./waf configure



compile it:

./waf



If all goes well then go up where you downloaded all:

cd ../../


extract the "linux" (there is also code for MACOSX) directory from nanonetworks.zip :

unzip nanonetworks.zip 'nanonetworks/*' -d ./



then copy nanonetworks dir to ns-allinone-3.20/ns-3.20/src/ :

cp -R nanonetworks ns-allinone-3.20/ns-3.20/src/




then do configure and compile again after you go to ns-allinone-3.20/ns-3.20/ dir :

cd ns-allinone-3.20/ns-3.20/
CXXFLAGS="-Wall" ./waf configure
./waf


if all goes well you can run nanosim examples, first copy all examples of nanosim to scratch dir:

cp src/nanonetworks/examples/* scratch/


then:

./waf --run scratch/health-care



you must see some output stuff!!!


Done!


Reply all
Reply to author
Forward
0 new messages