Yarang's Home

Ubuntu에서 설치하면서 다음과 같은 에러가 나타난다.
otcl에서 발생하는 에러는

checking for ranlib... ranlib
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking system version (for dynamic loading)... ./configure: line
5986: syntax error near unexpected token `('
./configure: line 5986: `echo "on `(hostname || uname -n) 2>/dev/null
| sed 1q`" >&5'

위의 에러에 대해서 해결하는 패치는 다음의 내용이다.

--- configure   8 May 2005 22:37:17 -0000       1.1
+++ configure   8 Jun 2006 21:31:12 -0000       1.2
@@ -5082,7 +5082,7 @@
     # results, and the version is kept in special file).

     if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
-        system=MP-RAS-`awk '{print $3}' /etc/.relid'`
+        system=MP-RAS-`awk '{print $3}' /etc/.relid`
     fi
     echo "$as_me:$LINENO: result: $system" >&5
echo "${ECHO_T}$system" >&6


ns-2.28에서 발생하는 에러는 다음과 같다.

./mobile/god.h:88: error: extra qualification ‘vector::’ on member ‘operator=’
./mobile/god.h:93: error: extra qualification ‘vector::’ on member ‘operator+=’
./mobile/god.h:98: error: extra qualification ‘vector::’ on member ‘operator==’
./mobile/god.h:101: error: extra qualification ‘vector::’ on member ‘operator!=’

이에 대한 해결책은

hahoje@hahoje-desktop:~/ns-allinone-2.28$ vi ns-2.28/mobile/god.h

        inline void vector::operator=(const vector a) {
                X = a.X;
                Y = a.Y;
                Z = a.Z;
        }
        inline void vector::operator+=(const vector a) {
                X += a.X;
                Y += a.Y;
                Z += a.Z;
        }
        inline int vector::operator==(const vector a) {
                return (X == a.X && Y == a.Y && Z == a.Z);
        }
        inline int vector::operator!=(const vector a) {
                return (X != a.X || Y != a.Y || Z != a.Z);
        }

위의 내용을

        inline void operator=(const vector a) {
                X = a.X;
                Y = a.Y;
                Z = a.Z;
        }
        inline void operator+=(const vector a) {
                X += a.X;
                Y += a.Y;
                Z += a.Z;
        }
        inline int operator==(const vector a) {
                return (X == a.X && Y == a.Y && Z == a.Z);
        }
        inline int operator!=(const vector a) {
                return (X != a.X || Y != a.Y || Z != a.Z);
        }

와 같이 수정하는 것이다.


PageRank
이올린에 북마크하기
2007/08/27 22:44 2007/08/27 22:44

[ns2] FC5에 설치하기

2006/09/23 18:02

Fecora Core 5에 설치하기 위해서는 ns-allinone-2.29.3.tar.gz 파일이 필요하다.
이전 버전의 경우에는 컴파일러와 충돌이 일어나서 설치가 이루어지지 않을 수도 있다.
  1. 다운로드하기

  2. 압축해제하기
    다운받은 파일의 압축을 해제한다.
    tar zxfv ns-allinone-2.29.3.tar.gz

  3. 설치하기
    압축을 해제한 디렉토리에서 install 명령을 실행하기
    ./install

  4. 환경설정하기
    ~/.bashrc 파일이나 ~/.basr_profile 디렉토리에서 NS2를 위한 설정을 한다.
    PATH=$PATH:$HOME/bin:~/ns-allinone-2.29/bin:~/ns-allinone-2.29/tcl8.4.11/unix:~/ns-allinone-2.29/tk8.4.11/unix
    LD_LIBRARY_PATH=~/ns-allinone-2.29/otcl-1.11:~/ns-allinone-2.29/lib
    TCL_LIBRARY=~/ns-allinone-2.29/tcl8.4.11/library

    export PATH LD_LIBRARY_PATH TCL_LIBRARY

  5. NS2의 실행
    ns

