2016-02-02 60 views
0

我想在沒有omnet ++的計算機上運行我的模擬。有什麼辦法可以做到嗎? 是否有可能以自給自足的方式構建我的項目?使用獨立文件在omnet ++中運行模擬

+0

你想要哪種操作系統使用 - Windows或Linux或Mac? –

+0

我想在Linux服務器上運行我的模擬。 – Masoud

+0

Stack Overflow是編程和開發問題的網站。這個問題似乎與題目無關,因爲它不涉及編程或開發。請參閱幫助中心的[我可以詢問哪些主題](http://stackoverflow.com/help/on-topic)。 – jww

回答

1

您可以通過編輯您的OMNeT++靜態庫選項避免依賴於本地OMNeT++庫(例如liboppenvird.soliboppsimd.so等)。爲了從主OMNeT++目錄,並設置爲此打開configure.user
SHARED_LIBS=no
然後重建你的OMNeT ++(make clean./configuremake)。接下來重建您的項目。 舉例tictoc

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

然後ldd tictoc將顯示:

[email protected]:/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庫:

[email protected]:/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) 
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的機器上:

enter image description here

正如你所看到的,opp_run需要很多共享庫,你需要把它們都安裝在目標機器上。

我也在Linux服務器上運行我的OMNET模擬(Ubuntu 14服務器)。但是我在我的home文件夾中安裝了OMNET(不需要sudo訪問),並且可以使用上述命令運行模擬(假設您已安裝了所有必需的庫)。檢查OMNET安裝guide以檢查您的系統上需要哪些軟件包。