Nginx 在 Mac 上 brew install nginx 时遇到一个 error,请高手指教

wrymax · 2012年12月12日 · 最后由 wrymax 回复于 2012年12月13日 · 10667 次阅读

$ brew install nginx

日志如下: ==> Downloading http://nginx.org/download/nginx-1.0.11.tar.gz File already downloaded in /Users/max/Library/Caches/Homebrew ==> Patching patching file auto/lib/pcre/conf patching file conf/nginx.conf ==> ./configure --prefix=/usr/local/Cellar/nginx/1.0.11 --with-http_ssl_module --with-pcre --conf-path=/usr/local/etc/n checking for OS

  • Darwin 11.4.2 x86_64 checking for C compiler ... found
  • using GNU C compiler checking for gcc builtin atomic operations ... found checking for C99 variadic macros ... found checking for gcc variadic macros ... found checking for unistd.h ... found checking for inttypes.h ... found checking for limits.h ... found checking for sys/filio.h ... found checking for sys/param.h ... found checking for sys/mount.h ... found checking for sys/statvfs.h ... found checking for crypt.h ... not found checking for Darwin specific features
  • kqueue found checking for kqueue's EVFILT_TIMER ... found checking for Darwin 64-bit kqueue millisecond timeout bug ... not found checking for sendfile() ... found checking for atomic(3) ... found checking for nobody group ... found checking for poll() ... found checking for /dev/poll ... not found checking for crypt() ... found checking for F_READAHEAD ... not found checking for posix_fadvise() ... not found checking for O_DIRECT ... not found checking for F_NOCACHE ... found checking for directio() ... not found checking for statfs() ... found checking for statvfs() ... found checking for dlopen() ... found checking for sched_yield() ... found checking for SO_SETFIB ... not found checking for SO_ACCEPTFILTER ... not found checking for TCP_DEFER_ACCEPT ... not found checking for accept4() ... not found checking for int size ... 4 bytes checking for long size ... 8 bytes checking for long long size ... 8 bytes checking for void * size ... 8 bytes checking for uint64_t ... found checking for sig_atomic_t ... found checking for sig_atomic_t size ... 4 bytes checking for socklen_t ... found checking for in_addr_t ... found checking for in_port_t ... found checking for rlim_t ... found checking for uintptr_t ... uintptr_t found checking for system endianess ... little endianess checking for size_t size ... 8 bytes checking for off_t size ... 8 bytes checking for time_t size ... 8 bytes checking for setproctitle() ... not found checking for pread() ... found checking for pwrite() ... found checking for sys_nerr ... found checking for localtime_r() ... found checking for posix_memalign() ... found checking for memalign() ... not found checking for mmap(MAP_ANON|MAP_SHARED) ... found checking for mmap("/dev/zero", MAP_SHARED) ... found but is not working checking for System V shared memory ... found checking for POSIX semaphores ... found but is not working checking for POSIX semaphores in libpthread ... found but is not working checking for POSIX semaphores in librt ... not found checking for struct msghdr.msg_control ... found checking for ioctl(FIONBIO) ... found checking for struct tm.tm_gmtoff ... found checking for struct dirent.d_namlen ... found checking for struct dirent.d_type ... found checking for PCRE library ... not found checking for PCRE library in /usr/local/ ... not found checking for PCRE library in /usr/include/pcre/ ... not found checking for PCRE library in /usr/pkg/ ... not found checking for PCRE library in /opt/local/ ... not found checking for PCRE library in /usr/local ... not found

./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre= option.

==> Exit Status: 1 http://github.com/mxcl/homebrew/blob/master/Library/Formula/nginx.rb#L55 ==> Environment HOMEBREW_VERSION: 0.8.1 HEAD: (none) HOMEBREW_PREFIX: /usr/local HOMEBREW_CELLAR: /usr/local/Cellar Hardware: quad-core 64-bit sandybridge OS X: 10.7.5 Kernel Architecture: x86_64 Ruby: 1.8.7-358 /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby Xcode: 4.2 GCC-4.0: N/A GCC-4.2: build 5666 LLVM: build 2336 Clang: 3.0 build 211 MacPorts or Fink? false X11 installed? true ==> Build Flags CC: /usr/bin/llvm-gcc => /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 CXX: /usr/bin/llvm-g++ => /usr/llvm-gcc-4.2/bin/llvm-g++-4.2 LD: /usr/bin/llvm-gcc => /usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 CFLAGS: -O3 -w -pipe -march=core2 -msse4 CXXFLAGS: -O3 -w -pipe -march=core2 -msse4 MAKEFLAGS: -j4

Error: Failed executing: ./configure --prefix=/usr/local/Cellar/nginx/1.0.11 --with-http_ssl_module --with-pcre --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/nginx/nginx.lock If `brew doctor' does not help diagnose the issue, please report the bug: https://github.com/mxcl/homebrew/wiki/checklist-before-filing-a-new-issue We saved the configure log, please gist it if you report the issue: ~/Library/Logs/Homebrew/config.log

最后出现了一个 error,请问谁遇到过这个问题吗?如何解决?

你运行 brew doctor 看看有什么反应

写的很清楚了,简单地就是 brew install pcre, brew install nginx 另外的方法就是编译 nginx 的时候加选项, ./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre= option.

pcre 没有安装

#3 楼 @huacnlee 谢谢,确实是 pcre 的问题,改用 passenger 安装后解决了。

#2 楼 @bwlinux 谢谢,brew install pcre 貌似没效果,改用 passenger 后可以了。

#1 楼 @HungYuHei brew doctor 出来一堆建议。。。一头雾水,不过 passenger-install 是 work 的

需要 登陆 后方可回复, 如果你还没有账号请 注册新账号