PageRank
이올린에 북마크하기(0) 이올린에 추천하기(0)
2006/09/23 18:02 2006/09/23 18:02
목적 : 무선 애드혹 네트워크를 시뮬레이션하기 위한 기본적인 TCL의 작성과 실행.

개요 : 다수의 무선 노드들이 802.15.4를 통해서 CBR 패킷을 주고 받는 것

구성 :
   1. 무선 노드의 수 : 10
   2. 시뮬레이션 공간 : 200 X 200
   3. 노드의 MAC 레이어 : IEEE 802.15.4
   4. 노드의 통신 방법 : UDP를 통한 CBR 트래픽
   5. 시뮬레이션 시간 : 50초
   6. 라우팅 프로토콜은 AODV를 사용한다.
   7. 연결할 노드들은 다음과 같다.
       1) 노드 0과 노드 5
       2) 노드 3과 노드 8
       
필수요소 :
  1. trace 파일의 생성
  2. nam 파일의 생성
  3. cbr 연결의 2개 이상 생성.
위의 tcl 파일을 받아서 수정하도록 하시기 바랍니다. ^^
그리고 예제 파일로 simple-wireless.tcl 파일을 올리겠습니다.


PageRank
이올린에 북마크하기
2006/03/02 22:05 2006/03/02 22:05

NS2 사용하기

2006/03/02 19:30

NS2(Network Simulator)는 오픈 소스로 개발되어 소스가 공개되어 있고 무료로 사용이 가능한 네트워크 시뮬레이션 프로그램이다. 리눅스 기반의 환경에서 잘 동작한다.

이 프로그램은 홈페이지에서 다운로드가 가능하다. 홈페이지에서 다운로드를 할 때에 일반 사용자 계정에서 사용할 것을 권장하며, ns2만이 아닌 ns2-allinone 패키지의 다운로드를 권장한다.

ns2만을 다운로드할 경우 다른 tcl 패키지가 시스템에 적당하게 설치되어 있어야 한다. 하지만 ns2-allinone의 경우에는 시스템에 설치된 tcl의 버전과 상관없이 ns2-allinone에 포함된 버전으로 컴파일과 설치가 진행되기 때문에 독립적으로 컴파일하고 동작이 가능하도록 되어있다.

ns2-allinone의 설치 방법은 다음과 같다.

먼저 ns2-allinone의 압축을 푼다. 여기에서는 ns-allinone-2.2.8.tar.gz 파일의 압축을 푼다.

[yarang@wuc235 ~]$ tar zxf simul/ns-allinone-2.28.tar.gz
[yarang@wuc235 ~]$ cd ns-allinone-2.28
[yarang@wuc235 ns-allinone-2.28]$ ls
INSTALL.WIN32  cweb    install   ns-2.28   sgb       tclcl-1.16  xgraph-12.1
README         gt-itm  nam-1.11  otcl-1.9  tcl8.4.5  tk8.4.5     zlib-1.1.4

설치를 진행하기 전에 페도라 코어 4의 gcc 버전에 적합한 패치를 해주어야 한다. gcc의 버전을 확인하는 명령은 다음과 같다.

[yarang@wuc235 ns-2.28]$ gcc --version
gcc (GCC) 4.0.2 20051125 (Red Hat 4.0.2-8)
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

위에서와 같이 페도라 코어 4는 gcc 4.0.2를 사용하고 있다. 그래서 ns2를 컴파일해주기 위해서 gcc 버전에 맞도록 패치를 해주어야 한다. ns228-gcc40.patch 파일은 ns2-2.28 버전에 gcc 4.0에 대한 패치를 적용하는 파일이다. 패치는 다음과 같은 명령으로 가능하다.


[yarang@wuc235 ns-allinone-2.28]$ patch -p1 < ../simul/ns228-gcc40.patch
patching file nam-1.11/agent.h
patching file ns-2.28/diffusion3/lib/nr/nr.hh
patching file ns-2.28/xcp/xcpq.cc
patching file ns-2.28/xcp/xcpq.h

