GithubHelp home page GithubHelp logo

fitzgen / bindgen-tutorial-bzip2-sys Goto Github PK

View Code? Open in Web Editor NEW
78.0 78.0 11.0 8 KB

A tutorial/example crate for generating C/C++ bindings on-the-fly with libbindgen

License: The Unlicense

Rust 99.62% C 0.38%

bindgen-tutorial-bzip2-sys's People

Contributors

bartmassey avatar fitzgen avatar hartmut avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

bindgen-tutorial-bzip2-sys's Issues

way to inspect generated code?

is there one? I think it would be simpler for me to look at the rust definitions of the functions I want instead of reading the c header file.

Cargo build error

error: failed to run custom build command for `bindgen-tutorial-bzip2-sys v0.1.0

Caused by:
process didn't exit successfully: C:\Users\jm\projects\bindgen\implemented\bindgen-tutorial-bzip2-sys\target\debug\build\bindgen-tutorial-bzip2-sys-ad82f90bccc15102\build-script-build (exit code: 101)
--- stdout
cargo:rustc-link-lib=bz2

--- stderr
wrapper.h:1:10: fatal error: 'bzlib.h' file not found
thread 'main' panicked at 'Unable to generate bindings: ClangDiagnostic("wrapper.h:1:10: fatal error: 'bzlib.h' file not
found\n")', build.rs:12:10
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Bindings.rs created, but tests don't run on Windows 10.

I'm getting this error:

   Compiling bindgen-bzip v0.1.0 (E:\Code\Rust\bindgen-bzip)
    Finished test [unoptimized + debuginfo] target(s) in 0.93s  
     Running target\debug\deps\bindgen_bzip-35251cdc4c688645.exe
error: test failed, to rerun pass '-p bindgen-bzip --lib'

Caused by:
  process didn't exit successfully: `E:\Code\Rust\bindgen-bzip\target\debug\deps\bindgen_bzip-35251cdc4c688645.exe tests::round_trip_compression_decompression --exact --nocapture` (exit code: 0xc0000135, STATUS_DLL_NOT_FOUND)The terminal process "C:\Windows\System32\cmd.exe /d /c cargo test --package bindgen-bzip --lib -- tests::round_trip_compression_decompression --exact --nocapture" terminated with exit code: 3221225781.

I'm using bindgen 0.57.0. Do you have any ideas?

cargo build error

PS E:\code\rust\code\bindgen-tutorial-bzip2-sys> cargo build
   Compiling bindgen-tutorial-bzip2-sys v0.1.0 (E:\code\rust\code\bindgen-tutorial-bzip2-sys)
error: failed to run custom build command for `bindgen-tutorial-bzip2-sys v0.1.0 (E:\code\rust\code\bindgen-tutorial-bzip2-sys)`

Caused by:
  process didn't exit successfully: `E:\code\rust\code\bindgen-tutorial-bzip2-sys\target\debug\build\bindgen-tutorial-bzip2-sys-f0e339024d515ed8\build-script-build` (exit code: 101)
  --- stdout
  cargo:rustc-link-lib=bz2

  --- stderr
  thread 'main' panicked at 'Unable to find libclang: "couldn't find any valid shared libraries matching: ['clang.dll', 'libclang.dll'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [(C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\Llvm\\bin\\libclang.dll: invalid DLL (32-bit))])"', C:\Users\Administrator\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bindgen-0.66.0\lib.rs:604:31
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
PS E:\code\rust\code\bindgen-tutorial-bzip2-sys>

Undefined references for native library.

Hi. I just tried to build this on Linux Ubuntu 16.04, using rustc v 1.20.0 and cargo v0.21.0. It's giving me undefined references to the functions in the native library.

[Note that this same combination of tools seem to work fine under Ubuntu 14.04]

$ git clone https://github.com/fitzgen/bindgen-tutorial-bzip2-sys.git
Cloning into 'bindgen-tutorial-bzip2-sys'...
remote: Counting objects: 28, done.
remote: Total 28 (delta 0), reused 0 (delta 0), pack-reused 28
Unpacking objects: 100% (28/28), done.
Checking connectivity... done.

$ cd bindgen-tutorial-bzip2-sys/

$ cargo build
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling glob v0.2.11
   Compiling peeking_take_while v0.1.2
   Compiling vec_map v0.8.0
   Compiling ansi_term v0.9.0
   Compiling cfg-if v0.1.2
   Compiling term v0.4.6
   Compiling void v1.0.2
   Compiling log v0.3.8
   Compiling bitflags v0.8.2
   Compiling libloading v0.4.2
   Compiling rustc-serialize v0.3.24
   Compiling regex-syntax v0.4.1
   Compiling strsim v0.6.0
   Compiling libc v0.2.31
   Compiling lazy_static v0.2.8
   Compiling unicode-width v0.1.4
   Compiling bitflags v0.9.1
   Compiling unicode-xid v0.0.4
   Compiling utf8-ranges v1.0.0
   Compiling unreachable v1.0.0
   Compiling term_size v0.3.0
   Compiling memchr v1.0.1
   Compiling atty v0.2.2
   Compiling clang-sys v0.19.0
   Compiling thread_local v0.3.4
   Compiling textwrap v0.8.0
   Compiling aho-corasick v0.6.3
   Compiling nom v3.2.0
   Compiling clap v2.26.2
   Compiling regex v0.2.2
   Compiling cexpr v0.2.2
   Compiling syntex_pos v0.58.1
   Compiling syntex_errors v0.58.1
   Compiling syntex_syntax v0.58.1
   Compiling env_logger v0.4.3
   Compiling aster v0.41.0
   Compiling syntex v0.58.1
   Compiling quasi v0.32.0
   Compiling quasi_codegen v0.32.0
   Compiling bindgen v0.26.3
   Compiling bindgen-tutorial-bzip2-sys v0.1.0 (file:///home/fmp/tmp/bindgen-tutorial-bzip2-sys)
    Finished dev [unoptimized + debuginfo] target(s) in 80.50 secs

$ cargo test
   Compiling bindgen-tutorial-bzip2-sys v0.1.0 (file:///home/fmp/tmp/bindgen-tutorial-bzip2-sys)
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/fmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/fmp/tmp/bindgen-tutorial-bzip2-sys/target/debug/deps/bindgen_tutorial_bzip2_sys-845fbd2219e8ea65.0.o" "-o" "/home/fmp/tmp/bindgen-tutorial-bzip2-sys/target/debug/deps/bindgen_tutorial_bzip2_sys-845fbd2219e8ea65" "/home/fmp/tmp/bindgen-tutorial-bzip2-sys/target/debug/deps/bindgen_tutorial_bzip2_sys-845fbd2219e8ea65.crate.allocator.o" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/home/fmp/tmp/bindgen-tutorial-bzip2-sys/target/debug/deps" "-L" "/home/fmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-l" "bz2" "-Wl,-Bstatic" "/home/fmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-30d4d638be038598.rlib" "/home/fmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-c58b62d995849f6d.rlib" "/home/fmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libterm-359c3de19d4def40.rlib" "/home/fmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-29fb1fb52cf57377.rlib" "/home/fmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-9cbadc6554202be9.rlib" "/home/fmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-42efcbbdeb607d44.rlib" "/home/fmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-618c266cf9124966.rlib" "/home/fmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_system-3c10208cdd7e61cb.rlib" "/home/fmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-16f3b02b9a976b94.rlib" "/home/fmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-bc70b4efeaeb398c.rlib" "/home/fmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_unicode-a0ad42dc8f5856aa.rlib" "/home/fmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-32f648f7f7567c6c.rlib" "/home/fmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-21491ce3d14f1ef2.rlib" "/home/fmp/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-b9713bd7f605c0b2.rlib" "-Wl,-Bdynamic" "-l" "dl" "-l" "rt" "-l" "pthread" "-l" "pthread" "-l" "gcc_s" "-l" "c" "-l" "m" "-l" "rt" "-l" "pthread" "-l" "util"
  = note: /home/fmp/tmp/bindgen-tutorial-bzip2-sys/target/debug/deps/bindgen_tutorial_bzip2_sys-845fbd2219e8ea65.0.o: In function `bindgen_tutorial_bzip2_sys::tests::round_trip_compression_decompression':
          /home/fmp/tmp/bindgen-tutorial-bzip2-sys/src/lib.rs:21: undefined reference to `BZ2_bzCompressInit'
          /home/fmp/tmp/bindgen-tutorial-bzip2-sys/src/lib.rs:38: undefined reference to `BZ2_bzCompress'
          /home/fmp/tmp/bindgen-tutorial-bzip2-sys/src/lib.rs:49: undefined reference to `BZ2_bzCompressEnd'
          /home/fmp/tmp/bindgen-tutorial-bzip2-sys/src/lib.rs:58: undefined reference to `BZ2_bzDecompressInit'
          /home/fmp/tmp/bindgen-tutorial-bzip2-sys/src/lib.rs:74: undefined reference to `BZ2_bzDecompress'
          /home/fmp/tmp/bindgen-tutorial-bzip2-sys/src/lib.rs:86: undefined reference to `BZ2_bzDecompressEnd'
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

error: Could not compile `bindgen-tutorial-bzip2-sys`.

To learn more, run the command again with --verbose.

tutorial not working (anymore?)

I'm learning bindgen for the first time, and I'm busy going through the tutorial, however it broke at step 3.1.4. I then downloaded the full tutorial code here and it broke the same way.

cargo version
cargo 1.37.0 (9edd08916 2019-08-02)
uname -r
5.2.11-arch1-1-ARCH
----
   Compiling bindgen-tutorial-bzip2-sys v0.1.0 (/home/brendan/development/scratch/bindgen-tutorial-bzip2-sys)
warning: couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
warning: set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable
error: unexpected close delimiter: `]`
   --> /home/brendan/development/scratch/bindgen-tutorial-bzip2-sys/target/debug/build/bindgen-tutorial-bzip2-sys-740cb44789bd8af3/out/bindings.rs:287:32
    |
287 | #[derive(Copy, Clone)]; 4usize ] , _bindgen_union_align : u32 , }#[test]
    |                                ^ unexpected close delimiter

error: aborting due to previous error

The following warnings were emitted during compilation:

warning: couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
warning: set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable

error: Could not compile `bindgen-tutorial-bzip2-sys`.

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.