安裝varnish的問題

安裝完varnish後,發現bin目錄下並未有varnishtop,varnishstat,varnishhist這三個命令

  1. # ll /usr/local/varnish3/bin/ 
  2. total 480 
  3. -rwxr-xr-x. 1 root root  49968 Nov 13 17:03 varnishadm 
  4. -rwxr-xr-x. 1 root root  65908 Nov 13 17:03 varnishlog 
  5. -rwxr-xr-x. 1 root root  82060 Nov 13 17:03 varnishncsa 
  6. -rwxr-xr-x. 1 root root  67083 Nov 13 17:03 varnishreplay 
  7. -rwxr-xr-x. 1 root root 212398 Nov 13 17:03 varnishtest 

於是在源碼目錄裏找了下,發現源碼根目錄下有這樣一個目錄bin

  1. bin]# ll 
  2. total 92 
  3. -rw-r--r--. 1 root root      18227 Nov 13 17:01 Makefile 
  4. -rw-r--r--. 1  108 nfsnobody   163 Aug 20 17:20 Makefile.am 
  5. -rw-r--r--. 1  108 nfsnobody 18036 Aug 20 17:20 Makefile.in 
  6. drwxr-xr-x. 4  108 nfsnobody  4096 Nov 13 17:02 varnishadm 
  7. drwxr-xr-x. 4  108 nfsnobody 12288 Nov 13 17:03 varnishd 
  8. drwxr-xr-x. 3  108 nfsnobody  4096 Nov 13 17:01 varnishhist 
  9. drwxr-xr-x. 4  108 nfsnobody  4096 Nov 13 17:03 varnishlog 
  10. drwxr-xr-x. 4  108 nfsnobody  4096 Nov 13 17:03 varnishncsa 
  11. drwxr-xr-x. 4  108 nfsnobody  4096 Nov 13 17:03 varnishreplay 
  12. drwxr-xr-x. 3  108 nfsnobody  4096 Nov 13 17:01 varnishsizes 
  13. drwxr-xr-x. 3  108 nfsnobody  4096 Nov 13 17:01 varnishstat 
  14. drwxr-xr-x. 5  108 nfsnobody  4096 Nov 13 17:03 varnishtest 
  15. drwxr-xr-x. 3  108 nfsnobody  4096 Nov 13 17:01 varnishtop 

這不是我要找的東西麼,很興奮,隨便看了一下Makefile,make一下試試

  1. varnishstat]# make 
  2. 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 
  3. mv -f .deps/varnishstat.Tpo .deps/varnishstat.Po 
  4. 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 
  5. varnishstat_curses.c: In function ‘do_curses’: 
  6. varnishstat_curses.c:145: warning: implicit declaration of function ‘initscr’ 
  7. varnishstat_curses.c:146: warning: implicit declaration of function ‘raw’ 
  8. varnishstat_curses.c:147: warning: implicit declaration of function ‘noecho’ 
  9. varnishstat_curses.c:148: warning: implicit declaration of function ‘nonl’ 
  10. varnishstat_curses.c:149: warning: implicit declaration of function ‘intrflush’ 
  11. varnishstat_curses.c:149: error: ‘stdscr’ undeclared (first use in this function) 
  12. varnishstat_curses.c:149: error: (Each undeclared identifier is reported only once 
  13. varnishstat_curses.c:149: error: for each function it appears in.) 
  14. varnishstat_curses.c:149: error: ‘FALSE’ undeclared (first use in this function) 
  15. varnishstat_curses.c:150: warning: implicit declaration of function ‘curs_set’ 
  16. varnishstat_curses.c:158: warning: implicit declaration of function ‘erase’ 
  17. varnishstat_curses.c:159: warning: implicit declaration of function ‘refresh’ 
  18. varnishstat_curses.c:187: warning: implicit declaration of function ‘mvprintw’ 
  19. varnishstat_curses.c:187: error: ‘COLS’ undeclared (first use in this function) 
  20. varnishstat_curses.c:215: error: ‘LINES’ undeclared (first use in this function) 
  21. varnishstat_curses.c:228: warning: implicit declaration of function ‘addstr’ 
  22. varnishstat_curses.c:241: warning: implicit declaration of function ‘timeout’ 
  23. varnishstat_curses.c:242: warning: implicit declaration of function ‘getch’ 
  24. varnishstat_curses.c:243: error: ‘ERR’ undeclared (first use in this function) 
  25. varnishstat_curses.c:252: warning: implicit declaration of function ‘redrawwin’ 
  26. varnishstat_curses.c:264: warning: implicit declaration of function ‘endwin’ 
  27. varnishstat_curses.c:279: warning: implicit declaration of function ‘beep’ 
  28. make: *** [varnishstat_curses.o] Error 1 

無論選擇哪一個,都是make出錯。源碼bin根目錄下,亦是如此。查了一下,原來是這樣:

  1. 如果你在編譯的vasnish中的bin目錄沒有發現varnishstat, varnishtop, varnishhist這個三個程序的話,
  2. 是因爲編譯前沒有安裝與操作系統位數對應的ncurses-devel。 

安裝ncurses-devel即可,yum install ncurses-devel.x86_64

然後不需要重新編譯varnish了,直接執行varnish目錄下的 autogen.sh 自動關聯新的環境,之後直接進入 {varnish-source}\bin\{varnishstat|varnishtop|varnishhist} 運行make 即可。

  1. # sh autogen.sh  
  2. # 進入相關目錄,make && make install
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章