Skip to content

Failing to build on DragonFly BSD because of incorrect casting #1238

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

Closed
strangelittlemonkey opened this issue Feb 3, 2019 · 3 comments
Closed

Comments

@strangelittlemonkey
Copy link

zach@test ~/user_test> cargo run
Updating registry https://github.com/rust-lang/crates.io-index
Downloading users v0.8.1
Downloading libc v0.2.48
Compiling libc v0.2.48
error[E0433]: failed to resolve. Use of undeclared type or module mem
--> /home/zach/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.48/src/unix/bsd/freebsdlike/dragonfly/mod.rs:798:33
|
798 | .offset(_CMSG_ALIGN(mem::size_of::<::cmsghdr>()) as isize)
| ^^^ Use of undeclared type or module mem

error[E0433]: failed to resolve. Use of undeclared type or module mem
--> /home/zach/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.48/src/unix/bsd/freebsdlike/dragonfly/mod.rs:802:21
|
802 | _CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + length as usize
| ^^^ Use of undeclared type or module mem

error[E0433]: failed to resolve. Use of undeclared type or module mem
--> /home/zach/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.48/src/unix/bsd/freebsdlike/dragonfly/mod.rs:809:27
|
809 | + _CMSG_ALIGN(mem::size_of::<::cmsghdr>());
| ^^^ Use of undeclared type or module mem

error[E0433]: failed to resolve. Use of undeclared type or module mem
--> /home/zach/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.48/src/unix/bsd/freebsdlike/dragonfly/mod.rs:820:21
|
820 | _CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + _CMSG_ALIGN(length as usize)
| ^^^ Use of undeclared type or module mem

error[E0308]: mismatched types
--> /home/zach/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.48/src/unix/bsd/freebsdlike/dragonfly/mod.rs:802:9
|
801 | pub fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
| -------- expected u32 because of return type
802 | _CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + length as usize
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found usize

error[E0308]: mismatched types
--> /home/zach/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.48/src/unix/bsd/freebsdlike/dragonfly/mod.rs:808:48
|
808 | let next = cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len)
| ^^^^^^^^^^^^^^^^ expected usize, found u32

error[E0308]: mismatched types
--> /home/zach/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.48/src/unix/bsd/freebsdlike/dragonfly/mod.rs:813:42
|
813 | (cmsg as usize + _CMSG_ALIGN((*cmsg).cmsg_len)) as *mut ::cmsghdr
| ^^^^^^^^^^^^^^^^ expected usize, found u32

error[E0308]: mismatched types
--> /home/zach/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.48/src/unix/bsd/freebsdlike/dragonfly/mod.rs:820:9
|
819 | pub fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
| -------- expected u32 because of return type
820 | _CMSG_ALIGN(mem::size_of::<::cmsghdr>()) + _CMSG_ALIGN(length as usize)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected u32, found usize

error: aborting due to 8 previous errors

Some errors occurred: E0308, E0433.
For more information about an error, try rustc --explain E0308.
error: Could not compile libc.

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

@gnzlbg
Copy link
Contributor

gnzlbg commented Feb 4, 2019

This might be fixed by @asomers PR (#1212 ).

@strangelittlemonkey
Copy link
Author

I tested this against master, which includes that PR, and it's not fixed, hence my creation of my PR.

bors added a commit that referenced this issue Feb 13, 2019
…zlbg

Fix dragonfly casting

This fixes a recent break in the casting on DragonFly and also a separate commit to bring the newer code into the same style with rustfmt.

fixes #1238
@gnzlbg
Copy link
Contributor

gnzlbg commented Feb 21, 2019

This should be fixed on master, but it would still be really nice if you could pursue your PR about getting libc-test to work there.

I might be landing some simplifications there that might make it easier in case you are low on time.

@gnzlbg gnzlbg closed this as completed Feb 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants