Xgraph is not considered important, that's why " ./install "
just ignores it by errors. ( xgraph files = 9 years old.)
It may be possible to compile it, by using the Ubuntu patch ?
http://packages.ubuntu.com/karmic/xgraph
[xgraph_12.1-11.diff.gz]
But much easier is :
sudo apt-get install xgraph ygraph
'ygraph' is a modern, more advanced tool ..
http://packages.ubuntu.com/karmic/ygraph
.....
==================== 上面的是ubuntu下的解决办法
问题是在fedora 下使用yum install xgraph不能找到xgraph的安装包
解决办法:
进入未编译的ns-allinone-2.33/xgraph-12.1目录下
敲./configrue
接着make
但是出现如下错误;
--------------------------------------------------------------------------
[root@cj xgraph-12.1]# make
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -c xgraph.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -c xgX.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -c hard_devices.c
gcc -DHAVE_CONFIG_H -I. -I. -I. -g -c dialog.c
dialog.c: 在函数‘make_msg_box’中:
dialog.c:780: 警告:传递‘getline’的第 2 个参数时在不兼容的指针类型间转换
/usr/include/stdio.h:653: 附注:需要类型‘size_t * __restrict__’,但实参的类型为‘char *’
dialog.c:780: 错误:提供给函数‘getline’的实参太少
dialog.c: 在函数‘getline’中:
dialog.c:899: 错误:实参‘lptr’与原型不符
/usr/include/stdio.h:653: 错误:原型声明
dialog.c:899: 错误:实参数目与原型不符
/usr/include/stdio.h:653: 错误:原型声明
make: *** [dialog.o] 错误 1
----------------------------------------------------------------------
原因:
The standard lib (stdio.h) function getline has been redefined in <installdir>/ns-allinone-2.31/xgraph-12.1/dialog.c. Quick fix: Edit the file and change the two references to getline to something else, e.g. getmyline. Then the program builds...
就是说,把dialog.c中的 所有geline替换成getmyline
接着make.
make完后
make install
别忘了在.bashrc 中添加环境变量哦。
如下:
OTCL_LIB=/home/cj/ns-allinone-2.33/otcl-1.13 NS2_LIB=/home/cj/ns-allinone-2.33/lib X11_LIB=/usr/X11R6/lib USR_LOCAL_LIB=/usr/local/lib export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OTCL_LIB:$NS2_LIB:$X11_LIB:$USR_LOCAL_LIB #TCL_LIBRARY TCL_LIB=/home/cj/ns-allinone-2.33/tcl8.4.18/library USR_LIB=/usr/lib export TCL_LIBRARY=$TCL_LIB:$USR_LIB #PATH XGRAPH=/home/cj/ns-allinone-2.33/bin:/home/cj/ns-allinone-2.33/tcl8.4.18/unix:/home/cj/ns-allinone-2.33/tk8.4.18/unix NS=/home/cj/ns-allinone-2.33/ns-2.33 TCL=/home/cj/ns-allinone-2.33/tcl8.4.18/library NS_=/usr/local/bin PATH=$PATH:$XGRAPH:$NAM:$TCL_:NS_ #fin pour NS2
别忘了把用户名换成你自己的: )
测试:
进入ns-allinone-2.33/xgraph-12.1/examples目录下
敲:
xgraph bar.xg
你会看到如下形:
success
enjoy it!