安装完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
本文转自dongfang_09859 51CTO博客,原文链接:http://blog.51cto.com/hellosa/1061555,如需转载请自行联系原作者