我想在没有omnet ++的机器上运行我的模拟。有什么方法可以做到吗? 是否有可能以自给自足的方式构建我的项目?
答案 0 :(得分:1)
OMNET项目需要opp_run文件(omnet-x.x / bin / opp_run)。基本上,opp_run允许启动链接为共享库的模拟模型。您可以使用
运行模拟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需要许多共享库才能正常运行。在Linux中,您可以使用ldd
列出opp_run所需的所有共享库。例如在我的Ubuntu 14机器上:
正如您所看到的,opp_run需要许多共享库,您需要将它们全部安装在目标计算机上。
我也在Linux服务器(Ubuntu 14 Server)上运行OMNET模拟。但是我已经在我的主文件夹上安装了OMNET(不需要sudo访问)并且可以使用上面的命令运行模拟(假设你已经安装了所有必需的库)。检查OMNET安装guide以检查系统上需要哪些软件包。
答案 1 :(得分:1)
您可以通过使用静态库选项编译OMNeT++
来避免对原生liboppenvird.so
库的依赖(例如liboppsimd.so
,OMNeT++
等)。为此,请从主configure.user
目录中打开OMNeT++
并设置:
SHARED_LIBS=no
然后重建您的OMNeT ++(make clean
,./configure
,make
)。接下来重建您的项目。
tictoc
示例:
cd samples/tictoc
opp_makemake -f --deep
make clean && make
然后ldd tictoc
会显示:
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)
此外,如果您不需要图形界面,则只能为命令行模式构建项目。它减少了依赖项的数量。为此,请使用命令:
opp_makemake -f --deep -u Cmdenv
(或使用OMNeT++
中的项目属性设置它)。
重建tictoc
后,X11库没有依赖关系:
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)