Masoud
Masoud

Reputation: 305

Running simulation in omnet++ with standalone file

I want to run my simulation on a machine that does not have omnet++. Is there any way that I can do that? Is it possible to build my project in a way to be self sufficient?

Upvotes: 0

Views: 826

Answers (2)

Jerzy D.
Jerzy D.

Reputation: 7012

You can avoid dependencies to native OMNeT++ libraries (e.g. liboppenvird.so, liboppsimd.so etc) by compiling your OMNeT++ with static libraries option. In order to do that open configure.user from main OMNeT++ directory and set:
SHARED_LIBS=no
Then rebuild your OMNeT++ (make clean, ./configure, make). Next rebuild your project. Example for tictoc:

cd samples/tictoc
opp_makemake -f --deep
make clean && make

Then ldd tictoc will show:

user@ubuntu:/opt/omnetpp-4.6/samples/tictoc$ ldd tictoc
    linux-vdso.so.1 =>  (0x00007ffe4e1f6000)
    libtk8.6.so => /usr/lib/x86_64-linux-gnu/libtk8.6.so (0x00007fcf868d7000)
    libtcl8.6.so => /usr/lib/x86_64-linux-gnu/libtcl8.6.so (0x00007fcf8653a000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fcf8631f000)
    libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007fcf85f56000)
    libmpi_cxx.so.1 => /usr/lib/libmpi_cxx.so.1 (0x00007fcf85d3a000)
    libmpi.so.1 => /usr/lib/libmpi.so.1 (0x00007fcf859b1000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fcf857ad000)
    libhwloc.so.5 => /usr/lib/x86_64-linux-gnu/libhwloc.so.5 (0x00007fcf85568000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fcf85259000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fcf84f51000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fcf84d3b000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fcf84b1d000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcf84753000)
    libXft.so.2 => /usr/lib/x86_64-linux-gnu/libXft.so.2 (0x00007fcf8453e000)
    libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007fcf84300000)
    libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007fcf83fc7000)
    libXss.so.1 => /usr/lib/x86_64-linux-gnu/libXss.so.1 (0x00007fcf83dc3000)
    libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007fcf83a45000)
    libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fcf83842000)
    libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007fcf83638000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fcf86c2b000)
    libnuma.so.1 => /usr/lib/x86_64-linux-gnu/libnuma.so.1 (0x00007fcf8342d000)
    libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007fcf83185000)
    libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007fcf82f7b000)
    libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007fcf82d52000)
    libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fcf82b33000)
    libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007fcf82921000)
    libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007fcf810b4000)
    libpng12.so.0 => /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007fcf80e8e000)
    libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007fcf80c8a000)
    libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fcf80a84000)

Moreover, if you do not need graphical interface, you can build your project only for command line mode. It decreases number of dependencies. In order to do that use the command:
opp_makemake -f --deep -u Cmdenv
(or set it using Project properties in OMNeT++).
After rebuilding tictoc there is no dependencies to X11 libraries:

user@ubuntu:/opt/omnetpp-4.6/samples/tictoc$ ldd tictoc
    linux-vdso.so.1 =>  (0x00007ffd82197000)
    libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007f452e838000)
    libmpi_cxx.so.1 => /usr/lib/libmpi_cxx.so.1 (0x00007f452e61c000)
    libmpi.so.1 => /usr/lib/libmpi.so.1 (0x00007f452e293000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f452e08f000)
    libhwloc.so.5 => /usr/lib/x86_64-linux-gnu/libhwloc.so.5 (0x00007f452de4a000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f452db3b000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f452d833000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f452d61d000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f452d3ff000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f452d035000)
    libicuuc.so.52 => /usr/lib/x86_64-linux-gnu/libicuuc.so.52 (0x00007f452ccb7000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f452ca9c000)
    libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f452c899000)
    libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007f452c68f000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f452ec01000)
    libnuma.so.1 => /usr/lib/x86_64-linux-gnu/libnuma.so.1 (0x00007f452c484000)
    libicudata.so.52 => /usr/lib/x86_64-linux-gnu/libicudata.so.52 (0x00007f452ac17000)

Upvotes: 1

ManiAm
ManiAm

Reputation: 1851

OMNET projects need opp_run file (omnet-x.x/bin/opp_run). Basically, opp_run allows starting simulation models that are linked as shared libraries. You can run your simulation using

opp_run -r 0 -u Cmdenv -c yourConfigName -n . -l yourProgram params.ini

-r <runnumber> allows you to select runs
-u Cmdenv tells omnetpp to run under Cmdenv (command-line environment)
-c <configname> option is used to select a configuration
-n option is used to specify the NED path
-l option is used to load additional shared libraries

opp_run requires many shared libraries to run properly. In Linux, you can use ldd to list all the shared libraries required by opp_run. For example on my Ubuntu 14 machine:

enter image description here

As you can see, opp_run requires many shared libraries and you need to have them all installed on your target machine.

I am also running my OMNET simulation on a Linux server (Ubuntu 14 Server). But I have installed OMNET on my home folder (without any need for sudo access) and can run the simulations using the above command (with this assumption that you have all the required libraries installed). Check OMNET installation guide to check which packages you need on your system.

Upvotes: 1

Related Questions