LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Ns-2 make error (https://www.linuxquestions.org/questions/linux-newbie-8/ns-2-make-error-4175479282/)

najma 10-02-2013 12:08 AM

Ns-2 make error
 
Hi, I m working on the energy model of leach protocol, and for that using Ns-2.29 with mannasim. I have added few lines in battery.cc and battery.h ( which is used for sensor nodes), and run make command, my code compiles perfectly without any error, then I commented the changes made and run make command, now I m getting this error. I haven't access or changed any of these files but don't know why I m getting this. I'll be grateful if anyone can help in resolving this issue.
Regards,
Najma


classifier/classifier-bst.cc
classifier/classifier-bst.cc:62:17: error: ump.h: No such file or directory

classifier/classifier-bst.cc: In member function ‘virtual void MCastBSTClassifier::recv(Packet*, Handler*)’:
classifier/classifier-bst.cc:158: error: ‘hdr_ump’ was not declared in this scope
classifier/classifier-bst.cc:158: error: ‘ump’ was not declared in this scope
classifier/classifier-bst.cc:158: error: ‘hdr_ump’ is not a class or namespace
make: *** [classifier/classifier-bst.o] Error 1

unSpawn 10-02-2013 05:09 PM

ump.h should be in the ns-2.29/adc/ subdirectory so check your NS2 source first? (Not that I know anything about NS2 BTW...)

knudfl 10-02-2013 07:43 PM

Quote:

error: ump.h: No such file or directory
May be you somehow screwed up the "make depend settings" ?

You could try : $ make depend && make

najma 10-02-2013 11:16 PM

Hi, thanks for the reply, i have checked it and found that adc folder is somehow moved to another folder which i simply don't know how. i simply change the location of the folder and now not getting that error, but something else which i simply don't understand what it is b/c i have been working with ns-2 from last 1 year and have never experienced these issues. please guide now how to resolve the new error hundreds of lines which i m encountering when run make command. i m pasting the last few lines of the error.
regard,
najma

accessPointDiffApp.cc:(.text._ZN24NRSimpleAttributeFactoryIfE4findEPSt6vectorIP11NRAttributeSaIS3_EE PN9__gnu_cxx17__normal_iteratorIPS3_S5_EE[NRSimpleAttributeFactory<float>::find(std::vector<NRAttribute*, std::allocator<NRAttribute*> >*, __gnu_cxx::__normal_iterator<NRAttribute**, std::vector<NRAttribute*, std::allocator<NRAttribute*> > >*)]+0x3a): undefined reference to `NRAttribute::find_key_from(int, std::vector<NRAttribute*, std::allocator<NRAttribute*> >*, __gnu_cxx::__normal_iterator<NRAttribute**, std::vector<NRAttribute*, std::allocator<NRAttribute*> > >, __gnu_cxx::__normal_iterator<NRAttribute**, std::vector<NRAttribute*, std::allocator<NRAttribute*> > >*)'
mannasim/diffusion/accessPointDiffApp.o:(.rodata._ZTI18AccessPointDiffApp[typeinfo for AccessPointDiffApp]+0x18): undefined reference to `typeinfo for DiffApp'
collect2: ld returned 1 exit status
make: *** [ns] Error 1
root@ubuntu:/home/najmaismat/ns-allinone-2.29/ns-2.29#

knudfl 10-03-2013 08:45 AM

# 4 .

Looks like you are using the wrong compiler ?
What's in the Makefile line 37 ? CPP = ??

Your error output : Difficult to read without the code tags.
Please edit post #4 to use code tags.
I.e. type [/code] at text end, and [code] at text start :
http://www.linuxquestions.org/questi....php?do=bbcode

-

najma 10-03-2013 03:12 PM

hi,
on line 37 of Make.in file: CPP = @CXX@

Edited Post # 4
Code:

gnu_cxx::__normal_iterator<NRAttribute**, std::vector<NRAttribute*, std::allocator<NRAttribute*> > >*)]+0x3a): undefined reference to `NRAttribute::find_key_from(int, std::vector<NRAttribute*, std::allocator<NRAttribute*> >*, __gnu_cxx::__normal_iterator<NRAttribute**, std::vector<NRAttribute*, std::allocator<NRAttribute*> > >, __gnu_cxx::__normal_iterator<NRAttribute**, std::vector<NRAttribute*, std::allocator<NRAttribute*> > >*)'
mannasim/diffusion/accessPointDiffApp.o: In function `NRSimpleAttributeFactory<float>::find(std::vector<NRAttribute*, std::allocator<NRAttribute*> >*, __gnu_cxx::__normal_iterator<NRAttribute**, std::vector<NRAttribute*, std::allocator<NRAttribute*> > >*)':
accessPointDiffApp.cc:(.text._ZN24NRSimpleAttributeFactoryIfE4findEPSt6vectorIP11NRAttributeSaIS3_EEPN9__gnu_cxx17__normal_iteratorIPS3_S5_EE[NRSimpleAttributeFactory<float>::find(std::vector<NRAttribute*, std::allocator<NRAttribute*> >*, __gnu_cxx::__normal_iterator<NRAttribute**, std::vector<NRAttribute*, std::allocator<NRAttribute*> > >*)]+0x3a): undefined reference to `NRAttribute::find_key_from(int, std::vector<NRAttribute*, std::allocator<NRAttribute*> >*, __gnu_cxx::__normal_iterator<NRAttribute**, std::vector<NRAttribute*, std::allocator<NRAttribute*> > >, __gnu_cxx::__normal_iterator<NRAttribute**, std::vector<NRAttribute*, std::allocator<NRAttribute*> > >*)'
mannasim/diffusion/accessPointDiffApp.o:(.rodata._ZTI18AccessPointDiffApp[typeinfo for AccessPointDiffApp]+0x18): undefined reference to `typeinfo for DiffApp'
collect2: ld returned 1 exit status
make: *** [ns] Error 1


