Skip to content

ngx crate doesn't compile without manual fixes #156

Open
@annmuor

Description

@annmuor

Describe the bug
Default compile flags for nginx-sys doesn't allow to compile ngx crate without manual intervention on gcc 15.1 (Arch Linux rolling)

There's 2 erros to fix:

  1. Default ZLIB_VERSION (1.3.0) doesn't exist on the website anymore. I had to rewrite to 1.3.1
  2. nginx-sys crate compilation fails with the following error:
 src/http/v2/ngx_http_v2_filter_module.c:151:36: error: initializer-string for array of ‘unsigned char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute (6 chars into 5 available) [-Werror=unterminated-string-initialization]
 src/http/v2/ngx_http_v2_filter_module.c:154:9: error: initializer-string for array of ‘unsigned char’ truncates NUL terminator but destination lacks ‘nonstring’ attribute (13 chars into 12 available) [-Werror=unterminated-string-initialization]

To fix it I had to manually add attribute ((nonstring)) to declaration into .cargo/registry/.../

To Reproduce

  1. cargo init --lib
  2. cargo add ngx
  3. cargo build

Expected behavior
Cargo builds simple library

Your environment

  • Version of ngx = 0.4.1
  • Version of Rust = 1.86.0
  • Version of NGINX = 1.22.0
  • Arch Linux rolling, gcc version 15.1.1 20250425 (GCC)

Additional context
I'm not sure if I need to send PR to nginx repo with attribute param or to you to change build flags, so feel free to close this issue if it's inappropriate repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions