Opened 3 months ago

Last modified 3 months ago

#2599 closed defect

Nginx 1.24 building from source with pcre2 on Ubuntu leading to issues — at Initial Version

Reported by: Umar Noor Owned by:
Priority: minor Milestone:
Component: documentation Version: 1.25.x
Keywords: Cc:
uname -a: Linux anadev001 6.5.0-15-generic #15~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 12 18:54:30 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: nginx-1.24.0.tar.gz

Description

Ubuntu Version: Linux anadev001 6.5.0-15-generic #15~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 12 18:54:30 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

make version: GNU Make 4.3
Nginx version: nginx-1.24.0.tar.gz
PCRE2 Version: pcre2-10.42.tar.gz
gcc version: gcc version 11.4.0

Getting the below compilation issues using the above configuration:

make -f objs/Makefile

gcc -c -fPIC -I/home/umarsam/projectwork/nginx/../pcre/src/include -I/home/umarsam/projectwork/nginx/../zlib/prod/include -I/home/umarsam/projectwork/nginx/../gd/prod/include -I/home/umarsam/projectwork/nginx/../openssl/prod/include -I. -I src/core -I src/event -I src/event/modules -I src/os/unix -I /home/umarsam/projectwork/nginx/../pcre/prod/include -I /home/umarsam/projectwork/nginx/../openssl/prod/include -I /home/umarsam/projectwork/nginx/../zlib/prod/include -I /home/umarsam/projectwork/gd/prod/include -I objs -I src/http -I src/http/modules -I src/http/v2 \

-o objs/src/http/modules/ngx_http_rewrite_module.o \
src/http/modules/ngx_http_rewrite_module.c

src/http/modules/ngx_http_rewrite_module.c: In function ‘ngx_http_rewrite’:
src/http/modules/ngx_http_rewrite_module.c:309:5: error: unknown type name ‘ngx_http_script_regex_code_t’; did you mean ‘ngx_http_script_file_code_t’?

309 | ngx_http_script_regex_code_t *regex;

| ~
| ngx_http_script_file_code_t

src/http/modules/ngx_http_rewrite_module.c:310:5: error: unknown type name ‘ngx_http_script_regex_end_code_t’; did you mean ‘ngx_http_script_return_code_t’?

310 | ngx_http_script_regex_end_code_t *regex_end;

| ~
| ngx_http_script_return_code_t

src/http/modules/ngx_http_rewrite_module.c:314:47: error: ‘ngx_http_script_regex_code_t’ undeclared (first use in this function); did you mean ‘ngx_http_script_file_code_t’?

314 | sizeof(ngx_http_script_regex_code_t));

| ~
| ngx_http_script_file_code_t

src/http/modules/ngx_http_rewrite_module.c:314:47: note: each undeclared identifier is reported only once for each function it appears in
src/http/modules/ngx_http_rewrite_module.c:336:10: error: request for member ‘regex’ in something not a structure or union

336 | regex->regex = ngx_http_regex_compile(cf, &rc);

| ~

src/http/modules/ngx_http_rewrite_module.c:336:20: warning: implicit declaration of function ‘ngx_http_regex_compile’; did you mean ‘ngx_regex_compile’? [-Wimplicit-function-declaration]

336 | regex->regex = ngx_http_regex_compile(cf, &rc);

| ~
| ngx_regex_compile

src/http/modules/ngx_http_rewrite_module.c:337:14: error: request for member ‘regex’ in something not a structure or union

