Skip to content

NGX_VERSION=1.24.0: unresolved imports crate::ffi::ngx_http_v2_module, crate::ffi::ngx_http_v2_srv_conf_t #146

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

Closed
DanielDewberry opened this issue Apr 3, 2025 · 2 comments · Fixed by #147

Comments

@DanielDewberry
Copy link

Compiling with NGX_VERSION=1.24.0 on Ubuntu 24.04 yields the following error:

   Compiling ngx v0.5.0 (/root/ngx-rust)
error[E0432]: unresolved imports `crate::ffi::ngx_http_v2_module`, `crate::ffi::ngx_http_v2_srv_conf_t`
   --> src/http/conf.rs:245:22
    |
245 |     use crate::ffi::{ngx_http_v2_module, ngx_http_v2_srv_conf_t};
    |                      ^^^^^^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^^^^^ no `ngx_http_v2_srv_conf_t` in `ffi`
    |                      |
    |                      no `ngx_http_v2_module` in `ffi`
    |
help: a similar name exists in the module
    |
245 -     use crate::ffi::{ngx_http_v2_module, ngx_http_v2_srv_conf_t};
245 +     use crate::ffi::{ngx_http_max_module, ngx_http_v2_srv_conf_t};
    |
help: a similar name exists in the module
    |
245 -     use crate::ffi::{ngx_http_v2_module, ngx_http_v2_srv_conf_t};
245 +     use crate::ffi::{ngx_http_v2_module, ngx_http_ssl_srv_conf_t};
    |

To Reproduce

  1. Install the dependencies in a fresh Ubuntu 24.04 environment
  2. Clone this repository
  3. Build the project with NGX_VERSION=1.24.0
NGX_VERSION=1.24.0 cargo build --package=examples --examples --release

Expected behavior

Successful build, for NGINX 1.24.0 (the version available in the Ubuntu 24.04 archive).

Your environment

  • Version of the repo - b6e80fc
  • Version of ngx-rust - 0.4.1
  • Version of Rust - rustc 1.86.0 (05f9846f8 2025-03-31)
  • Version of NGINX - 1.24.0
  • OS - Ubuntu 24.04
  • Environment: LXD container

Additional context

  1. The examples build when NGX_VERSION=1.26.0

  2. Pertinent build artefact /root/ngx-rust/target/release/.fingerprint/ngx-04e72e0095884a4e/output-lib-ngx:

