NS3 gdb problem

1,171 views
Skip to first unread message

wei zhao

unread,
Nov 30, 2011, 3:54:26 AM11/30/11
to ns-3-users
Hi, all
I want to use gdb to debug my program. When I move the example
program from examples file to scracth file, I use the command below in
the terminal:
./waf -d debug configure
./waf shell
./waf
gdb ./build/debug/scratch/wifi-simple-infra
(under gdb) r
there is an error: while loading shared libraries: libns3-core.so3:
cann't open shaared object file: No such file or directory


Could you give me a hand to get out of the error?

Thank you very much.

Konstantinos

unread,
Nov 30, 2011, 5:52:43 AM11/30/11
to ns-3-...@googlegroups.com
Hey Wei,

I was getting the same errors only on the workstation at work where I was not a "privileged" user, but on my laptop I didn't. So the solution was to use sudo gdb in order to use the shared libraries. This might solve your problems.

Regards,
Konstantinos 

wei zhao

unread,
Nov 30, 2011, 6:36:21 AM11/30/11
to ns-3-users
Hi, Konstantios
Thank you for your reply. I have done as you said.However, it
did't work.
It's true I work on my workstation with VM.

Konstantinos

unread,
Nov 30, 2011, 6:52:31 AM11/30/11
to ns-3-...@googlegroups.com
I didn't have any problems with vm on my laptop.

Do you get the same error when you use this command to run gdb (the proposed one from ns-3):
./waf -d debug configure
./waf shell  //can be omitted..
./waf --run scratch/wifi-simple-infra --command-template="gdb --args %s <agrs>" 

赵伟

unread,
Dec 1, 2011, 12:55:21 AM12/1/11
to ns-3-...@googlegroups.com
Hi, Konstantinos
I did as you said. And it works.
Thank you very much.

Regards
Wei
--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/ns-3-users/-/U_9A56BmteAJ.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+unsub...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.


Alessandro Russo

unread,
Dec 5, 2011, 1:57:36 PM12/5/11
to ns-3-...@googlegroups.com
On Wed, Nov 30, 2011 at 9:54 AM, wei zhao <zhaow...@126.com> wrote:
Hi, all
  I want to use gdb to debug my program. When I move the example
program from examples file to scracth file, I use the command below in
the terminal:
./waf -d debug configure
./waf shell
./waf
gdb ./build/debug/scratch/wifi-simple-infra
(under gdb) r
there is an error: while loading shared libraries: libns3-core.so3:
cann't open shaared object file: No such file or directory


under Linux OS just
export LD_LIBRARY_PATH="absolute-path-to-ns3.so-dir"
it is usually something like  "$HOME/ns-3-dev-dir/build/"

Could you give me a hand to get out of the error?

Thank you very much.
--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.

Waqar Durrani

unread,
Apr 12, 2012, 4:17:09 PM4/12/12
to ns-3-...@googlegroups.com
use this

>> ./waf build/debug/scratch/wifi-simple-infra --command-template="gdb --args %s"

i think ideally, to run waf, you must be in repos/ns-3-allinone/ns-3-dev/ directory already
then do this

>> ./waf scratch/wifi-simple-infra --command-template="gdb --args %s"

then on gdb prompt, type "run"

(gdb) run

It will give you the start of the error, then if you need more, type "backtrace"

(gdb) backtrace

I guess, it will be enough for you to find the problem. If not, google about usage of gdb further.
To quit gdb now, type "quit"

(gdb) quit

press y and then ENTER, you are now back at normal prompt
:)

Waqar Durrani

unread,
Apr 12, 2012, 4:19:45 PM4/12/12
to ns-3-...@googlegroups.com
Actually debuggers usually work on executables, so do gdb. But in our case, we are running it on object files that are with ".o" extensions. SO we do use waf and gdb in conjuction. Thats why format of using is a bit different than you might have found on some sources, nonetheless commands are perfectly the same for gdb, wherever you use it.

Waqar Durrani

unread,
Apr 12, 2012, 4:22:50 PM4/12/12
to ns-3-...@googlegroups.com
Sorry, forgot to mention.... use "sudo" before the word "./waf" as you might not be a privileged user. If you are, sudo creates no difference.
Reply all
Reply to author
Forward
0 new messages