Is there is any way to execution of Ns3 program from any location other than ns-3.29 folder

106 views
Skip to first unread message

Arun

unread,
Feb 8, 2019, 11:40:18 AM2/8/19
to ns-3-users
I want to execute NS3 from any location not only  ns-3.29 location
 /home/username/Downloads/ns-allinone-3.29/ns-3.29
I saw one method in internet for adding path to profile like editing ~./profile:

and add
 PATH="$HOME/bin:$PATH:/home/username/Downloads/ns-allinone-3.29/ns-3.29"

 I tried this but not working . Is it possible to execute Ns3 from anywhere ,

Tom Henderson

unread,
Feb 8, 2019, 2:21:42 PM2/8/19
to ns-3-...@googlegroups.com, Arun
Keep in mind that you are executing a program linking to shared
libraries, so typically you will need to extend your LD_LIBRARY_PATH and
your PATH.

The above PATH that you suggest is typically not going to help.

Have a look inside the build/ directory; you will find your libraries
and executables there.

Notice that build/lib contains the libraries. On Linux, try this command:

cd <top-level-ns-3-directory>
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd`/build/lib

Now, you need to extend your path to the executable location. These
will be in the 'build/scratch', 'build/examples', or 'build/src'
directory (mirroring the location where they are found in the source
repository).

For instance, let's say you want to run the tutorial program first.cc:

cd <top-level-ns-3-directory>
export PATH=$PATH:`pwd`/build/examples/tutorial

Now you can run the executable 'ns3-dev-first-optimized' from anywhere.
(Note: you may have a different prefix or suffix name on your
executable than I show above).

- Tom


>
> --
> 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
> <mailto:ns-3-users+...@googlegroups.com>.
> To post to this group, send email to ns-3-...@googlegroups.com
> <mailto: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.

arun soman

unread,
Mar 8, 2019, 9:47:02 AM3/8/19
to Tom Henderson, ns-3-...@googlegroups.com
Hi Tom,
When I tried the command as follows to run NS3 from any location but still says that ./waf not found. My source file is in the scratch folder.


library

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/uname/Data/ns-allinone-3.29/ns-3.29/build/lib

source file
export PATH=$PATH:/home/uname/Data/ns-allinone-3.29/ns-3.29/build/scratch
--
Arun Soman


Tom Henderson

unread,
Mar 8, 2019, 1:36:08 PM3/8/19
to ns-3-...@googlegroups.com
On 3/8/19 6:46 AM, arun soman wrote:
> Hi Tom,
> When I tried the command as follows to run NS3 from any location but
> still says that ./waf not found. My source file is in the scratch folder.
>
>
> library
>
> export
> LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/uname/Data/ns-allinone-3.29/ns-3.29/build/lib
>
> source file
> export PATH=$PATH:/home/uname/Data/ns-allinone-3.29/ns-3.29/build/scratch

Arun, see my other email; you do not use Waf if you try to run the
executable directly.

- Tom
Reply all
Reply to author
Forward
0 new messages