{
  "$message_type": "diagnostic",
  "message": "unresolved imports `crate::ffi::ngx_http_v2_module`, `crate::ffi::ngx_http_v2_srv_conf_t`",
  "code": {
    "code": "E0432",
    "explanation": "An import was unresolved.\n\nErroneous code example:\n\n```compile_fail,E0432\nuse something::Foo; // error: unresolved import `something::Foo`.\n```\n\nIn Rust 2015, paths in `use` statements are relative to the crate root. To\nimport items relative to the current and parent modules, use the `self::` and\n`super::` prefixes, respectively.\n\nIn Rust 2018 or later, paths in `use` statements are relative to the current\nmodule unless they begin with the name of a crate or a literal `crate::`, in\nwhich case they start from the crate root. As in Rust 2015 code, the `self::`\nand `super::` prefixes refer to the current and parent modules respectively.\n\nAlso verify that you didn't misspell the import name and that the import exists\nin the module from where you tried to import it. Example:\n\n```\nuse self::something::Foo; // Ok.\n\nmod something {\n    pub struct Foo;\n}\n# fn main() {}\n```\n\nIf you tried to use a module from an external crate and are using Rust 2015,\nyou may have missed the `extern crate` declaration (which is usually placed in\nthe crate root):\n\n```edition2015\nextern crate core; // Required to use the `core` crate in Rust 2015.\n\nuse core::any;\n# fn main() {}\n```\n\nSince Rust 2018 the `extern crate` declaration is not required and\nyou can instead just `use` it:\n\n```edition2018\nuse core::any; // No extern crate required in Rust 2018.\n# fn main() {}\n```\n"
  },
  "level": "error",
  "spans": [
    {
      "file_name": "src/http/conf.rs",
      "byte_start": 9362,
      "byte_end": 9380,
      "line_start": 245,
      "line_end": 245,
      "column_start": 22,
      "column_end": 40,
      "is_primary": true,
      "text": [
        {
          "text": "    use crate::ffi::{ngx_http_v2_module, ngx_http_v2_srv_conf_t};",
          "highlight_start": 22,
          "highlight_end": 40
        }
      ],
      "label": "no `ngx_http_v2_module` in `ffi`",
      "suggested_replacement": null,
      "suggestion_applicability": null,
      "expansion": null
    },
    {
      "file_name": "src/http/conf.rs",
      "byte_start": 9382,
      "byte_end": 9404,
      "line_start": 245,
      "line_end": 245,
      "column_start": 42,
      "column_end": 64,
      "is_primary": true,
      "text": [
        {
          "text": "    use crate::ffi::{ngx_http_v2_module, ngx_http_v2_srv_conf_t};",
          "highlight_start": 42,
          "highlight_end": 64
        }
      ],
      "label": "no `ngx_http_v2_srv_conf_t` in `ffi`",
      "suggested_replacement": null,
      "suggestion_applicability": null,
      "expansion": null
    }
  ],
  "children": [
    {
      "message": "a similar name exists in the module",
      "code": null,
      "level": "help",
      "spans": [
        {
          "file_name": "src/http/conf.rs",
          "byte_start": 9362,
          "byte_end": 9380,
          "line_start": 245,
          "line_end": 245,
          "column_start": 22,
          "column_end": 40,
          "is_primary": true,
          "text": [
            {
              "text": "    use crate::ffi::{ngx_http_v2_module, ngx_http_v2_srv_conf_t};",
              "highlight_start": 22,
              "highlight_end": 40
            }
          ],
          "label": null,
          "suggested_replacement": "ngx_http_max_module",
          "suggestion_applicability": "MaybeIncorrect",
          "expansion": null
        }
      ],
      "children": [],
      "rendered": null
    },
    {
      "message": "a similar name exists in the module",
      "code": null,
      "level": "help",
      "spans": [
        {
          "file_name": "src/http/conf.rs",
          "byte_start": 9382,
          "byte_end": 9404,
          "line_start": 245,
          "line_end": 245,
          "column_start": 42,
          "column_end": 64,
          "is_primary": true,
          "text": [
            {
              "text": "    use crate::ffi::{ngx_http_v2_module, ngx_http_v2_srv_conf_t};",
              "highlight_start": 42,
              "highlight_end": 64
            }
          ],
          "label": null,
          "suggested_replacement": "ngx_http_ssl_srv_conf_t",
          "suggestion_applicability": "MaybeIncorrect",
          "expansion": null
        }
      ],
      "children": [],
      "rendered": null
    }
  ],
  "rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror[E0432]\u001b[0m\u001b[0m\u001b[1m: unresolved imports `crate::ffi::ngx_http_v2_module`, `crate::ffi::ngx_http_v2_srv_conf_t`\u001b[0m\n\u001b[0m   \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m--> \u001b[0m\u001b[0msrc/http/conf.rs:245:22\u001b[0m\n\u001b[0m    \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m245\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m \u001b[0m\u001b[0m    use crate::ffi::{ngx_http_v2_module, ngx_http_v2_srv_conf_t};\u001b[0m\n\u001b[0m    \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m                      \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^^^^^^^^^^^^^^^^^^\u001b[0m\u001b[0m  \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m^^^^^^^^^^^^^^^^^^^^^^\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9mno `ngx_http_v2_srv_conf_t` in `ffi`\u001b[0m\n\u001b[0m    \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m                      \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9m|\u001b[0m\n\u001b[0m    \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\u001b[0m                      \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;9mno `ngx_http_v2_module` in `ffi`\u001b[0m\n\u001b[0m    \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: a similar name exists in the module\u001b[0m\n\u001b[0m    \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m245\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;9m- \u001b[0m\u001b[0m    use crate::ffi::{\u001b[0m\u001b[0m\u001b[38;5;9mngx_http_v2_module\u001b[0m\u001b[0m, ngx_http_v2_srv_conf_t};\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m245\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;10m+ \u001b[0m\u001b[0m    use crate::ffi::{\u001b[0m\u001b[0m\u001b[38;5;10mngx_http_max_module\u001b[0m\u001b[0m, ngx_http_v2_srv_conf_t};\u001b[0m\n\u001b[0m    \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;14mhelp\u001b[0m\u001b[0m: a similar name exists in the module\u001b[0m\n\u001b[0m    \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m245\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;9m- \u001b[0m\u001b[0m    use crate::ffi::{ngx_http_v2_module, \u001b[0m\u001b[0m\u001b[38;5;9mngx_http_v2_srv_conf_t\u001b[0m\u001b[0m};\u001b[0m\n\u001b[0m\u001b[1m\u001b[38;5;12m245\u001b[0m\u001b[0m \u001b[0m\u001b[0m\u001b[38;5;10m+ \u001b[0m\u001b[0m    use crate::ffi::{ngx_http_v2_module, \u001b[0m\u001b[0m\u001b[38;5;10mngx_http_ssl_srv_conf_t\u001b[0m\u001b[0m};\u001b[0m\n\u001b[0m    \u001b[0m\u001b[0m\u001b[1m\u001b[38;5;12m|\u001b[0m\n\n"
}
{
  "$message_type": "diagnostic",
  "message": "aborting due to 1 previous error",
  "code": null,
  "level": "error",
  "spans": [],
  "children": [],
  "rendered": "\u001b[0m\u001b[1m\u001b[38;5;9merror\u001b[0m\u001b[0m\u001b[1m: aborting due to 1 previous error\u001b[0m\n\n"
}
{
  "$message_type": "diagnostic",
  "message": "For more information about this error, try `rustc --explain E0432`.",
  "code": null,
  "level": "failure-note",
  "spans": [],
  "children": [],
  "rendered": "\u001b[0m\u001b[1mFor more information about this error, try `rustc --explain E0432`.\u001b[0m\n"
}
@DanielDewberry DanielDewberry changed the title unresolved imports crate::ffi::ngx_http_v2_module, crate::ffi::ngx_http_v2_srv_conf_t NGX_VERSION=1.24.0: unresolved imports crate::ffi::ngx_http_v2_module, crate::ffi::ngx_http_v2_srv_conf_t Apr 3, 2025
@DanielDewberry
Copy link
Author

Thank you for your quick response

@DanielDewberry
Copy link
Author

Pulled your commit into my local project. Magic. The examples now compile, thank you.

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

Successfully merging a pull request may close this issue.

1 participant