NS安装问题集锦

来源:互联网 发布:c#windows图片查看器 编辑:程序博客网 时间:2024/04/28 10:13

转自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 1tk8.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 directoryContinuing with default options...checking build system type... i686-pc-linux-gnuchecking host system type... i686-pc-linux-gnuchecking target system type... i686-pc-linux-gnuchecking for gcc... gccchecking for C compiler default output file name... a.outchecking whether the C compiler works... yeschecking whether we are cross compiling... nochecking for suffix of executables... checking for suffix of object files... ochecking whether we are using the GNU C compiler... yeschecking whether gcc accepts -g... yeschecking for gcc option to accept ISO C89... none neededchecking for g++... g++checking whether we are using the GNU C++ compiler... yeschecking whether g++ accepts -g... yeschecking how to run the C preprocessor... gcc -Echecking for grep that handles long lines and -e... /bin/grepchecking for egrep... /bin/grep -Echecking for ANSI C header files... yeschecking for sys/types.h... yeschecking for sys/stat.h... yeschecking for stdlib.h... yeschecking for string.h... yeschecking for memory.h... yeschecking for strings.h... yeschecking for inttypes.h... yeschecking for stdint.h... yeschecking for unistd.h... yeschecking for string.h... (cached) yeschecking for main in -lXbsd... nochecking for socket in -lsocket... nochecking for gethostbyname in -lnsl... yeschecking for dcgettext in -lintl... nochecking for getnodebyname in -ldnet_stub... nochecking that g++ can handle -O2... nochecking standard STL is available... nochecking for tcl.h... -I../includechecking for tclInt.h... -I../includechecking for libtcl8.4... -L../lib -ltcl8.4checking for init.tcl... ../lib/tcl8.4checking for http.tcl... ../lib/tcl8.4/http1.0checking Tcl http.tcl library... yeschecking for tclsh8.4.18... nochecking for tclsh8.4... ../bin/tclsh8.4checking for tk.h... -I../includechecking for libtk8.4... -L../lib -ltk8.4checking for tk.tcl... ../lib/tk8.4checking for X11 header fileschecking for X11 library archivechecking for XOpenDisplay in -lX11... yeschecking for XShmAttach in -lXext... yeschecking for ranlib... ranlibchecking for a BSD-compatible install... /usr/bin/install -cchecking system version (for dynamic loading)... Linux-2.6.31-14-genericNo explicit static compilation flag; setting V_STATIC to ""checking for dlopen in -ldl... yeschecking for a BSD-compatible install... /usr/bin/install -cconfigure: creating ./config.statusconfig.status: creating Makefilerm -f libotcl.so otcl.o so_locationsgcc -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.cld -shared -o libotcl.so otcl.ootcl.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 definedld: final link failed: Nonrepresentable section on outputmake: *** [libotcl.so] Error 1otcl-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.