ntex-rs / ntex

framework for composable networking services
Apache License 2.0
2.02k stars 108 forks source link

Compilation Error when Switching from tokio to glommio in ntex 2.6.0 #436

Closed pionoor closed 1 week ago

pionoor commented 2 weeks ago

Description

When switching from the tokio feature to the glommio feature in ntex 2.6.0, the crate fails to compile due to unresolved imports and missing functions.

Cargo.toml Configuration

[dependencies]
ntex = { version = "2.6.0", features = ["glommio", "compress"] }

Error Messages

  1. Unresolved import self::glommio
  2. Cannot find function spawn in the crate root (multiple occurrences)
  3. Cannot find function block_on in the crate root

Full Error Output

error[E0432]: unresolved import `self::glommio`
   --> /Users/noor/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ntex-rt-0.4.18/src/lib.rs:478:15
    |
478 | pub use self::glommio::*;
    |               ^^^^^^^ could not find `glommio` in the crate root

error[E0425]: cannot find function `spawn` in the crate root
   --> /Users/noor/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ntex-rt-0.4.18/src/arbiter.rs:117:36
    |
117 |                     let _ = crate::spawn(ArbiterController {
    |                                    ^^^^^ not found in the crate root

// ... (additional similar errors omitted for brevity)

error[E0425]: cannot find function `block_on` in the crate root
   --> /Users/noor/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ntex-rt-0.4.18/src/system.rs:135:20
    |
135 |             crate::block_on(Box::pin(async move {
    |                    ^^^^^^^^ not found in the crate root

Environment

Steps to Reproduce

  1. Create a new Rust project
  2. Add the ntex dependency with glommio feature to Cargo.toml
  3. Attempt to compile the project

Expected Behavior

The project should compile successfully with the glommio feature enabled.

Actual Behavior

The compilation fails with the errors described above.

Additional Context

This issue occurs when switching from the tokio feature to the glommio feature. It appears that some imports and functions are not properly configured for the glommio runtime.

fafhrd91 commented 2 weeks ago

do you use it on linux? do you need specifically glommio?

pionoor commented 1 week ago

I have not tried to deploy it to linux env. I was deving on my Mac before pushing. I would expect it to at least compile. I don't really need glommio but was trying to test if there is any perf gain over tokio.

fafhrd91 commented 1 week ago

it is requirement for glommio runtime. if dependency does not compile on Mac it has nothing to do with ntex. if you want to try io-uring then it is better to use compio

pionoor commented 1 week ago

Thank you for the prompt response, much appreciated.