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

ARM broken, need cast #689

Closed
MagaTailor opened this issue Dec 30, 2015 · 2 comments
Closed

ARM broken, need cast #689

MagaTailor opened this issue Dec 30, 2015 · 2 comments

Comments

@MagaTailor
Copy link
Contributor

Due to this issue, even a GL "hello world" doesn't compile:

/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/input.rs:65:64: 65:83 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/input.rs:65             if (display.xlib.XQueryExtension)(display.display, xinput_str.as_ptr(), &mut opcode, &mut event, &mut error) == ffi::False {
                                                                                                                                                                 ^~~~~~~~~~~~~~~~~~~
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/input.rs:65:64: 65:83 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:460:61: 460:74 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:460                 (display.xlib.XInternAtom)(display.display, delete_window, 0)
                                                                                                                                                                ^~~~~~~~~~~~~
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:460:61: 460:74 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:464:68: 464:73 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:464                 (display.xlib.XStoreName)(display.display, window, title);
                                                                                                                                                                       ^~~~~
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:464:68: 464:73 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:513:36: 513:63 error: mismatched types:
 expected `*mut i8`,
    found `*mut u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:513                 (*hint).res_name = c_name as *mut libc::c_char;
                                                                                                                                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:513:36: 513:63 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:514:37: 514:64 error: mismatched types:
 expected `*mut i8`,
    found `*mut u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:514                 (*hint).res_class = c_name as *mut libc::c_char;
                                                                                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:514:37: 514:64 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:525:65: 525:70 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:525                     (display.xlib.XInternAtom)(display.display, state, 0)
                                                                                                                                                                    ^~~~~
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:525:65: 525:70 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:530:65: 530:81 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:530                     (display.xlib.XInternAtom)(display.display, state_fullscreen, 0)
                                                                                                                                                                    ^~~~~~~~~~~~~~~~
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:530:65: 530:81 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:640:85: 640:90 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:640             (self.x.display.xlib.XStoreName)(self.x.display.display, self.x.window, title);
                                                                                                                                                                                        ^~~~~
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:640:85: 640:90 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:792:101: 792:118 error: mismatched types:
 expected `*const i8`,
    found `*const u8`
(expected i8,
    found u8) [E0308]
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:792             let xcursor = (self.x.display.xcursor.XcursorLibraryLoadCursor)(self.x.display.display, c_string.as_ptr());
                                                                                                                                                                                                        ^~~~~~~~~~~~~~~~~
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:792:101: 792:118 help: run `rustc --explain E0308` to see a detailed explanation
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/platform/linux/api_dispatch.rs:402:36: 402:66 error: mismatched types:
 expected `*const u8`,
    found `*const i8`
(expected u8,
    found i8) [E0308]
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/platform/linux/api_dispatch.rs:402         let error = CStr::from_ptr(buff.as_mut_ptr() as *const i8).to_string_lossy();
                                                                                                                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/odroid/.cargo/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/platform/linux/api_dispatch.rs:402:36: 402:66 help: run `rustc --explain E0308` to see a detailed explanation
error: aborting due to 10 previous errors
Could not compile `glutin`.

In most cases it's enough to do a cast as *const _ while the rest might require coercion via a variable.

I was using a 1.7 nightly, 1.5 is also affected but in other places too.

@MagaTailor
Copy link
Contributor Author

Stable rust 1.5 will require two additional casts:

 Compiling glutin v1.4.5
/tmp/.cargo-1.5/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/glx/mod.rs:36:7: 36:21 error: mismatched types:
 expected `*const u8`,
    found `*const i8`
(expected u8,
    found i8) [E0308]
/tmp/.cargo-1.5/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/glx/mod.rs:36     f(c_str.as_ptr())
                                                                                                  ^~~~~~~~~~~~~~
/tmp/.cargo-1.5/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/glx/mod.rs:36:7: 36:21 help: run `rustc --explain E0308` to see a detailed explanation
/tmp/.cargo-1.5/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:42:7: 42:21 error: mismatched types:
 expected `*const u8`,
    found `*const i8`
(expected u8,
    found i8) [E0308]
/tmp/.cargo-1.5/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:42     f(c_str.as_ptr())
                                                                                                     ^~~~~~~~~~~~~~
/tmp/.cargo-1.5/registry/src/github.com-48ad6e4054423464/glutin-0.4.5/src/api/x11/window.rs:42:7: 42:21 help: run `rustc --explain E0308` to see a detailed explanation

@tomaka tomaka added the E-easy label Jan 6, 2016
@elinorbgr
Copy link
Contributor

Switching from using libc to std::os::raw for basic C types fixes this, and if lucky allow to drop the libc dependency altogether.

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

No branches or pull requests

3 participants