NS安装问题集锦

转自http://blog.csdn.net/windows00/archive/2009/12/08/4967801.aspx
个人觉得写得不错,希望能给大家带来帮助 
初次安装NS2可能会遇到一些问题。为了顺利安装,在这篇文章中,我叙述了在安装NS2的过程中所遇到的问题,以及解决这些问题的办法。

描述

  • 虚拟机环境:VirtualBox 3.1.0 r55467
  • 操作系统:ubuntu-9.10-desktop-i386.iso
  • NS2版本:The Network Simulator - ns-2 (ns-allinone-2.34)

问题1

    在安装NS2的过程中,可能会出现如下的错误信息:

 

  1. eneric/tk3d.c:242: error: ‘None’ undeclared (first use in  this  function)  
  2. /media/Software/Quyettong/linux/soflware/ns2/ns-allinone-2.34/tk8.4.18/unix/../generic/tk3d.c:243: error: ‘  
  3.   
  4. TkBorder’ has no member named ‘bgGC’  
  5. /media/Software/Quyettong/linux/soflware/ns2/ns-allinone-2.34/tk8.4.18/unix/../generic/tk3d.c:244: error: ‘  
  6.   
  7. TkBorder’ has no member named ‘darkGC’  
  8. /media/Software/Quyettong/linux/soflware/ns2/ns-allinone-2.34/tk8.4.18/unix/../generic/tk3d.c:245: error: ‘  
  9.   
  10. TkBorder’ has no member named ‘lightGC’  
  11. /media/Software/Quyettong/linux/soflware/ns2/ns-allinone-2.34/tk8.4.18/unix/../generic/tk3d.c:246: error: ‘  
  12.   
  13. TkBorder’ has no member named ‘hashPtr’  
  14. ...........................................  
  15. ...........................................  
  16. eneric/tk3d.c:1400: error: ‘TkBorder’ has no member named ‘nextPtr’  
  17. /media/Software/Quyettong/linux/soflware/ns2/ns-allinone-2.34/tk8.4.18/unix/../generic/tk3d.c:1403: error:   
  18.   
  19. ‘TkBorder’ has no member named ‘resourceRefCount’  
  20. /media/Software/Quyettong/linux/soflware/ns2/ns-allinone-2.34/tk8.4.18/unix/../generic/tk3d.c:1405: error:   
  21.   
  22. ‘TkBorder’ has no member named ‘objRefCount’  
  23. make: *** [tk3d.o] Error 1  
  24. tk8.4.18 make failed! Exiting ...  

eneric/tk3d.c:242: error: ‘None’ undeclared (first use in this function) /media/Software/Quyettong/linux/soflware/ns2/ns-allinone-2.34/tk8.4.18/unix/../generic/tk3d.c:243: error: ‘ TkBorder’ has no member named ‘bgGC’ /media/Software/Quyettong/linux/soflware/ns2/ns-allinone-2.34/tk8.4.18/unix/../generic/tk3d.c:244: error: ‘ TkBorder’ has no member named ‘darkGC’ /media/Software/Quyettong/linux/soflware/ns2/ns-allinone-2.34/tk8.4.18/unix/../generic/tk3d.c:245: error: ‘ TkBorder’ has no member named ‘lightGC’ /media/Software/Quyettong/linux/soflware/ns2/ns-allinone-2.34/tk8.4.18/unix/../generic/tk3d.c:246: error: ‘ TkBorder’ has no member named ‘hashPtr’ ........................................... ........................................... eneric/tk3d.c:1400: error: ‘TkBorder’ has no member named ‘nextPtr’ /media/Software/Quyettong/linux/soflware/ns2/ns-allinone-2.34/tk8.4.18/unix/../generic/tk3d.c:1403: error: ‘TkBorder’ has no member named ‘resourceRefCount’ /media/Software/Quyettong/linux/soflware/ns2/ns-allinone-2.34/tk8.4.18/unix/../generic/tk3d.c:1405: error: ‘TkBorder’ has no member named ‘objRefCount’ make: *** [tk3d.o] Error 1 tk8.4.18 make failed! Exiting ...

原因

    The required packages are :

 

  1. libx11-dev , libxmu-dev , libxmu-headers , libxt-dev , libtool  

libx11-dev , libxmu-dev , libxmu-headers , libxt-dev , libtool

    参考:http://www.linuxquestions.org/questions/linux-newbie-8/ns-allinone-on-ubuntu-offline-765055/

解决方法

    依次更新或者安装以上的程序包。完成后,执行"./install"

