nginx无法使用子模块(OS X 10.9)

时间:2014-03-26 16:23:13

标签: nginx

我尝试使用nginx-gridfs模块从源代码编译nginx。

跑完后:

  

$ ./configure --add-module = / path / to / nginx-gridfs

接下来是:

  

$ make

我收到以下输出:

/Applications/Xcode.app/Contents/Developer/usr/bin/make -f objs/Makefile
cc -c -Wno-unused-function -Wno-missing-field-initializers -D_POSIX_C_SOURCE=200112L --std=c99 -Isrc -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs \
        -o objs/src/core/nginx.o \
        src/core/nginx.c
In file included from src/core/nginx.c:8:
In file included from src/core/ngx_config.h:34:
In file included from src/os/unix/ngx_darwin_config.h:30:
In file included from /usr/include/sys/mount.h:76:
In file included from /usr/include/sys/attr.h:42:
/usr/include/sys/ucred.h:91:2: error: unknown type name 'u_long'; did you mean 'long'?
        u_long  cr_ref;                 /* reference count */
        ^
/usr/include/sys/ucred.h:133:9: error: unknown type name 'u_int'
        u_int   cr_version;             /* structure layout version */
        ^
In file included from src/core/nginx.c:8:
In file included from src/core/ngx_config.h:34:
In file included from src/os/unix/ngx_darwin_config.h:30:
In file included from /usr/include/sys/mount.h:76:
/usr/include/sys/attr.h:78:2: error: unknown type name 'u_short'; did you mean 'short'?
        u_short bitmapcount;                    /* number of attr. bit sets in list (should be 5) */
        ^
/usr/include/sys/attr.h:442:2: error: unknown type name 'u_long'; did you mean 'long'?
        u_long                          maxmatches;
        ^
/usr/include/sys/attr.h:455:2: error: unknown type name 'u_char'; did you mean 'char'?
        u_char                          ss_fsstate[548];        // fs private
        ^
In file included from src/core/nginx.c:8:
In file included from src/core/ngx_config.h:34:
In file included from src/os/unix/ngx_darwin_config.h:50:
In file included from /usr/include/sys/sysctl.h:84:
/usr/include/sys/proc.h:111:2: error: unknown type name 'u_int'
        u_int   p_estcpu;        /* Time averaged value of p_cpticks. */
        ^
/usr/include/sys/proc.h:116:2: error: unknown type name 'u_int'
        u_int   p_swtime;        /* Time swapped in or out. */
        ^
/usr/include/sys/proc.h:117:2: error: unknown type name 'u_int'
        u_int   p_slptime;       /* Time since last blocked. */
        ^
/usr/include/sys/proc.h:131:2: error: unknown type name 'u_char'; did you mean 'char'?
        u_char  p_priority;     /* Process priority. */
        ^
/usr/include/sys/proc.h:132:2: error: unknown type name 'u_char'; did you mean 'char'?
        u_char  p_usrpri;       /* User-priority based on p_cpu and p_nice. */
        ^
/usr/include/sys/proc.h:137:2: error: unknown type name 'u_short'; did you mean 'short'?
        u_short p_xstat;        /* Exit status for wait; also stop signal. */
        ^
/usr/include/sys/proc.h:138:2: error: unknown type name 'u_short'; did you mean 'short'?
        u_short p_acflag;       /* Accounting flags. */
        ^
In file included from src/core/nginx.c:9:
In file included from src/core/ngx_core.h:38:
src/os/unix/ngx_errno.h:71:1: error: unknown type name 'u_char'; did you mean 'char'?
u_char *ngx_strerror(ngx_err_t err, u_char *errstr, size_t size);
^~~~~~
char
src/os/unix/ngx_errno.h:71:37: error: unknown type name 'u_char'; did you mean 'char'?
u_char *ngx_strerror(ngx_err_t err, u_char *errstr, size_t size);
                                    ^~~~~~
                                    char
In file included from src/core/nginx.c:9:
In file included from src/core/ngx_core.h:41:
src/core/ngx_rbtree.h:27:5: error: unknown type name 'u_char'; did you mean 'char'?
    u_char                 color;
    ^~~~~~
    char
src/core/ngx_rbtree.h:28:5: error: unknown type name 'u_char'; did you mean 'char'?
    u_char                 data;
    ^~~~~~
    char
In file included from src/core/nginx.c:9:
In file included from src/core/ngx_core.h:44:
src/core/ngx_string.h:18:5: error: unknown type name 'u_char'; did you mean 'char'?
    u_char     *data;
    ^~~~~~
    char
src/core/ngx_string.h:36:5: error: unknown type name 'u_char'; did you mean 'char'?
    u_char     *data;
    ^~~~~~
    char
src/core/ngx_string.h:50:17: error: unknown type name 'u_char'; did you mean 'char'?
void ngx_strlow(u_char *dst, u_char *src, size_t n);
                ^~~~~~
                char
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[1]: *** [objs/src/core/nginx.o] Error 1
make: *** [build] Error 2

在没有子模块的情况下进行配置时,nginx编译时没有错误。

我是OS X 10.9和nginx 1.4.7

1 个答案:

答案 0 :(得分:3)

您可以通过删除nginx-gridfs下 config 文件中的-D_POSIX_C_SOURCE = 200112L功能测试宏来编译它

替换:

CFLAGS="$CFLAGS -Wno-unused-function -Wno-missing-field-initializers -D_POSIX_C_SOURCE=200112L --std=c99 -Isrc"

使用:

CFLAGS="$CFLAGS -Wno-unused-function -Wno-missing-field-initializers --std=c99 -Isrc"