337 | if (regex->regex == NULL) {

| ~

src/http/modules/ngx_http_rewrite_module.c:341:10: error: request for member ‘code’ in something not a structure or union

341 | regex->code = ngx_http_script_regex_start_code;

| ~

src/http/modules/ngx_http_rewrite_module.c:341:19: error: ‘ngx_http_script_regex_start_code’ undeclared (first use in this function); did you mean ‘ngx_http_script_start_code’?

341 | regex->code = ngx_http_script_regex_start_code;

| ~
| ngx_http_script_start_code

src/http/modules/ngx_http_rewrite_module.c:342:10: error: request for member ‘uri’ in something not a structure or union

342 | regex->uri = 1;

| ~

src/http/modules/ngx_http_rewrite_module.c:343:10: error: request for member ‘name’ in something not a structure or union

343 | regex->name = value[1];

| ~

src/http/modules/ngx_http_rewrite_module.c:351:14: error: request for member ‘add_args’ in something not a structure or union

351 | regex->add_args = 1;

| ~

src/http/modules/ngx_http_rewrite_module.c:360:14: error: request for member ‘status’ in something not a structure or union

360 | regex->status = NGX_HTTP_MOVED_TEMPORARILY;

| ~

src/http/modules/ngx_http_rewrite_module.c:361:14: error: request for member ‘redirect’ in something not a structure or union

361 | regex->redirect = 1;

| ~

src/http/modules/ngx_http_rewrite_module.c:370:18: error: request for member ‘break_cycle’ in something not a structure or union

370 | regex->break_cycle = 1;

| ~

src/http/modules/ngx_http_rewrite_module.c:374:18: error: request for member ‘status’ in something not a structure or union

374 | regex->status = NGX_HTTP_MOVED_TEMPORARILY;

| ~

src/http/modules/ngx_http_rewrite_module.c:375:18: error: request for member ‘redirect’ in something not a structure or union

375 | regex->redirect = 1;

| ~

src/http/modules/ngx_http_rewrite_module.c:379:18: error: request for member ‘status’ in something not a structure or union

379 | regex->status = NGX_HTTP_MOVED_PERMANENTLY;

| ~

src/http/modules/ngx_http_rewrite_module.c:380:18: error: request for member ‘redirect’ in something not a structure or union

380 | regex->redirect = 1;

| ~

src/http/modules/ngx_http_rewrite_module.c:394:24: error: request for member ‘lengths’ in something not a structure or union

394 | sc.lengths = &regex->lengths;

| ~

src/http/modules/ngx_http_rewrite_module.c:399:29: error: request for member ‘redirect’ in something not a structure or union

399 | sc.compile_args = !regex->redirect;

| ~

src/http/modules/ngx_http_rewrite_module.c:407:10: error: request for member ‘size’ in something not a structure or union

407 | regex->size = sc.size;

| ~

src/http/modules/ngx_http_rewrite_module.c:408:10: error: request for member ‘args’ in something not a structure or union

408 | regex->args = sc.args;

| ~

src/http/modules/ngx_http_rewrite_module.c:411:14: error: request for member ‘lengths’ in something not a structure or union

411 | regex->lengths = NULL;

| ~

src/http/modules/ngx_http_rewrite_module.c:415:46: error: ‘ngx_http_script_regex_end_code_t’ undeclared (first use in this function); did you mean ‘ngx_http_script_return_code_t’?

415 | sizeof(ngx_http_script_regex_end_code_t),

| ~
| ngx_http_script_return_code_t

src/http/modules/ngx_http_rewrite_module.c:421:14: error: request for member ‘code’ in something not a structure or union

421 | regex_end->code = ngx_http_script_regex_end_code;

| ~

src/http/modules/ngx_http_rewrite_module.c:421:23: error: ‘ngx_http_script_regex_end_code’ undeclared (first use in this function); did you mean ‘ngx_http_script_return_code’?

421 | regex_end->code = ngx_http_script_regex_end_code;

| ~
| ngx_http_script_return_code

src/http/modules/ngx_http_rewrite_module.c:422:14: error: request for member ‘uri’ in something not a structure or union

422 | regex_end->uri = regex->uri;

| ~

src/http/modules/ngx_http_rewrite_module.c:422:27: error: request for member ‘uri’ in something not a structure or union

422 | regex_end->uri = regex->uri;

| ~

src/http/modules/ngx_http_rewrite_module.c:423:14: error: request for member ‘args’ in something not a structure or union

423 | regex_end->args = regex->args;

| ~

src/http/modules/ngx_http_rewrite_module.c:423:28: error: request for member ‘args’ in something not a structure or union

423 | regex_end->args = regex->args;

| ~

src/http/modules/ngx_http_rewrite_module.c:424:14: error: request for member ‘add_args’ in something not a structure or union

424 | regex_end->add_args = regex->add_args;

| ~

src/http/modules/ngx_http_rewrite_module.c:424:32: error: request for member ‘add_args’ in something not a structure or union

424 | regex_end->add_args = regex->add_args;

| ~

src/http/modules/ngx_http_rewrite_module.c:425:14: error: request for member ‘redirect’ in something not a structure or union

425 | regex_end->redirect = regex->redirect;

| ~

src/http/modules/ngx_http_rewrite_module.c:425:32: error: request for member ‘redirect’ in something not a structure or union

425 | regex_end->redirect = regex->redirect;

| ~

src/http/modules/ngx_http_rewrite_module.c:436:10: error: request for member ‘next’ in something not a structure or union

436 | regex->next = (u_char *) lcf->codes->elts + lcf->codes->nelts

| ~

src/http/modules/ngx_http_rewrite_module.c: In function ‘ngx_http_rewrite_if_condition’:
src/http/modules/ngx_http_rewrite_module.c:658:5: error: unknown type name ‘ngx_http_script_regex_code_t’; did you mean ‘ngx_http_script_file_code_t’?

658 | ngx_http_script_regex_code_t *regex;

| ~
| ngx_http_script_file_code_t

src/http/modules/ngx_http_rewrite_module.c:756:49: error: ‘ngx_http_script_regex_code_t’ undeclared (first use in this function); did you mean ‘ngx_http_script_file_code_t’?

756 | sizeof(ngx_http_script_regex_code_t));