问题2

    上面的问题解决好以后,可能会出现如下错误信息:

 

  1. No .configure file found  in  current directory  
  2. Continuing with default  options...  
  3. checking build system type... i686-pc-linux-gnu  
  4. checking host system type... i686-pc-linux-gnu  
  5. checking target system type... i686-pc-linux-gnu  
  6. checking for  gcc... gcc  
  7. checking for  C compiler  default  output file name... a. out   
  8. checking whether the C compiler works... yes  
  9. checking whether we are cross compiling... no  
  10. checking for  suffix of executables...   
  11. checking for  suffix of  object  files... o  
  12. checking whether we are using  the GNU C compiler... yes  
  13. checking whether gcc accepts -g... yes  
  14. checking for  gcc option to accept ISO C89... none needed  
  15. checking for  g++... g++  
  16. checking whether we are using  the GNU C++ compiler... yes  
  17. checking whether g++ accepts -g... yes  
  18. checking how to run the C preprocessor... gcc -E  
  19. checking for  grep that handles  long  lines and -e... /bin/grep  
  20. checking for  egrep... /bin/grep -E  
  21. checking for  ANSI C header files... yes  
  22. checking for  sys/types.h... yes  
  23. checking for  sys/stat.h... yes  
  24. checking for  stdlib.h... yes  
  25. checking for   string .h... yes  
  26. checking for  memory.h... yes  
  27. checking for  strings.h... yes  
  28. checking for  inttypes.h... yes  
  29. checking for  stdint.h... yes  
  30. checking for  unistd.h... yes  
  31. checking for   string .h... (cached) yes  
  32. checking for  main  in  -lXbsd... no  
  33. checking for  socket  in  -lsocket... no  
  34. checking for  gethostbyname  in  -lnsl... yes  
  35. checking for  dcgettext  in  -lintl... no  
  36. checking for  getnodebyname  in  -ldnet_stub... no  
  37. checking that g++ can handle -O2... no  
  38. checking standard STL is  available... no  
  39. checking for  tcl.h... -I../include  
  40. checking for  tclInt.h... -I../include  
  41. checking for  libtcl8.4... -L../lib -ltcl8.4  
  42. checking for  init.tcl... ../lib/tcl8.4  
  43. checking for  http.tcl... ../lib/tcl8.4/http1.0  
  44. checking Tcl http.tcl library... yes  
  45. checking for  tclsh8.4.18... no  
  46. checking for  tclsh8.4... ../bin/tclsh8.4  
  47. checking for  tk.h... -I../include  
  48. checking for  libtk8.4... -L../lib -ltk8.4  
  49. checking for  tk.tcl... ../lib/tk8.4  
  50. checking for  X11 header files  
  51. checking for  X11 library archive  
  52. checking for  XOpenDisplay  in  -lX11... yes  
  53. checking for  XShmAttach  in  -lXext... yes  
  54. checking for  ranlib... ranlib  
  55. checking for  a BSD-compatible install... /usr/bin/install -c  
  56. checking system version (for  dynamic loading)... Linux-2.6.31-14-generic  
  57. No explicit   static  compilation flag; setting V_STATIC to  ""   
  58. checking for  dlopen  in  -ldl... yes  
  59. checking for  a BSD-compatible install... /usr/bin/install -c  
  60. configure: creating ./config.status  
  61. config.status: creating Makefile  
  62. rm -f libotcl.so otcl.o so_locations  
  63. gcc -c -g -O2 -DNDEBUG -DUSE_SHM -fpic -I. -I/home /pengyicun/桌面/ns-allinone-2.34/include -  
  64.   
  65. I/home/pengyicun/桌面/ns-allinone-2.34/include -I/home /pengyicun/桌面/ns-allinone-2.34/include -I/include    
  66.   
  67. otcl.c  
  68. ld -shared -o libotcl.so otcl.o  
  69. otcl.o: In function `OTclDispatch':  
  70. /home/pengyicun/桌面/ns-allinone-2.34/otcl-1.13 /otcl.c:495: undefined reference to `__stack_chk_fail_local'  
  71. otcl.o: In function `Otcl_Init':  
  72. /home/pengyicun/桌面/ns-allinone-2.34/otcl-1.13 /otcl.c:2284: undefined reference to `__stack_chk_fail_local'  
  73. ld: libotcl.so: hidden symbol `__stack_chk_fail_local' isn' t defined  
  74. ld: final link failed: Nonrepresentable section on output  
  75. make: *** [libotcl.so] Error 1  
  76. otcl-1.13 make failed! Exiting ...  

No .configure file found in current directory Continuing with default options... checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ISO C89... none needed checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking how to run the C preprocessor... gcc -E checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking for string.h... (cached) yes checking for main in -lXbsd... no checking for socket in -lsocket... no checking for gethostbyname in -lnsl... yes checking for dcgettext in -lintl... no checking for getnodebyname in -ldnet_stub... no checking that g++ can handle -O2... no checking standard STL is available... no checking for tcl.h... -I../include checking for tclInt.h... -I../include checking for libtcl8.4... -L../lib -ltcl8.4 checking for init.tcl... ../lib/tcl8.4 checking for http.tcl... ../lib/tcl8.4/http1.0 checking Tcl http.tcl library... yes checking for tclsh8.4.18... no checking for tclsh8.4... ../bin/tclsh8.4 checking for tk.h... -I../include checking for libtk8.4... -L../lib -ltk8.4 checking for tk.tcl... ../lib/tk8.4 checking for X11 header files checking for X11 library archive checking for XOpenDisplay in -lX11... yes checking for XShmAttach in -lXext... yes checking for ranlib... ranlib checking for a BSD-compatible install... /usr/bin/install -c checking system version (for dynamic loading)... Linux-2.6.31-14-generic No explicit static compilation flag; setting V_STATIC to "" checking for dlopen in -ldl... yes checking for a BSD-compatible install... /usr/bin/install -c configure: creating ./config.status config.status: creating Makefile rm -f libotcl.so otcl.o so_locations gcc -c -g -O2 -DNDEBUG -DUSE_SHM -fpic -I. -I/home/pengyicun/桌面/ns-allinone-2.34/include - I/home/pengyicun/桌面/ns-allinone-2.34/include -I/home/pengyicun/桌面/ns-allinone-2.34/include -I/include otcl.c ld -shared -o libotcl.so otcl.o otcl.o: In function `OTclDispatch': /home/pengyicun/桌面/ns-allinone-2.34/otcl-1.13/otcl.c:495: undefined reference to `__stack_chk_fail_local' otcl.o: In function `Otcl_Init': /home/pengyicun/桌面/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 ...

原因

    gcc 4.0版本以前是用"ld -share"来生成共享库的,但是到了4.0以上的版本(我的为gcc version 4.4.1),这个命令改为"gcc -share"即可

解决方法

    把ns-allinone-2.33/otcl-1.13文件夹下的configure.in及configure中的"ld -shared"替换成"gcc -shared",并保存。回到ns-allinone-2.33/目录重新运行"./install"

    参考:http://blog.sina.com.cn/s/blog_4d1bbec70100gkjh.html

最后结果

    安装过程时间持续比较长(大约20min),需要耐心等待,如果正确安装会出现如下信息:

 

  1. Ns-allinone package has been installed successfully.  
  2. Here are the installation places:  
  3. tcl8.4.18: /home/pengyicun/桌面/ns-allinone-2.34 /{bin,include,lib}  
  4. tk8.4.18:  /home /pengyicun/桌面/ns-allinone-2.34/{bin,include,lib}  
  5. otcl:  /home/pengyicun/桌面/ns-allinone-2.34/otcl-1.13  
  6. tclcl:  /home/pengyicun/桌面/ns-allinone-2.34/tclcl-1.19  
  7. ns:  /home/pengyicun/桌面/ns-allinone-2.34/ns-2.34/ns  
  8. nam: /home/pengyicun/桌面/ns-allinone-2.34/nam-1.14/nam  
  9. gt-itm:   /home/pengyicun/桌面/ns-allinone-2.34 /itm, edriver, sgb2alt, sgb2ns, sgb2comns, sgb2hierns  
  10.   
  11. ----------------------------------------------------------------------------------  
  12.   
  13. Please put /home /pengyicun/桌面/ns-allinone-2.34/bin:/home/pengyicun/桌面/ns-allinone-  
  14.   
  15. 2.34/tcl8.4.18/unix: /home/pengyicun/桌面/ns-allinone-2.34/tk8.4.18/unix  
  16. into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.  
  17.   
  18. IMPORTANT NOTICES:  
  19.   
  20. (1) You MUST put /home /pengyicun/桌面/ns-allinone-2.34/otcl-1.13, /home/pengyicun/桌面/ns- allinone-2.34/lib,   
  21.     into your LD_LIBRARY_PATH environment variable.  
  22.     If it complains about X libraries, add path to your X libraries   
  23.     into LD_LIBRARY_PATH.  
  24.     If you are using  csh, you can  set  it like:  
  25.   setenv LD_LIBRARY_PATH <paths>  
  26.     If you are using  sh, you can  set  it like:  
  27.   export LD_LIBRARY_PATH=<paths>  
  28.   
  29. (2) You MUST put /home /pengyicun/桌面/ns-allinone-2.34/tcl8.4.18 /library into your TCL_LIBRARY environmental  
  30.     variable. Otherwise ns/nam will complain during startup.  
  31.   
  32.   
  33. After these steps, you can now run the ns validation suite with  
  34. cd ns-2.34; ./validate  
  35.   
  36. For trouble shooting, please first read ns problems page   
  37. http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive   
  38. for  related posts. 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值