error : collect2: ld returned 1 exit status

1,499 views
Skip to first unread message

madhvi

unread,
Sep 16, 2011, 11:29:05 PM9/16/11
to ns-u...@googlegroups.com
Dear NS users,

I have installed ns 2.33 successfully then i tried for zrp patch,but at the time of make -k step i  got the error like,

trace/cmu-trace.o: In function `hdr_zrp::access(Packet const*)':
cmu-trace.cc:(.text._ZN7hdr_zrp6accessEPK6Packet[hdr_zrp::access(Packet const*)]+0x7): undefined reference to `hdr_zrp::offset_'
collect2: ld returned 1 exit status
make: *** [nstk] Error 1

With all appreciate to any reply or suggestion
Regards,
Madhvi.

Nithesh dupaguntla

unread,
Feb 3, 2014, 9:53:08 AM2/3/14
to ns-u...@googlegroups.com
even i am getting same error a, can u plz help me to complete the project....plz...its my final year project

knudfl

unread,
Feb 3, 2014, 1:31:27 PM2/3/14
to ns-u...@googlegroups.com
@Nithesh dupaguntla :

Hi.

May be you are using the wrong compiler ?
Fedora : gcc / g++ version 3.4.6
Ubuntu : gcc / g++ version 4.1.2
... Please advise OS specifications : a ) The reply from the command $ uname -m
b) The OS name and version.

** ZRP info http://www.linuxquestions.org/questions/tags/zrp/
Install example, post #154 here
http://www.linuxquestions.org/questions/ubuntu-63/how-to-install-zrp-zone-routing-protocol-patch-in-ns-2-34-a-905025/page11.html

-

Umair Chaudhry

unread,
Jul 28, 2016, 7:23:43 PM7/28/16
to Network Simulator 2 (NS2)
I am getting the same issue. I am using ubuntu 14.04 amd64 with ns2.31

1) uname -m = x86_64
2) dpkg --list | grep compiler = command response below

ii  g++                                                   4:4.8.2-1ubuntu6                                    amd64        GNU C++ compiler
ii  g++-4.4                                               4.4.7-8ubuntu1                                      amd64        GNU C++ compiler
ii  g++-4.8                                               4.8.4-2ubuntu1~14.04.3                              amd64        GNU C++ compiler
ii  gcc                                                   4:4.8.2-1ubuntu6                                    amd64        GNU C compiler
ii  gcc-4.4                                               4.4.7-8ubuntu1                                      amd64        GNU C compiler
ii  gcc-4.8                                               4.8.4-2ubuntu1~14.04.3                              amd64        GNU C compiler
ii  hardening-includes                                    2.5ubuntu2.1                                        all          Makefile for enabling compiler flags for security hardening
ii  libllvm3.6:amd64                                      1:3.6-2ubuntu1~trusty1                              amd64        Modular compiler and toolchain technologies, runtime library
ii  libxkbcommon0:amd64                                   0.4.1-0ubuntu1                                      amd64        library interface to the XKB compiler - shared library

knudfl

unread,
Jul 29, 2016, 6:57:48 AM7/29/16
to Network Simulator 2 (NS2)
@Umair Chaudhry ,  Hi.

Ubuntu 14.04 - 64bits and ns-allinone-2.31 :  Please use gcc34, g++34 → →
cd ns-allinone-2.31/
export CC=gcc34 CXX=g++34 && ./install

If configuring in ns-2.31/ :  export CC=gcc34 CXX=g++34 && ./configure

Getting the compilers gcc34 and g++34 :
compat-gcc34  https://drive.google.com/file/d/0B7S255p3kFXNRTkzQnRSNXZ6UVU/view?usp=sharing
compat-gcc-34-c++  https://drive.google.com/file/d/0B7S255p3kFXNV3J3bnVoWGNWdG8/view?usp=sharing

Download the two package, and
cd Downloads/
sudo gdebi compat
-gcc34-3.4.6-ubuntu1204-1_amd64.deb compat-gcc-34-c++_3.4.6-20_amd64.deb

-

Umair Chaudhry

unread,
Jul 29, 2016, 5:19:50 PM7/29/16
to Network Simulator 2 (NS2)
@knudfl , Hello and thank you for your reply.