| ~
| ngx_http_script_file_code_t

src/http/modules/ngx_http_rewrite_module.c:770:18: error: request for member ‘regex’ in something not a structure or union

770 | regex->regex = ngx_http_regex_compile(cf, &rc);

| ~

src/http/modules/ngx_http_rewrite_module.c:771:22: error: request for member ‘regex’ in something not a structure or union

771 | if (regex->regex == NULL) {

| ~

src/http/modules/ngx_http_rewrite_module.c:775:18: error: request for member ‘code’ in something not a structure or union

775 | regex->code = ngx_http_script_regex_start_code;

| ~

src/http/modules/ngx_http_rewrite_module.c:775:27: error: ‘ngx_http_script_regex_start_code’ undeclared (first use in this function); did you mean ‘ngx_http_script_start_code’?

775 | regex->code = ngx_http_script_regex_start_code;

| ~
| ngx_http_script_start_code

src/http/modules/ngx_http_rewrite_module.c:776:18: error: request for member ‘next’ in something not a structure or union

776 | regex->next = sizeof(ngx_http_script_regex_code_t);

| ~

src/http/modules/ngx_http_rewrite_module.c:777:18: error: request for member ‘test’ in something not a structure or union

777 | regex->test = 1;

| ~

src/http/modules/ngx_http_rewrite_module.c:779:22: error: request for member ‘negative_test’ in something not a structure or union

779 | regex->negative_test = 1;

| ~

src/http/modules/ngx_http_rewrite_module.c:781:18: error: request for member ‘name’ in something not a structure or union

781 | regex->name = value[last];

| ~


After having a look in the code the below 2 structures causing this are defined in teh directives with PCRE only and not with PCRE2

#if (NGX_PCRE)

typedef struct {

ngx_http_script_code_pt code;
ngx_http_regex_t *regex;
ngx_array_t *lengths;
uintptr_t size;
uintptr_t status;
uintptr_t next;

unsigned test:1;
unsigned negative_test:1;
unsigned uri:1;
unsigned args:1;

/* add the r->args to the new arguments */
unsigned add_args:1;

unsigned redirect:1;
unsigned break_cycle:1;

ngx_str_t name;

} ngx_http_script_regex_code_t;

typedef struct {

ngx_http_script_code_pt code;

unsigned uri:1;
unsigned args:1;

/* add the r->args to the new arguments */
unsigned add_args:1;

unsigned redirect:1;

} ngx_http_script_regex_end_code_t;

#endif

Could you please let me know if this is the right way of compiling or niginx1.24 does not support PCRE2 library on Ubuntu....

Change History (0)

Note: See TracTickets for help on using tickets.