위의 패치를 적용한다 하더라도 컴파일을 하면 다음과 같은 에러가 발생한다. 페도라 코어 4에서 아래와 같은 에러가 발생하면 수동으로 파일을 수정해 주어야 한다. 에러가 발생한 것은 다음과 같을 것이다.

g++ -c -DTCP_DELAY_BIND_ALL -DNO_TK -DTCLCL_CLASSINSTVAR -DNDEBUG -DLINUX_TCP_HEADER -DUSE_SHM -DHAVE_LIBTCLCL -DHAVE_TCLCL_H -DHAVE_LIBOTCL1_9 -DHAVE_OTCL_H -DHAVE_LIBTK8_4 -DHAVE_TK_H -DHAVE_LIBTCL8_4 -DHAVE_TCL_H -DHAVE_CONFIG_H -DNS_DIFFUSION -DSMAC_NO_SYNC -DCPP_NAMESPACE=std -DUSE_SINGLE_ADDRESS_SPACE -Drng_test -I. -I/home/users/yarang/ns-allinone-2.28/tclcl-1.16 -I/home/users/yarang/ns-allinone-2.28/otcl-1.9 -I/home/users/yarang/ns-allinone-2.28/include -I/home/users/yarang/ns-allinone-2.28/include -I/usr/include/pcap -I./tcp -I./sctp -I./common -I./link -I./queue -I./adc -I./apps -I./mac -I./mobile -I./trace -I./routing -I./tools -I./classifier -I./mcast -I./diffusion3/lib/main -I./diffusion3/lib -I./diffusion3/lib/nr -I./diffusion3/ns -I./diffusion3/filter_core -I./asim/ -I./qs -I./diffserv -I./wpan -o queue/cbq.o queue/cbq.cc
queue/cbq.cc:112: error: ISO C++ forbids declaration of #CBQueue# with no type
queue/cbq.cc:112: error: expected #;# before #*# token
queue/cbq.cc: In member function #virtual int CBQueue::insert_class(CBQClass*)#:
queue/cbq.cc:488: error: #class CBQClass# has no member named #cbq_#
queue/cbq.cc: In constructor #CBQClass::CBQClass()#:
queue/cbq.cc:805: error: class #CBQClass# does not have any field named #cbq_#
queue/cbq.cc: In member function #virtual void CBQClass::recv(Packet*, Handler*)#:
queue/cbq.cc:850: error: #cbq_# was not declared in this scope
queue/cbq.cc:856: error: #cbq_# was not declared in this scope
queue/cbq.cc: In member function #void CBQClass::update(Packet*, double)#:
queue/cbq.cc:873: error: #cbq_# was not declared in this scope
queue/cbq.cc: In member function #int CBQClass::desc_with_demand()#:
queue/cbq.cc:928: error: #cbq_# was not declared in this scope
queue/cbq.cc: In member function #void CBQClass::newallot(double)#:
queue/cbq.cc:975: error: #cbq_# was not declared in this scope
queue/cbq.cc: In member function #virtual int CBQClass::command(int, const char* const*)#:
queue/cbq.cc:1002: error: #cbq_# was not declared in this scope
make: *** [queue/cbq.o] ## 1
Ns make failed!
See http://www.isi.edu/nsnam/ns/ns-problems.html for problems
[yarang@wuc235 ns-allinone-2.28]$

위의 에러가 발생하면 직접 소스를 고쳐야 하는데 고쳐야 하는 소스와 위치는 다음과 같다. 모든 소스는 ns2-2.28 디렉토리에 있으며 고쳐야 하는 소스의 부분은 다음과 같다.

파일 : queue/cbq.cc
    88 #define POWEROFTWO  16
    89
    90 class CBQueue; <-- 추가된 부분
    91
    92 class CBQClass : public Connector

