Skip to content

alpinelinux环境下编译出错 #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sanqi opened this issue Oct 18, 2019 · 2 comments
Open

alpinelinux环境下编译出错 #6

sanqi opened this issue Oct 18, 2019 · 2 comments

Comments

@sanqi
Copy link

sanqi commented Oct 18, 2019

提示错误
./ngx_http_ipdb_module-master//ipdb/ipdb.c In file included from ./ngx_http_ipdb_module-master//ipdb/ipdb.c:9: ./ngx_http_ipdb_module-master//ipdb/ipdb.h:60:44: error: unknown type name 'u_char' int ipdb_search(ipdb_reader *reader, const u_char *ip, int bit_count, int *node); ^~~~~~ ./ngx_http_ipdb_module-master//ipdb/ipdb.c:184:44: error: unknown type name 'u_char' int ipdb_search(ipdb_reader *reader, const u_char *ip, int bit_count, int *node) { ^~~~~~ ./ngx_http_ipdb_module-master//ipdb/ipdb.c: In function 'ipdb_find0': ./ngx_http_ipdb_module-master//ipdb/ipdb.c:219:42: error: unknown type name 'u_char' err = ipdb_search(reader, (const u_char *) &addr4.s_addr, 32, &node); ^~~~~~ ./ngx_http_ipdb_module-master//ipdb/ipdb.c:227:42: error: unknown type name 'u_char' err = ipdb_search(reader, (const u_char *) &addr6.s6_addr, 128, &node); ^~~~~~ make[1]: *** [objs/Makefile:1212: objs/addon/ipdb/ipdb.o] Error 1 make[1]: Leaving directory '/tmp/nginx-1.17.4' make: *** [Makefile:8: build] Error 2

在 ipdb.h里加上 typedef unsigned char u_char; 才能编译通过

@xiaoyawl
Copy link

在 ipdb.h里加上 typedef unsigned char u_char; 编译也不能过

不知道还能不能得到作者的更新

@peytonyip
Copy link

@xiaoyawlipdb.h 加的位置是在 ipdb_reader; int ipdb_reader_new(const char *file, ipdb_reader **reader); 之间,试了可以编译,你可以再试试,确保 alpine 装了 json-c-dev,修改后大概是这样:

typedef struct ipdb_reader {
    ipdb_meta_data *meta;
    int v4offset;
    int file_size;
    int data_size;
    unsigned char *data;
} ipdb_reader;

typedef unsigned char u_char;

int ipdb_reader_new(const char *file, ipdb_reader **reader);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants