trema / trema-edge

Transient repository for Trema OF1.3 branch
27 stars 14 forks source link

make失敗およびlearning-switchの実行失敗 #43

Closed ikeuchi closed 11 years ago

ikeuchi commented 11 years ago

現在、Trema-Edgeのインストールと動作確認を行なっております。 その中でlearning-switchのコンパイルおよび実行におきまして、 以下の様な問題を発見したのでご報告させて頂きます。

環境

Description:    Ubuntu 12.10
Release:        12.10
Ruby:           2.0.0p0 (2013-02-24 revision 39474)

問題事象

①src配下でmakeを実行すると失敗する。
②learning_switch.sh実行でエラーになる

手順 (1)GitからTrema-Edgeを落としインストール実施 (2)/trema-edge/srcでmakeコマンド実行

$ make
make[1]: Entering directory `/home/ikeuchi/trema-edge/src/lib'
make[1]: *** No rule to make target `all'.  Stop.
make[1]: Leaving directory `/home/ikeuchi/trema-edge/src/lib'
make[1]: Entering directory `/home/ikeuchi/trema-edge/src/packetin_filter'
make[1]: *** No rule to make target `all'.  Stop.
make[1]: Leaving directory `/home/ikeuchi/trema-edge/src/packetin_filter'
make[1]: Entering directory `/home/ikeuchi/trema-edge/src/switch_manager'
make[1]: *** No rule to make target `all'.  Stop.
make[1]: Leaving directory `/home/ikeuchi/trema-edge/src/switch_manager'
/bin/sh: 1: cd: can't cd to switchd
make[1]: Entering directory `/home/ikeuchi/trema-edge/src'
make[2]: Entering directory `/home/ikeuchi/trema-edge/src/lib'
make[2]: *** No rule to make target `all'.  Stop.
make[2]: Leaving directory `/home/ikeuchi/trema-edge/src/lib'
make[2]: Entering directory `/home/ikeuchi/trema-edge/src/packetin_filter'
make[2]: *** No rule to make target `all'.  Stop.
make[2]: Leaving directory `/home/ikeuchi/trema-edge/src/packetin_filter'
make[2]: Entering directory `/home/ikeuchi/trema-edge/src/switch_manager'
make[2]: *** No rule to make target `all'.  Stop.
make[2]: Leaving directory `/home/ikeuchi/trema-edge/src/switch_manager'
/bin/sh: 1: cd: can't cd to switchd
make[2]: Entering directory `/home/ikeuchi/trema-edge/src'
(以下、無限ループ)

上記の通り無限ループしてしまい、makeが終了しません。(問題①) ★以下の3ファイルを修正し問題を回避できた事を報告いたします。

■/trema-edge/src/MakeFile (修正前)

# Copyright (C) 2013 NEC Corporation
#

SUBDIRS = lib packetin_filter switch_manager switchd examples

.PHONY: all clean $(SUBDIRS)

all: $(SUBDIRS)
        @for DIR in $(SUBDIRS); do ( cd $$DIR; make all ); done

clean: $(SUBDIRS)
        @for DIR in $(SUBDIRS); do ( cd $$DIR; make clean ); done

(修正後)

#
# Copyright (C) 2013 NEC Corporation
#

SUBDIRS = lib packetin_filter switch_manager switch examples

.PHONY: all clean $(SUBDIRS)

all: $(SUBDIRS)
        @for DIR in $(SUBDIRS); do ( cd $$DIR; make all ); done

clean: $(SUBDIRS)
        @for DIR in $(SUBDIRS); do ( cd $$DIR; make clean ); done

 SUBDIRSに記載された"switchd""switch"に修正。   ■/trema-edge/src/examples/MakeFile (修正前)

#
# Copyright (C) 2013 NEC Corporation
#

SUBDIRS = dumper dumper_debug learning_switch

.PHONY: all clean $(SUBDIRS)

all: $(SUBDIRS)
        @for DIR in $(SUBDIRS); do ( cd $$DIR; make all ); done

clean: $(SUBDIRS)
        @for DIR in $(SUBDIRS); do ( cd $$DIR; make clean ); done

(修正後)

#
# Copyright (C) 2013 NEC Corporation
#

SUBDIRS = dumper learning_switch

.PHONY: all clean $(SUBDIRS)

all: $(SUBDIRS)
        @for DIR in $(SUBDIRS); do ( cd $$DIR; make all ); done

clean: $(SUBDIRS)
        @for DIR in $(SUBDIRS); do ( cd $$DIR; make clean ); done

SUBDIRSから"dumper_debug"を削除。

■/trema-edge/src/examples/learning_switch/MakeFile (修正前)

#
# Copyright (C) 2013 NEC Corporation
#

CC = gcc
AR = ar
RANLIB = ranlib

CFLAGS = -I../../lib/ -g -std=gnu99 -D_GNU_SOURCE -fno-strict-aliasing -Wall -Werror -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wfloat-equal -Wpointer-arith
LDFLAGS = -ltrema -lpthread -lsqlite3 -ldl -lrt

