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!