BiagioFesta / ls-qpack-rs

QPACK Field Compression for HTTP/3 RFC 9204 in Rust based on ls-qpack
Apache License 2.0
6 stars 5 forks source link

Can't build because 'stdio.h' can't be found #9

Closed porkiedev closed 9 months ago

porkiedev commented 10 months ago

I am trying to use the wtransport crate for a project, and wtransport uses ls-qpack.

While building ls-qpack on Windows, it fails with Unable to generate bindings: ClangDiagnostic("./deps/ls-qpack\\lsqpack.h:38:10: fatal error: 'stdio.h' file not found\n").

I tried to build the same program under linux (Ubuntu 22.04 LTS) and it worked perfectly.

Any help resolving this problem would be great! I love rust because I can rely on cargo as my only package manager. It defeats the purpose if I have to start managing C/C++ dependencies for my rust project.

Update: I managed to get it to build by running cargo build from inside the Developer Command Prompt for VS 2022 (instead of a regular command prompt). While this works, I still feel like it's a little clunky. It would be great if there could be an alternate, more rust-like solution, or perhaps update the documentation so people know that they need to build ls-qpack from inside of an environment with stdio.h

BiagioFesta commented 10 months ago

From my prev answer here: https://github.com/BiagioFesta/ls-qpack-rs/issues/2#issuecomment-1575711072

Unfortunately it is harder to deal with dependencies in Windows I guess. However, I built this crate in Windows without any problem by just ensuring to have installed:


I am not a Windows-guy, but I guess, in your case, your environment is missing some variable (e.g., PATH or something). The C toolchain (compiler, std headers, ...) are installed with Windows Visual Studio (with a default installation, everything should be easily found by bindgen).


It would be great if there could be an alternate, more rust-like solution, or perhaps update the documentation so people know that they need to build ls-qpack from inside of an environment with stdio.h

I totally agree on these points.

Allow me to comment on these two points:

Thank you for your feedback, and any help is more than welcome!

porkiedev commented 10 months ago

I would agree that updating the documentation is a good short-term solution.

Ultimately, I like the idea of asking the h3 maintainers to put their qpack implementation into a dedicated crate.

For the time being, I will continue to build my code from inside a Visual Studio environment, with the hopes that this problem will be addressed in the future. If I get the motivation and time, I might reach out to the h3 maintainers and 'politely beg' them to put their qpack implementation into a dedicated crate myself.

Thanks for the help! :)

porkiedev commented 10 months ago

I was doing some unrelated research and came across https://github.com/mozilla/neqo/. A mozilla-maintained QUIC implementation. In the source tree, there's a crate called neqo-qpack. neqo isn't available on crates.io but it still may be worth looking into!

porkiedev commented 10 months ago

I did not mean to close the issue...

BiagioFesta commented 9 months ago

Just a note: if you were using wtransport (https://github.com/BiagioFesta/wtransport).

Starting from today (master branch, but a release will come soon), ls-qpack-rs is not needed anymore.

wtransport now is pure-rust implementation and it does not require cmake, llvm, C-compiler anymore. You can read more here: https://github.com/BiagioFesta/wtransport/pull/119

BiagioFesta commented 9 months ago

You should now be able to compile wtransport just with rust toolchain

porkiedev commented 9 months ago

That's awesome. In that case, my problem is resolved. I'll keep this issue open since it'd still be nice to be able to natively build ls-qpack.

Feel free to close the issue if you're not interested in resolving this.

BiagioFesta commented 9 months ago

ls-qpack-rs is back-ed by ls-qpack (a C library); and that implies ls-qpack-rs requires some deps to build with C code.

As mentioned, ls-qpack-rs requires:

I know this should be properly documented, as required in: https://github.com/BiagioFesta/ls-qpack-rs/issues/8

ls-qpack-rs will never be a Rust-pure native library, as it would need to write another completely different library.

Even because that's what I've actually done in wtransport, writing a pure-rust (minimal) QPACK module.


Regarding your particular issue, if you have the above requirements installed everything should work quite out of the box. I have tested by myself, and CI (in wtransport) when it used to use ls-qpack-rs was working.

By just looking at your log-error, I guess it might be something depending on the environment. For example, VisualStudio is not installed, or it conflicts with another C-compiler (.e.g, mingw). Headers file (SDKs, etc) are not correctly installed/something is missing in the C-toolchain

porkiedev commented 9 months ago

Sounds good! I will go ahead and close this issue in favor of #8 for better documentation.

Thanks for the help :)