So I followed your instructions and here is what I encountered.
1- I downloaded and installed compat-gcc34 and compat-gcc-34-c++ using gdebi.
2- Doing export CC=gcc34 CXX=g++34 && ./install in ns-allinone folder gave the following error at the end
make: g++34: Command not found
make
: *** [embedded-tcl.o] Error 127
tclcl
-1.19 make failed! Exiting ...
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems
3- I jumped to the ns2.31 folder which in my case is ns-2.31dtsncc and ran
export CC=gcc34 CXX=g++34 && ./configure. It appeared to run correctly but when I tried the make command later it gave the following error
make: g++34: Command not found
make
: *** [utils_ns.o] Error 127
4- Make depend gave the followig error
/bin/sh: 1: Syntax error: Bad fd number
make
: *** [depend] Error 2
5- More details of the error are available at https://www.dropbox.com/s/3fu9sz6em5dgkfs/compiler%20error?dl=0
6- I have been trying this for so long but have been failing. What I'm actually trying to do is add a folder to my ns2.31 which was given to me by my senior. The folder is available at https://www.dropbox.com/s/gmmp0dj6pxgapeb/ns-2.31dtsncc.tar.gz?dl=0

Please let me know if you can help. I will greatly appreciate it. Thank you.
compiler error

knudfl

unread,
Jul 29, 2016, 7:23:16 PM7/29/16
to Network Simulator 2 (NS2)
@Umair Chaudhry, Hi.

»» g++34: Command not found «« : Usually means you did not install the packages.

Please do all the check commands to decide if gcc34, g++34 are present :
$ which gcc34
$ which g++34
$ ls /usr/bin/gcc*
$ ls /usr/bin/g++*
$ dpkg -L compat-gcc-34-c++

* I already have your  "ns-2.31dtsncc.tar.gz" ... from our correspondence here
 http://askubuntu.com/questions/797789/ns-2-31-make-fail-while-adding-a-transport-layer-protocol
... and by the way, I have made a reduced backup, ns231dtsncc-2.tar.gz, 9.2MB
https://drive.google.com/file/d/0B7S255p3kFXNMVhVYXlXTnI4eXM/view?usp=sharing
... with the simulation scripts and the surplus applications omitted.

