arturoc / gstreamer1.0-rs

Idiomatic bindings for Gstreamer on Rust.
MIT License
36 stars 14 forks source link

gstreamer does not build in rust 1.4, cargo 0.5. #5

Closed coriolinus closed 8 years ago

coriolinus commented 8 years ago
[master]> rustc --version
rustc 1.4.0 (8ab8581f6 2015-10-27)
[master]> cargo --version
cargo 0.5.0-nightly (833b947 2015-09-13)
[master]> cargo build --verbose
   Compiling gstreamer v0.2.7 (file:///D:/Users/coriolinus/Documents/GitHub/gstreamer1.0-rs)
     Running `rustc build.rs --crate-name build_script_build --crate-type bin -g --out-dir D:\Users\coriolinus\Documents\GitHub\gstreamer1.0-rs\target\debug\build\gstreamer-c4035b655e0fdb42 --emit=dep-info,link -L dependency=D:\Users\coriolinus\Documents\GitHub\gstreamer1.0-rs\target\debug -L dependency=D:\Users\coriolinus\Documents\GitHub\gstreamer1.0-rs\target\debug\deps`
       Fresh libc v0.1.12
build.rs:13:1: 13:19 error: use of unstable library feature 'libc': use `libc` from crates.io (see issue #27783)
build.rs:13 extern crate libc;
            ^~~~~~~~~~~~~~~~~~
build.rs:20:37: 20:51 error: use of unstable library feature 'libc': use `libc` from crates.io (see issue #27783)
build.rs:20     let key = if mem::size_of::<*const ::libc::c_void>() == 4{
                                                   ^~~~~~~~~~~~~~
error: aborting due to 2 previous errors
Could not compile `gstreamer`.

Caused by:
  Process didn't exit successfully: `rustc build.rs --crate-name build_script_build --crate-type bin -g --out-dir D:\Users\coriolinus\Documents\GitHub\gstreamer1.0-rs\target\debug\build\gstreamer-c4035b655e0fdb42 --emit=dep-info,link -L dependency=D:\Users\coriolinus\Documents\GitHub\gstreamer1.0-rs\target\debug -L dependency=D:\Users\coriolinus\Documents\GitHub\gstreamer1.0-rs\target\debug\deps` (exit code: 101)

I've tested this with libc 0.1.12 and 0.2.2; they both return the same error.

The referred error (rust-lang/rust#27783) is a bit opaque to me given that as far as I can tell, you do in fact require the use of libc from crates.io in your Cargo.toml here.

Any ideas what's going on here and how to get this to compile, or do you feel it's more useful to just wait until libc stabilizes?

arturoc commented 8 years ago

it's working for me fine, have you tried to run cargo update first? it might be trying to use an old version of libc. it's pulling version 0.2.2 for me

coriolinus commented 8 years ago

It pulled 2.2 for me initially, but gave the same error. I downgraded to 1.12 because that was what was in the passing Travis build, in case it had been a breaking upgrade.

If it's working for you, I'm curious what exact rustc / cargo versions are you using? Given that rustc's error points to a discussion of stabilization of libc in future rustc versions, I suspect that this issue is (hopefully) only temporarily unstable. That said, I'd be willing to use an older version of the compiler if that makes the code work.

arturoc commented 8 years ago

i've just installed 1.4 stable from the web, i'm using

cargo 0.5.0-nightly (833b947 2015-09-13)

and

rustc 1.4.0 (8ab8581f6 2015-10-27)

on linux

coriolinus commented 8 years ago

It looks like the only difference in our setup right now is the platform; I'm on Windows. While I had thought that might be an area of concern, I wasn't expecting it to come up in the Rust compile phase!

I may be able to get a linux box up and running in a little while to see if I can duplicate your results, but for now, I think I'm going to file this under Windows-specific weirdness.

On Mon, Dec 7, 2015 at 7:59 PM, arturo notifications@github.com wrote:

i've just installed 1.4 stable from the web, i'm using

cargo 0.5.0-nightly (833b947 2015-09-13)

and

rustc 1.4.0 (8ab8581f6 2015-10-27)

on linux

— Reply to this email directly or view it on GitHub https://github.com/arturoc/gstreamer1.0-rs/issues/5#issuecomment-162624485 .

starryangt commented 8 years ago

Adding 'libc = "*"' to [build-dependencies] seems to fix it on windows, 1.5 stable and 1.6 beta.

coriolinus commented 8 years ago

Alternately, you can replace build.rs:20 with the following:

let key = if cfg!(target_pointer_width = "32") {

and it appears to work then, also.

arturoc commented 8 years ago

thanks!

arturoc commented 8 years ago

i've also removed the dependency with libc since the needed types are now in std::os::raw