파일 : tora/tora_neighbor.h
    46     LINK_DN = 0x0002,   // downstream
    47     LINK_UN = 0x0004,   // undirected
    48 };
    49
    50 class toraAgent; <-- 추가된 부분
    51
    52 class TORANeighbor {
    53     friend class TORADest;
    54     friend class toraAgent;

파일 : diffusion3/filter_core/filter_core.hh
103 typedef list NeighborList;
104 typedef list HashList;
105 typedef list BlackList;
106
107 class DiffRoutingAgent; <-- 추가된 부분
108
109 class DiffusionCoreAgent {
110 public:
111 #ifdef NS_DIFFUSION
112 friend class DiffRoutingAgent;

위의 파일들을 수정한 다음에 다시 설치 명령을 실행하면 컴파일이 다시 시작된다.

[yarang@wuc235 ns-allinone-2.28]$ ./install

모든 컴파일을 성공하면 다음과 같은 메시지가 나온다.

Please compile your gt-itm & sgb2ns separately.
Ns-allinone package has been installed successfully.
Here are the installation places:
tcl8.4.5: /home/users/yarang/ns-allinone-2.28/{bin,include,lib}
tk8.4.5: /home/users/yarang/ns-allinone-2.28/{bin,include,lib}
otcl: /home/users/yarang/ns-allinone-2.28/otcl-1.9
tclcl: /home/users/yarang/ns-allinone-2.28/tclcl-1.16
ns: /home/users/yarang/ns-allinone-2.28/ns-2.28/ns
nam: /home/users/yarang/ns-allinone-2.28/nam-1.11/nam
xgraph: /home/users/yarang/ns-allinone-2.28/xgraph-12.1

----------------------------------------------------------------------------------

Please put /home/users/yarang/ns-allinone-2.28/bin:/home/users/yarang/ns-allinone-2.28/tcl8.4.5/unix:/home/users/yarang/ns-allinone-2.28/tk8.4.5/unix
into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.

IMPORTANT NOTICES:

(1) You MUST put /home/users/yarang/ns-allinone-2.28/otcl-1.9, /home/users/yarang/ns-allinone-2.28/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 /home/users/yarang/ns-allinone-2.28/tcl8.4.5/library into your TCL_LIBRARY environmental
variable. Otherwise ns/nam will complain during startup.

(3) [OPTIONAL] To save disk space, you can now delete directories tcl8.4.5
and tk8.4.5. They are now installed under /home/users/yarang/ns-allinone-2.28/{bin,include,lib}

After these steps, you can now run the ns validation suite with
cd ns-2.28; ./validate

For trouble shooting, please first read ns problems page
http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive
for related posts.


그리고 PATH를 추가하기 위해서 다음과 같은 설정을 .bash_profile에 넣어준다.

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=/usr/java/j2sdk1.4.2_04/bin:~/ns-allinone-2.28/bin:~/ns-allinone-2.28/tcl8.4.5/unix:~/ns-allinone-2.28/tk8.4.5/unix:$PATH:$HOME/bin
LD_LIBRARY_PATH=~/ns-allinone-2.28/otcl-1.9:~/ns-allinone-2.28/lib
TCL_LIBRARY=~/ns-allinone-2.28/tcl8.4.5/library

export PATH LD_LIBRARY_PATH TCL_LIBRARY
unset USERNAME

잘보면 위에서는 /home/users/yarang/이라고 명시된 부분이 아래에서는 ~/로 변경되어 있을 것이다. 사용자의 홈 디렉토리가 /home/users/yarang/ 이기 때문에 이와 동일한 ~/로 변경하여 보여준 것이다. 그러므로 이 둘은 동일하게 작동한다. 하지만 다른 사용자가 설치한 경우에는 홈 디렉토리의 위치가 변경되기 때문에 ~/를 사용한 경우에는 사용자가 변경되어도 설정을 변경없이 사용이 가능하다.

PageRank
이올린에 북마크하기
2006/03/02 19:30 2006/03/02 19:30