sudo apt-get install build-essential autoconf automake libxmu-dev
出現libotcl.so error的問題
ld -shared -o libotcl.so otcl.o
otcl.o: In function `OTclDispatch':
/xxxx/ns-allinone-2.34/otcl-1.13/otcl.c:495: undefined reference to `__stack_chk_fail_local'
otcl.o: In function `Otcl_Init':
/xxxx/ns-allinone-2.34/otcl-1.13/otcl.c:2284: undefined reference to `__stack_chk_fail_local'
ld: libotcl.so: hidden symbol `__stack_chk_fail_local' isn't defined
ld: final link failed: Nonrepresentable section on output
make: *** [libotcl.so] error 1
otcl-1.13 make failed! Exiting ...
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems
解決方式為修改二個設定檔
cd /xxxx/ns-allinone-2.34/otcl-1.13
vim configure.in
把第77行的
SHLIB_LD="ld -shared"
修改成
SHLIB_LD="gcc -shared"
存檔後退出
vim configure
第6304行附近
Linux*)
SHLIB_CFLAGS="-fpic"
SHLIB_LD="gcc -shared"
SHLIB_SUFFIX=".so"
DL_LIBS="-ldl"
SHLD_FLAGS=""
把
SHLIB_LD="ld -shared"
修改成
SHLIB_LD="gcc -shared"
存檔後退出
開始安裝
回到ns-allinone-2.34目錄下執行安裝
cd /xxxx/ns-allinone-2.34
./install
安裝完成後的設定
Please put /xxxx/ns-allinone-2.34/bin:/xxxx/ns-allinone-2.34/tcl8.4.18/unix:/xxxx/ns-allinone-2.34/tk8.4.18/unix
into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.
IMPORTANT NOTICES:
(1) You MUST put /xxxx/ns-allinone-2.34/otcl-1.13, /xxxx/ns-allinone-2.34/lib,
into your LD_LIBRARY_PATH environment variable.
If it complains about X libraries, add path to your X libraries
into LD_LIBRARY_PATH.
If you are using csh, you can set it like:
setenv LD_LIBRARY_PATH
If you are using sh, you can set it like:
export LD_LIBRARY_PATH=
(2) You MUST put /xxxx/ns-allinone-2.34/tcl8.4.18/library into your TCL_LIBRARY environmental
variable. Otherwise ns/nam will complain during startup.
簡單來說就是在~/.bashrc加上三行
vim ~/.bashrc
export PATH="$PATH:/xxxx/ns-allinone-2.34/bin:/xxxx/ns-allinone-2.34/tcl8.4.18/unix:/xxxx/ns-allinone-2.34/tk8.4.18/unix"
export LD_LIBRARY_PATH="/xxxx/ns-allinone-2.34/otcl-1.13:/xxxx/ns-allinone-2.34/lib"
export TCL_LIBRARY="/xxxx/ns-allinone-2.34/tcl8.4.18/library"
若是要讓所有人可以使用的話加在/etc/profile這個檔案。
設定完成後記得重新登入。
安裝及設定完成後的測試
After these steps, you can now run the ns validation suite with
cd ns-2.34; ./validate
或是運行sample.tcl亦可
ns /xxxx/ns-allinone-2.34/ns-2.34/tcl/ex/simple.tcl
沒有留言:
張貼留言