安裝完varnish後,發現bin目錄下並未有varnishtop,varnishstat,varnishhist這三個命令
- # ll /usr/local/varnish3/bin/
- total 480
- -rwxr-xr-x. 1 root root 49968 Nov 13 17:03 varnishadm
- -rwxr-xr-x. 1 root root 65908 Nov 13 17:03 varnishlog
- -rwxr-xr-x. 1 root root 82060 Nov 13 17:03 varnishncsa
- -rwxr-xr-x. 1 root root 67083 Nov 13 17:03 varnishreplay
- -rwxr-xr-x. 1 root root 212398 Nov 13 17:03 varnishtest
於是在源碼目錄裏找了下,發現源碼根目錄下有這樣一個目錄bin
- bin]# ll
- total 92
- -rw-r--r--. 1 root root 18227 Nov 13 17:01 Makefile
- -rw-r--r--. 1 108 nfsnobody 163 Aug 20 17:20 Makefile.am
- -rw-r--r--. 1 108 nfsnobody 18036 Aug 20 17:20 Makefile.in
- drwxr-xr-x. 4 108 nfsnobody 4096 Nov 13 17:02 varnishadm
- drwxr-xr-x. 4 108 nfsnobody 12288 Nov 13 17:03 varnishd
- drwxr-xr-x. 3 108 nfsnobody 4096 Nov 13 17:01 varnishhist
- drwxr-xr-x. 4 108 nfsnobody 4096 Nov 13 17:03 varnishlog
- drwxr-xr-x. 4 108 nfsnobody 4096 Nov 13 17:03 varnishncsa
- drwxr-xr-x. 4 108 nfsnobody 4096 Nov 13 17:03 varnishreplay
- drwxr-xr-x. 3 108 nfsnobody 4096 Nov 13 17:01 varnishsizes
- drwxr-xr-x. 3 108 nfsnobody 4096 Nov 13 17:01 varnishstat
- drwxr-xr-x. 5 108 nfsnobody 4096 Nov 13 17:03 varnishtest
- drwxr-xr-x. 3 108 nfsnobody 4096 Nov 13 17:01 varnishtop
這不是我要找的東西麼,很興奮,隨便看了一下Makefile,make一下試試
- varnishstat]# make
- gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I../../include -g -O2 -pthread -Wextra -Wno-missing-field-initializers -Wno-sign-compare -MT varnishstat.o -MD -MP -MF .deps/varnishstat.Tpo -c -o varnishstat.o varnishstat.c
- mv -f .deps/varnishstat.Tpo .deps/varnishstat.Po
- gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I../.. -I../../include -g -O2 -pthread -Wextra -Wno-missing-field-initializers -Wno-sign-compare -MT varnishstat_curses.o -MD -MP -MF .deps/varnishstat_curses.Tpo -c -o varnishstat_curses.o varnishstat_curses.c
- varnishstat_curses.c: In function ‘do_curses’:
- varnishstat_curses.c:145: warning: implicit declaration of function ‘initscr’
- varnishstat_curses.c:146: warning: implicit declaration of function ‘raw’
- varnishstat_curses.c:147: warning: implicit declaration of function ‘noecho’
- varnishstat_curses.c:148: warning: implicit declaration of function ‘nonl’
- varnishstat_curses.c:149: warning: implicit declaration of function ‘intrflush’
- varnishstat_curses.c:149: error: ‘stdscr’ undeclared (first use in this function)
- varnishstat_curses.c:149: error: (Each undeclared identifier is reported only once
- varnishstat_curses.c:149: error: for each function it appears in.)
- varnishstat_curses.c:149: error: ‘FALSE’ undeclared (first use in this function)
- varnishstat_curses.c:150: warning: implicit declaration of function ‘curs_set’
- varnishstat_curses.c:158: warning: implicit declaration of function ‘erase’
- varnishstat_curses.c:159: warning: implicit declaration of function ‘refresh’
- varnishstat_curses.c:187: warning: implicit declaration of function ‘mvprintw’
- varnishstat_curses.c:187: error: ‘COLS’ undeclared (first use in this function)
- varnishstat_curses.c:215: error: ‘LINES’ undeclared (first use in this function)
- varnishstat_curses.c:228: warning: implicit declaration of function ‘addstr’
- varnishstat_curses.c:241: warning: implicit declaration of function ‘timeout’
- varnishstat_curses.c:242: warning: implicit declaration of function ‘getch’
- varnishstat_curses.c:243: error: ‘ERR’ undeclared (first use in this function)
- varnishstat_curses.c:252: warning: implicit declaration of function ‘redrawwin’
- varnishstat_curses.c:264: warning: implicit declaration of function ‘endwin’
- varnishstat_curses.c:279: warning: implicit declaration of function ‘beep’
- make: *** [varnishstat_curses.o] Error 1
無論選擇哪一個,都是make出錯。源碼bin根目錄下,亦是如此。查了一下,原來是這樣:
- 如果你在編譯的vasnish中的bin目錄沒有發現varnishstat, varnishtop, varnishhist這個三個程序的話,
- 是因爲編譯前沒有安裝與操作系統位數對應的ncurses-devel。
安裝ncurses-devel即可,yum install ncurses-devel.x86_64
然後不需要重新編譯varnish了,直接執行varnish目錄下的 autogen.sh 自動關聯新的環境,之後直接進入 {varnish-source}\bin\{varnishstat|varnishtop|varnishhist} 運行make 即可。
- # sh autogen.sh
- # 進入相關目錄,make && make install