The "ns-2.31 + dtsncc etc." compiles OK here, until the ndtsn.cc errors appear :
ndtsn/ndtsn.cc: In constructor `NDtsnAgent::NDtsnAgent()':
ndtsn/ndtsn.cc:48: error: `
wnd_' was not declared in this scope
ndtsn/ndtsn.cc: In member function `char* NDtsnAgent::get_bitmap_string(int*)'
:
.
ndtsn
/ndtsn.cc: In member function `virtual int NDtsnAgent::window()':
ndtsn/ndtsn.cc:573: error: `
wnd_' was not declared in this scope
ndtsn/ndtsn.cc: In member function `virtual double NDtsnAgent::windowd()'
:
ndtsn
/ndtsn.cc:578: error: `wnd_' was not declared in this scope

-

Umair Chaudhry

unread,
Jul 30, 2016, 6:04:02 PM7/30/16
to Network Simulator 2 (NS2)
@knudfl so here is what I did.

1- after the steps I mentioned in my previous reply, I explained the problems that I was encountering. So I took help from one of your previous replies on  http://askubuntu.com/questions/797789/ns-2-31-make-fail-while-adding-a-transport-layer-protocol and used
export CXX=g++-4.4 && ./configure
followed by a make in the ns2.31dtsncc folder. This time it showed no error. However, I only exported the g++4.4 and not the gcc compiler. 
2- so now,, I have something as below
umair@umair-VirtualBox:~$ which gcc34
/usr/bin/gcc34
root@umair-VirtualBox:/home/umair# which g++-4.4
/usr/bin/g++-4.4

3- also, I dont see gcc34 from the following command
root@umair-VirtualBox:/home/umair# dpkg --list | grep compiler
ii  g++                                                   4:4.8.2-1ubuntu6                                    amd64        GNU C++ compiler
ii  g++-4.4                                               4.4.7-8ubuntu1                                      amd64        GNU C++ compiler
ii  g++-4.8                                               4.8.4-2ubuntu1~14.04.3                              amd64        GNU C++ compiler
ii  gcc                                                   4:4.8.2-1ubuntu6                                    amd64        GNU C compiler
ii  gcc-4.4                                               4.4.7-8ubuntu1                                      amd64        GNU C compiler
ii  gcc-4.8                                               4.8.4-2ubuntu1~14.04.3                              amd64        GNU C compiler
ii  hardening-includes                                    2.5ubuntu2.1                                        all          Makefile for enabling compiler flags for security hardening
ii  libllvm3.6:amd64                                      1:3.6-2ubuntu1~trusty1                              amd64        Modular compiler and toolchain technologies, runtime library
ii  libxkbcommon0:amd64                                   0.4.1-0ubuntu1                                      amd64        library interface to the XKB compiler - shared library

4- Finally, the folder that I just made (the one that you also have 'ns2.31dtsncc') has the GPSR protocol included in it I believe. But running one of the tcl scripts(attached) gives me the following error. 
root@umair-VirtualBox:/home/umair/ns-allinone-2.31/ns-2.31dtsncc/dtsncc-scripts# ns dtsncc.tcl invalid command name "Agent/GPSR"
    while executing
"Agent/GPSR set planar_type_  1   "
    (file "dtsncc.tcl" line 233)


Does this mean that the gpsr protocol was not compiled correctly? How can I replace it in the tcl script by some other similar protocol that can allow the execution of the script to see if the make of the whole folder was successful?
dtsncc.tcl

knudfl

unread,
Jul 31, 2016, 6:11:56 AM7/31/16
to Network Simulator 2 (NS2)
@Umair Chaudhry.

»» ns dtsncc.tcl invalid command name "Agent/GPSR" «« :
? Are you sure you are using the right 'ns' ?

1) gpsr is present in the Makefile.in (and Makefile)
156:    gpsr/gpsr_neighbor.o \
157:    gpsr/gpsr_sinklist.o \
158:    gpsr/gpsr.o \

2) tcl/lib/ :
lib
/ns-lib.tcl:618:         gpsr {
lib
/ns-lib.tcl:619:                    set ragent [$self create-gpsr-routing-agent $node]
lib
/ns-mobilenode.tcl:217:      set gpsronly [string first "GPSR" [$agent info class]]
lib
/ns-mobilenode.tcl:218:      if {$gpsronly != -1 } {
lib
/ns-packet.tcl:184:  GPSR

3 : How to use the right executable 'ns' :
cd ns-2.31/
cp ns ns-dtncc   (if more than one version of "ns with dtsncc", add version : ns-dtncc-2)
sudo cp ns-dtncc /usr/local/bin/
... And do all simulations like :  ns-dtncc dtncc.tcl

I.e. you can only have one file by name 'ns'.
May be you by mistake added some *PATH text to .bashrc ?  Which is never required.
Just keep all ns-<name> in /usr/local/bin/ ...
... ( I usually have 200 times  ns-<name> in /usr/local/bin/ :
... I.e. i.e. we have about 200 extra ns2 protocols to maintain.)

-
Message has been deleted

Umair Chaudhry

unread,
Aug 1, 2016, 9:59:44 PM8/1/16
to Network Simulator 2 (NS2)
@knudfl

1- copied 'ns' in folder 'ns2.31' to 'ns-org' and 'ns' in folder 'ns2.31dtsncc' to 'ns-dtsn' and placed a copy of 'ns-org' and 'ns-dtsn' into /usr/local/bin/
2- attached is a copy of my .bashrc .
3- running 'ns-dtsn simple.tcl' shows the nam window and everything along with the output shown in the attached file but running 'ns-dtsn dtsn-twoflows.tcl' and 'ns-dtsn cwnd.tcl' give the errors attached. Since you already have the folder, the location of the tcl files are also shown along with the errors so you may check them out.

Thank you
 .
cp.bashrc.txt
cwnd error.txt
dtsn-twoflows error.txt
simple.tcl output
Reply all
Reply to author
Forward
0 new messages