knudfl 10-03-2013 03:40 PM

# 6 .

! It's not about the "Makefile.in" !

Repeat : What's in the 'Makefile' , line 37 ? CPP = ??

najma 10-03-2013 04:09 PM

#7
At line 37 of Makefile

CPP = g++

knudfl 10-04-2013 02:13 AM

# 8 .

OK, seems that you generated a new Makefile.

Either edit line 37 to your g++ version 4.1.2, like
CPP = g++41

Or reconfigure ns-2.29/ by including your compiler :
$ export CXX=g++41 && ./configure


P.S. : It's always a good idea to save the original Makefile :
$ cp Makefile Makefile.orig
... then you could have checked the original line 37.

-

najma 10-04-2013 05:33 AM

Ok thanks..will let you know the outcome .

najma 10-04-2013 07:56 AM

hi,
i m getting this when run
$ export CXX=g++41 && ./configure
$ make

Code:

Explicitly disabling static compilation
checking for dlopen in -ldl... yes
checking for a BSD-compatible install... /usr/bin/install -c
configure: creating ./config.status
config.status: creating Makefile
config.status: creating tcl/lib/ns-autoconf.tcl
config.status: creating indep-utils/webtrace-conv/ucb/Makefile
config.status: creating indep-utils/webtrace-conv/dec/Makefile
config.status: creating indep-utils/webtrace-conv/nlanr/Makefile
config.status: creating indep-utils/webtrace-conv/epa/Makefile
config.status: creating indep-utils/cmu-scen-gen/setdest/Makefile
config.status: creating autoconf.h
config.status: autoconf.h is unchanged
root@ubuntu:/home/najmaismat/ns-allinone-2.29/ns-2.29# make
/home/najmaismat/ns-allinone-2.29/bin/tclsh8.4 bin/tcl-expand.tcl tcl/lib/ns-lib.tcl  | ../tclcl-1.17/tcl2c++ et_ns_lib > gen/ns_tcl.cc
g++41 -c -Wall  -DTCP_DELAY_BIND_ALL -DNO_TK -DTCLCL_CLASSINSTVAR  -DNDEBUG -DLINUX_TCP_HEADER -DUSE_SHM -DHAVE_LIBTCLCL -DHAVE_TCLCL_H -DHAVE_LIBOTCL1_11 -DHAVE_OTCL_H -DHAVE_LIBTK8_4 -DHAVE_TK_H -DHAVE_LIBTCL8_4 -DHAVE_TCL_H  -DHAVE_CONFIG_H -DNS_DIFFUSION -DSMAC_NO_SYNC -DCPP_NAMESPACE=no -DUSE_SINGLE_ADDRESS_SPACE -Drng_test -I. -I/home/najmaismat/ns-allinone-2.29/tclcl-1.17 -I/home/najmaismat/ns-allinone-2.29/otcl-1.11 -I/home/najmaismat/ns-allinone-2.29/include -I/home/najmaismat/ns-allinone-2.29/include -I/usr/include/pcap -I./tcp -I./sctp -I./common -I./link -I./queue -I./adc -I./apps -I./mac -I./mobile -I./trace -I./routing -I./tools -I./classifier -I./mcast -I./diffusion3/lib/main -I./diffusion3/lib -I./diffusion3/lib/nr -I./diffusion3/ns -I./diffusion3/filter_core -I./asim/ -I./qs -I./diffserv -I./satellite -I./wpan -o gen/ns_tcl.o gen/ns_tcl.cc
make: g++41: Command not found
make: *** [gen/ns_tcl.o] Error 127
root@ubuntu:/home/najmaismat/ns-allinone-2.29/ns-2.29#


knudfl 10-04-2013 09:52 AM

# 11.
Quote:

make: g++41: Command not found
You will of course have to install a {gcc/g++ version 4.1.2}
before you can use it.
*** Note : Must be ns-allinone-2.29.3.tar.gz

Which Ubuntu are you using ?
Please show the replies from these two commands :
1. $ uname -m <Enter>
2. $ cat /etc/issue

-

najma 10-04-2013 10:00 AM

Post#12

i have ns-allinone-2.29.3.tar.gz

najmaismat@ubuntu:~$ uname -m
x86_64
najmaismat@ubuntu:~$ cat /etc/issue
Ubuntu 10.04.4 LTS \n \l

najma 10-04-2013 10:07 AM

Post# 13 when i try to install {gcc/g++ version 4.1.2}, i m getting this error:

najmaismat@ubuntu:~$ sudo apt-get install gcc-4.1.2
[sudo] password for najmaismat:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package gcc-4.1.2
najmaismat@ubuntu:~$ sudo apt-get install g++-4.1.2
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package g++-4.1.2
najmaismat@ubuntu:~$

knudfl 10-04-2013 02:38 PM

# 14 .

If "gcc-4.1" is still available on the old Ubuntu 10.04,
the install command is : $ sudo apt-get install g++-4.1
( 'gcc-4.1' is automatically installed as dependency.)


Note : ns2 is for a 32bits OS (i686) not 64bits (x86_64),
though some ns2 versions and some patches will work on 64bits.
But with a reduced functionality. (Inferior validate result.)

Ubuntu 10.04 / gcc-4.1 / g++-4.1, the install command is
$ export CC=gcc-4.1 CXX=g++-4.1 && ./install
Configuring ns-2.29/ :
$ export CC=gcc-4.1 CXX=g++-4.1 && ./configure


-


All times are GMT -5. The time now is 12:00 PM.