LIBDIR = ../../lib
(以下略)

(修正後)

#
# Copyright (C) 2013 NEC Corporation
#

CC = gcc
AR = ar
RANLIB = ranlib

CFLAGS = -I../../lib/ -g -std=gnu99 -D_GNU_SOURCE -fno-strict-aliasing -Wall -Werror -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wfloat-equal -Wpointer-arith
LDFLAGS = -ltrema -lpthread -lsqlite3 -ldl -lrt

LIBDIR = ../../../objects/lib/
(以下略)

LIBDIRのパスを"../../lib"から"../../../objects/lib/"に変更

(3)make再実行

$ make
make[1]: Entering directory `/home/ikeuchi/trema-edge/src/lib'
make[1]: *** No rule to make target `all'.  Stop.
make[1]: Leaving directory `/home/ikeuchi/trema-edge/src/lib'
make[1]: Entering directory `/home/ikeuchi/trema-edge/src/packetin_filter'
make[1]: *** No rule to make target `all'.  Stop.
make[1]: Leaving directory `/home/ikeuchi/trema-edge/src/packetin_filter'
make[1]: Entering directory `/home/ikeuchi/trema-edge/src/switch_manager'
make[1]: *** No rule to make target `all'.  Stop.
make[1]: Leaving directory `/home/ikeuchi/trema-edge/src/switch_manager'
make[1]: Entering directory `/home/ikeuchi/trema-edge/src/switch'
make[1]: *** No rule to make target `all'.  Stop.
make[1]: Leaving directory `/home/ikeuchi/trema-edge/src/switch'
make[1]: Entering directory `/home/ikeuchi/trema-edge/src/examples'
make[2]: Entering directory `/home/ikeuchi/trema-edge/src/examples/dumper'
gcc -MM -I./ -I../../lib -g -std=gnu99 -D_GNU_SOURCE -fno-strict-aliasing -Werror -Wall -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wfloat-equal -Wpointer-arith dumper.c > .depends
make[2]: Leaving directory `/home/ikeuchi/trema-edge/src/examples/dumper'
make[2]: Entering directory `/home/ikeuchi/trema-edge/src/examples/learning_switch'
gcc -MM -I../../lib/ -g -std=gnu99 -D_GNU_SOURCE -fno-strict-aliasing -Wall -Werror -Wextra -Wformat=2 -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wfloat-equal -Wpointer-arith learning_switch.c > .depends
make[2]: Leaving directory `/home/ikeuchi/trema-edge/src/examples/learning_switch'
make[1]: Leaving directory `/home/ikeuchi/trema-edge/src/examples'

makeが成功

(4)/trema-edge/learning_switch.shの実行

$ ./learning_switch.sh start
./learning_switch.sh: 53: ./learning_switch.sh: ./objects/examples/learning_switch/learning_switch: not found

上記の通り起動に失敗する。(問題②) ★以下のファイルを修正し問題を回避できた事を報告いたします。

■/trema-edge/learning_switch.sh (修正前)

(省略)
TREMA_SRC=.
OBJECTS="${TREMA_SRC}/objects"

APP_NAME="learning_switch"
APP="${OBJECTS}/examples/learning_switch/learning_switch"
(省略)

(修正後)

(省略)
TREMA_SRC=.
OBJECTS="${TREMA_SRC}/objects"

APP_NAME="learning_switch"
APP="${TREMA_SRC}/src/examples/learning_switch/learning_switch"
(省略)

APPのソースを"${OBJECTS}/examples/learning_switch/learning_switch"から "${TREMA_SRC}/src/examples/learning_switch/learning_switch"に変更

(5)~/trema-edge/learning_switch.shの再実行

$ ./learning_switch.sh start
$
$ ps x
  PID TTY      STAT   TIME COMMAND
 1297 tty1     S+     0:00 -bash
13543 ?        Ss     0:00 ./objects/switch_manager/switch_manager -l debug --daemonize --switch=./objects/s
13550 ?        Ss     0:00 ./src/examples/learning_switch/learning_switch -l debug --name learning_switch --
13551 pts/0    R+     0:00 ps x
30479 ?        S      0:03 sshd: ikeuchi@pts/0
30480 pts/0    Ss     0:00 -bash
$
$ ./learning_switch.sh stop
$
$ ps x
  PID TTY      STAT   TIME COMMAND
 1297 tty1     S+     0:00 -bash
13555 pts/0    R+     0:00 ps x
30479 ?        S      0:03 sshd: ikeuchi@pts/0
30480 pts/0    Ss     0:00 -bash

問題なく実行、停止が出来た事を確認。

★上記の通り、以下のファイルの内容に誤りがある認識です。  ご確認と修正をお願い致します。

sugyo commented 11 years ago

とりあえず、Rakefileでコンパイルされるようにしました。