Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error on OS X 10.11.1 with rust 1.4 #654

Closed
palango opened this issue Nov 7, 2015 · 3 comments · Fixed by #655
Closed

Compilation error on OS X 10.11.1 with rust 1.4 #654

palango opened this issue Nov 7, 2015 · 3 comments · Fixed by #655

Comments

@palango
Copy link

palango commented Nov 7, 2015

With stable rust I get the following error in a glium project:

± % cargo run                                                                              23:37:08
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling glutin v0.4.1
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:146:18: 146:62 error: the trait `objc::encode::Encode` is not implemented for the type `*mut libc::types::common::c95::c_void` [E0277]
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:146             decl.add_ivar::<*mut libc::c_void>("glutinState");
                                                                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:146:18: 146:62 help: run `rustc --explain E0277` to see a detailed explanation
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:163:31: 163:86 error: the trait `objc::encode::Encode` is not implemented for the type `*mut libc::types::common::c95::c_void` [E0277]
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:163             (&mut **delegate).set_ivar("glutinState", state_ptr as *mut libc::c_void);
                                                                                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:163:31: 163:86 help: run `rustc --explain E0277` to see a detailed explanation
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:84:54: 84:77 error: the trait `objc::encode::Encode` is not implemented for the type `*mut libc::types::common::c95::c_void` [E0277]
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:84                 let state: *mut libc::c_void = *this.get_ivar("glutinState");
                                                                                                                                                      ^~~~~~~~~~~~~~~~~~~~~~~
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:84:54: 84:77 help: run `rustc --explain E0277` to see a detailed explanation
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:93:54: 93:77 error: the trait `objc::encode::Encode` is not implemented for the type `*mut libc::types::common::c95::c_void` [E0277]
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:93                 let state: *mut libc::c_void = *this.get_ivar("glutinState");
                                                                                                                                                      ^~~~~~~~~~~~~~~~~~~~~~~
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:93:54: 93:77 help: run `rustc --explain E0277` to see a detailed explanation
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:112:54: 112:77 error: the trait `objc::encode::Encode` is not implemented for the type `*mut libc::types::common::c95::c_void` [E0277]
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:112                 let state: *mut libc::c_void = *this.get_ivar("glutinState");
                                                                                                                                                       ^~~~~~~~~~~~~~~~~~~~~~~
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:112:54: 112:77 help: run `rustc --explain E0277` to see a detailed explanation
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:120:54: 120:77 error: the trait `objc::encode::Encode` is not implemented for the type `*mut libc::types::common::c95::c_void` [E0277]
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:120                 let state: *mut libc::c_void = *this.get_ivar("glutinState");
                                                                                                                                                       ^~~~~~~~~~~~~~~~~~~~~~~
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:120:54: 120:77 help: run `rustc --explain E0277` to see a detailed explanation
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:313:33: 313:36 error: mismatched types:
 expected `*mut libc::types::common::c95::c_void`,
    found `*mut libc::c_void`
(expected enum `libc::types::common::c95::c_void`,
    found enum `libc::c_void`) [E0308]
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:313                 CGLSetParameter(obj, kCGLCPSurfaceOpacity, &mut opacity);
                                                                                                                                  ^~~
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:313:33: 313:36 help: run `rustc --explain E0308` to see a detailed explanation
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:561:31: 561:50 error: mismatched types:
 expected `*mut libc::types::common::c95::c_void`,
    found `*mut libc::c_void`
(expected enum `libc::types::common::c95::c_void`,
    found enum `libc::c_void`) [E0308]
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:561                     CGLEnable(cxt.CGLContextObj(), kCGLCECrashOnRemovedFunctions);
                                                                                                                                ^~~~~~~~~~~~~~~~~~~
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:526:17: 566:18 note: in this expansion of if let expansion
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:521:13: 569:14 note: in this expansion of if let expansion
/Users/paul/.cargo/registry/src/github.aaakk.us.kg-0a35038f75765ae4/glutin-0.4.1/src/api/cocoa/mod.rs:561:31: 561:50 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to 8 previous errors
Could not compile `glutin`.

To learn more, run the command again with --verbose.
@andy-morris
Copy link

This seems to also be happening in beta & nightly, fwiw.

@tomaka tomaka added bug labels Nov 8, 2015
@mitchmindtree
Copy link
Contributor

Also getting this error, will take a look

tomaka referenced this issue in SSheldon/rust-objc Nov 8, 2015
@SSheldon
Copy link
Contributor

SSheldon commented Nov 8, 2015

Looks like there are two issues here:

  1. The objc crate implements Encode for c_void, but it's implementing it for the libc 0.2 version and glutin is trying to use the libc 0.1 version.
  2. CGLContextObj is defined in both cocoa and cgl, except cgl only allows libc 0.1 while cocoa is using libc 0.2, so using it between the two crates errors.

I think both of these are actually Cargo bugs, since both objc and cocoa's dependencies could be satisfied by libc 0.1 (and these issues would be avoided) but instead Cargo chooses to use a different version of libc for them. See rust-lang/cargo#2064. Getting any change to cargo would probably take a while though, so it's not a viable way to solve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants