GithubHelp home page GithubHelp logo

nghttp2-rs's Introduction

nghttp2-sys

A common library for linking nghttp2 to rust programs (also known as libnghttp2).

Generating bindings

Before bindgen:

  • Copy nghttp2ver.h.in to nghttp2ver.h
  • Edit nghttp2ver.h to remove @FOO@, replacing with 0
$ bindgen \
  ./nghttp2/lib/includes/nghttp2/nghttp2.h \
  -o src/lib.rs \
  --no-layout-tests \
  --distrust-clang-mangling \
  --no-prepend-enum-name \
  --rustfmt-bindings \
  --whitelist-function '.*nghttp2.*' \
  --whitelist-type '.*nghttp2.*' \
  --whitelist-var '.*nghttp2.*' \
  -- \
  -I ./nghttp2/lib/includes

Afterwards

  • Remove *vprintf*
  • Remove va_list-related things
  • Add #![allow(bad_style)]

License

This project is licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in nghttp2-sys by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

nghttp2-rs's People

Contributors

alexcrichton avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nghttp2-rs's Issues

build.rs should specify correct nghttp version

nghttp2_version returns "1.33.90" as the version string. It seems this value is hardcoded in build.rs. Probably it should be updated to match whatever version of nghttp is being referenced?

Recommended way to link to libnghttp2

Hi, on compilation I get the following error

libnghttp2-sys-67ea4c7b35af0690/build-script-build` (exit code: 1)
  --- stdout
  TARGET = Some("x86_64-apple-darwin")
  OPT_LEVEL = Some("0")
  HOST = Some("x86_64-apple-darwin")
  CC_x86_64-apple-darwin = None
  CC_x86_64_apple_darwin = None
  HOST_CC = None
  CC = Some("clang")
  CFLAGS_x86_64-apple-darwin = None
  CFLAGS_x86_64_apple_darwin = None
  HOST_CFLAGS = None
  CFLAGS = None
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  running: "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-I" "nghttp2/lib/includes" "-I" "/private/tmp/nix-build-vector-0.14.0.drv-0/source/target/debug/build/libnghttp2-sys-a9070bd53e651889/out/i/include" "-DNGHTTP2_STATICLIB" "-DHAVE_NETINET_IN" "-DHAVE_ARPA_INET_H" "-o" "/private/tmp/nix-build-vector-0.14.0.drv-0/source/target/debug/build/libnghttp2-sys-a9070bd53e651889/out/i/lib/nghttp2/lib/nghttp2_buf.o" "-c" "nghttp2/lib/nghttp2_buf.c"
  cargo:warning=In file included from nghttp2/lib/nghttp2_buf.c:25:
  cargo:warning=In file included from nghttp2/lib/nghttp2_buf.h:32:
  cargo:warning=nghttp2/lib/includes/nghttp2/nghttp2.h:55:10: fatal error: 'nghttp2/nghttp2ver.h' file not found
  cargo:warning=#include <nghttp2/nghttp2ver.h>
  cargo:warning=         ^~~~~~~~~~~~~~~~~~~~~~
  cargo:warning=1 error generated.
  exit code: 1
  running: "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-I" "nghttp2/lib/includes" "-I" "/private/tmp/nix-build-vector-0.14.0.drv-0/source/target/debug/build/libnghttp2-sys-a9070bd53e651889/out/i/include" "-DNGHTTP2_STATICLIB" "-DHAVE_NETINET_IN" "-DHAVE_ARPA_INET_H" "-o" "/private/tmp/nix-build-vector-0.14.0.drv-0/source/target/debug/build/libnghttp2-sys-a9070bd53e651889/out/i/lib/nghttp2/lib/nghttp2_callbacks.o" "-c" "nghttp2/lib/nghttp2_callbacks.c"
  cargo:warning=In file included from nghttp2/lib/nghttp2_callbacks.c:25:
  cargo:warning=In file included from nghttp2/lib/nghttp2_callbacks.h:32:
  cargo:warning=nghttp2/lib/includes/nghttp2/nghttp2.h:55:10: fatal error: 'nghttp2/nghttp2ver.h' file not found
  cargo:warning=#include <nghttp2/nghttp2ver.h>
  cargo:warning=         ^~~~~~~~~~~~~~~~~~~~~~
  cargo:warning=1 error generated.
  exit code: 1

  --- stderr


  error occurred: Command "clang" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "--target=x86_64-apple-darwin" "-I" "nghttp2/lib/includes" "-I" "/private/tmp/nix-build-vector-0.14.0.drv-0/source/target/debug/build/libnghttp2-sys-a9070bd53e651889/out/i/include" "-DNGHTTP2_STATICLIB" "-DHAVE_NETINET_IN" "-DHAVE_ARPA_INET_H" "-o" "/private/tmp/nix-build-vector-0.14.0.drv-0/source/target/debug/build/libnghttp2-sys-a9070bd53e651889/out/i/lib/nghttp2/lib/nghttp2_buf.o" "-c" "nghttp2/lib/nghttp2_buf.c" with args "clang" did not execute successfully (status code exit code: 1).

it looks like it's because of a missing libnghttp2 include flag.
What is the recommended way to pass an external libnghttp2 for compilation?
Is it something like

RUSTFLAGS="-C link-args='-I /usr/lib/libnghttp2/include'" cargo build

just for reference I'm trying to run cargo test on vector vector.dev/ which has a dependency on curl-sys which has a dependency on nghttp2-rs

Update documentation

Is this crate ready for production? Can you please provide some examples? Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.