webserver-llc / angie

Angie - drop-in replacement for Nginx
https://en.angie.software
BSD 2-Clause "Simplified" License
1.22k stars 65 forks source link

Does not compile #33

Closed RekGRpth closed 1 year ago

RekGRpth commented 1 year ago
cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -Wextra -Wwrite-strings -Wmissing-prototypes -Werror -Wno-discarded-qualifiers -DNDK_SET_VAR -DNDK_SET_VAR -DNDK_SET_VAR -DNDK_SET_VAR -DNDK_SET_VAR -DNDK_SET_VAR -DNDK_SET_VAR -DNDK_SET_VAR -DNDK_UPSTREAM_LIST -DNDK_SET_VAR -DNDK_SET_VAR -Wno-deprecated-declarations -I src/core -I src/event -I src/event/modules -I src/event/quic -I src/os/unix -I modules/ngx_devel_kit/objs -I objs/addon/ndk -I modules/ngx_devel_kit/src -I modules/ngx_devel_kit/objs -I objs/addon/ndk -I /usr/include/postgresql -I /usr/include/postgresql/15/server -I /usr/include -I /usr/include/libxml2 -I objs \
    -o objs/src/core/ngx_slab.o \
    src/core/ngx_slab.c
src/core/ngx_slab.c:906:1: error: no previous prototype for 'ngx_api_slabs_handler' [-Werror=missing-prototypes]
  906 | ngx_api_slabs_handler(ngx_api_entry_data_t data, ngx_api_ctx_t *actx, void *ctx)
      | ^~~~~~~~~~~~~~~~~~~~~
VBart commented 1 year ago

Could you please provide configure arguments, platform, operating system and compiler version?

RekGRpth commented 1 year ago

configure arguments

./configure '--add-dynamic-module=modules/ngx_devel_kit modules/ngx_http_sign_module modules/ngx_http_include_server_module modules/ngx_http_json_module modules/ngx_http_captcha_module modules/ngx_http_time_var_module modules/nginx-upload-module modules/ngx_http_upstream_queue_module modules/nginx_csrf_prevent modules/ngx_http_headers_module modules/ngx_http_remote_passwd modules/nginx-uuid4-module modules/ngx_http_response_body_module modules/ngx_http_auth_pam_module modules/ngx_http_error_page_inherit_module modules/iconv-nginx-module modules/ngx_http_zip_var_module modules/ngx_http_evaluate_module modules/ngx_http_json_var_module modules/ngx_http_auth_basic_ldap_module modules/nginx-upstream-fair modules/ngx_upstream_jdomain modules/set-misc-nginx-module modules/ngx_pq_module modules/ngx_http_htmldoc_module modules/encrypted-session-nginx-module modules/form-input-nginx-module modules/nginx-ejwt-module modules/ngx_http_mustach_module modules/echo-nginx-module modules/ngx_brotli/static modules/ngx_brotli/filter modules/headers-more-nginx-module modules/nginx-push-stream-module modules/ngx_http_substitutions_filter_module ' '--conf-path=/etc/nginx/nginx.conf' '--error-log-path=/var/log/nginx/error.log' '--group=nginx' '--http-client-body-temp-path=/var/tmp/nginx/client_body_temp' '--http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp' '--http-log-path=/var/log/nginx/access.log' '--http-proxy-temp-path=/var/tmp/nginx/proxy_temp' '--http-scgi-temp-path=/var/tmp/nginx/scgi_temp' '--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp' '--lock-path=/run/nginx/nginx.lock' '--modules-path=/usr/local/lib/nginx' '--pid-path=/run/nginx/nginx.pid' '--prefix=/etc/nginx' '--sbin-path=/usr/local/bin/nginx' '--user=nginx' '--with-cc-opt=-Wextra -Wwrite-strings -Wmissing-prototypes -Werror -Wno-discarded-qualifiers' --with-compat --with-file-aio --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module '--with-http_geoip_module=dynamic' --with-http_gunzip_module --with-http_gzip_static_module '--with-http_image_filter_module=dynamic' --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module '--with-http_xslt_module=dynamic' --with-pcre --with-pcre-jit --with-poll_module --with-select_module '--with-stream=dynamic' '--with-stream_geoip_module=dynamic' --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads
RekGRpth commented 1 year ago

I try in docker on alpine 3.18 with gcc 12, ubuntu jammy with gcc 11 and debian sid with gcc 12

VBart commented 1 year ago

It fails because of additional warnings, you've specified using the --with-cc-opt= option. Notably this error is cased by -Wmissing-prototypes. What is the reason to specify this compiler option?

RekGRpth commented 1 year ago

Notably this error is cased by -Wmissing-prototypes. What is the reason to specify this compiler option?

To check missing prototypes

VBart commented 1 year ago

Notably this error is cased by -Wmissing-prototypes. What is the reason to specify this compiler option?

To check missing prototypes

Why do you need to check it? In C it's ok to have a function call without visible prototype. Moreover, nginx coding style doesn't mandate prototypes for each function and, hence, doesn't enable this warning by default during compilation.

The prototype of this particular function has been intentionally not put into a header file as it's considered not a part of public API.

RekGRpth commented 1 year ago

Moreover, nginx coding style doesn't mandate prototypes for each function and, hence, doesn't enable this warning by default during compilation

I always compile nginx with -Wmissing-prototypes and it is OK. I will try to compile angie without it...

VBart commented 1 year ago

In my configuration it failed even earlier, because I also include NJS module from nginx into the compilation process:

../njs/nginx/ngx_js_fetch.c:655:1: error: no previous prototype for ‘ngx_js_ext_fetch’ [-Werror=missing-prototypes]
  655 | ngx_js_ext_fetch(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
      | ^~~~~~~~~~~~~~~~
../njs/nginx/ngx_js_fetch.c:4017:1: error: no previous prototype for ‘ngx_js_fetch_init’ [-Werror=missing-prototypes]
 4017 | ngx_js_fetch_init(njs_vm_t *vm, ngx_log_t *log)
      | ^~~~~~~~~~~~~~~~~

And it will fail with nginx as well.

RekGRpth commented 1 year ago

without -Wmissing-prototypes everything is OK, thanx