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

Fix dragonfly casting #1237

Conversation

strangelittlemonkey
Copy link

@strangelittlemonkey strangelittlemonkey commented Feb 2, 2019

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

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@strangelittlemonkey
Copy link
Author

It seems to be failing on lint errors that are recreated on the file after running rustfmt. I suppose I could disable rust-mode in my Emacs in order to not trigger rustfmt on save, but I think the inconsistency in requirements should be documented. rustfmt shouldn't intentionally create something that will fail linting here and vice versa.

@gnzlbg
Copy link
Contributor

gnzlbg commented Feb 4, 2019

Run rustfmt on the dragonfly/mod.rs for consistency

This project does not support rustfmt (as you have discovered). Could you strip that commit from the PR ?

If you want to add rustfmt support for libc, it is better to do so in a different PR. You are going to need to add a custom rustfmt.toml to prevent rustfmt from making changes that libc's linter would error on.

@strangelittlemonkey strangelittlemonkey force-pushed the fix_dragonfly_casting branch 2 times, most recently from 072c3e4 to 452f027 Compare February 5, 2019 05:12
@strangelittlemonkey
Copy link
Author

Ok. I've removed the formatting commit and left the one that allows it to correctly build and run on DragonFly.

@gnzlbg
Copy link
Contributor

gnzlbg commented Feb 5, 2019

I think this overlaps with #1235 , going to hold on this until that one is merged.

@asomers
Copy link
Contributor

asomers commented Feb 5, 2019

@strangelittlemonkey after #1235 lands could you please try running libc-test locally on your Dragonfly machine? It adds a regression test for CMSG_NXTHDR and friends.

@strangelittlemonkey
Copy link
Author

I've tested against master, with the PR merged, it still has the exact same error that my PR fixes.

@asomers
Copy link
Contributor

asomers commented Feb 8, 2019

What I meant it "do the runtime tests added in that PR pass after you merge your compile fixes"?

@gnzlbg
Copy link
Contributor

gnzlbg commented Feb 8, 2019

@strangelittlemonkey would it be possible to rebase this on top of master ?

Also, are there any cross-compile dragonflybsd targets on linux that might be missing on ci/build.sh ?

@strangelittlemonkey
Copy link
Author

I've rebased against master. I don't know that you'd support any ci stuff for dragonfly given it's tier III and you don't produce any binaries for it.

@gnzlbg
Copy link
Contributor

gnzlbg commented Feb 13, 2019

I've rebased against master. I don't know that you'd support any ci stuff for dragonfly given it's tier III and you don't produce any binaries for it.

I thought we might be able to cross-compile to it from Linux if we use #[no_core]. I'll might give that a try.

@gnzlbg
Copy link
Contributor

gnzlbg commented Feb 13, 2019

@bors: r+

@bors
Copy link
Contributor

bors commented Feb 13, 2019

📌 Commit 4ccd317 has been approved by gnzlbg

@bors
Copy link
Contributor

bors commented Feb 13, 2019

⌛ Testing commit 4ccd317 with merge af826f2...

bors added a commit that referenced this pull request 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
@bors
Copy link
Contributor

bors commented Feb 13, 2019

💔 Test failed - checks-travis

@bors
Copy link
Contributor

bors commented Feb 13, 2019

☔ The latest upstream changes (presumably #1254) made this pull request unmergeable. Please resolve the merge conflicts.

@gnzlbg
Copy link
Contributor

gnzlbg commented Feb 13, 2019

I've disabled the android build jobs that were making bors fail, after rebase this should merge without issues. Sorry for the CI churn.

@strangelittlemonkey
Copy link
Author

strangelittlemonkey commented Feb 13, 2019 via email

@strangelittlemonkey
Copy link
Author

I addressed the line length and ordering issue that travis style complained about, I think it will pass now.

@gnzlbg
Copy link
Contributor

gnzlbg commented Feb 14, 2019

Some conflicts poped up, this has to be rebased (sorry).

@strangelittlemonkey
Copy link
Author

Ok, I've rebased your changes in, which ended up removing the need to have the dox::mem at the top now.

@strangelittlemonkey
Copy link
Author

Well, Travis failure this time says style but not related to me as it was because of inability to find rustfmt.

@asomers
Copy link
Contributor

asomers commented Feb 15, 2019

Did you try running libc-test locally on Dragonfly? It doesn't run in CI.

@strangelittlemonkey
Copy link
Author

My servers are almost exclusively DragonFly BSD. I'm editing this and compiling it on DragonFly BSD systems.

zach@dev ~/libc> cargo build
Compiling libc v0.2.49 (file:///home/zach/libc)
Finished dev [unoptimized + debuginfo] target(s) in 1.00s
zach@dev ~/libc> cargo test
Compiling libc v0.2.49 (file:///home/zach/libc)
Finished dev [unoptimized + debuginfo] target(s) in 1.79s
Running target/debug/deps/libc-215e7701074bdcb1

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

Doc-tests libc

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out

zach@dev ~/libc> uname
DragonFly

I'm also using my patched version for user and group libraries, so I know it works.

@strangelittlemonkey
Copy link
Author

Eh, I guess the test is kinda useless looking at it running 0 tests.

@strangelittlemonkey
Copy link
Author

Hmm, this fails.

zach@dev ~/l/libc-test> cargo test
Downloading cc v1.0.29
Downloading ctest v0.2.8
Downloading serde v1.0.87
Downloading extprim v1.6.0
Downloading serde_json v1.0.38
Downloading serde_derive v1.0.87
Downloading proc-macro2 v0.4.27
Downloading rand v0.4.6
Downloading num-traits v0.2.6
Compiling proc-macro2 v0.4.27
Compiling unicode-xid v0.1.0
Compiling semver-parser v0.7.0
Compiling serde v1.0.87
Compiling libc v0.2.48
Compiling ryu v0.2.7
Compiling num-traits v0.2.6
Compiling cfg-if v0.1.6
Compiling itoa v0.4.3
Compiling term v0.4.6
Compiling bitflags v0.9.1
Compiling cc v1.0.29
Compiling libc v0.2.49 (file:///home/zach/libc)
Compiling semver v0.9.0
Compiling log v0.4.6
Compiling rustc_version v0.2.3
Compiling log v0.3.9
Compiling rand v0.4.6
Compiling quote v0.6.11
Compiling extprim v1.6.0
Compiling syn v0.15.26
Compiling serde_derive v1.0.87
Compiling syntex_pos v0.59.1
Compiling serde_json v1.0.38
Compiling syntex_errors v0.59.1
Compiling syntex_syntax v0.59.1
Compiling ctest v0.2.8
Compiling libc-test v0.1.0 (file:///home/zach/libc/libc-test)
error: failed to run custom build command for libc-test v0.1.0 (file:///home/zach/libc/libc-test)
process didn't exit successfully: /home/zach/libc/target/debug/build/libc-test-430a29cf7fc4ba47/build-script-build (exit code: 101)
--- stdout
TARGET = Some("x86_64-unknown-dragonfly")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-unknown-dragonfly")
CC_x86_64-unknown-dragonfly = None
CC_x86_64_unknown_dragonfly = None
HOST_CC = None
CC = None
CFLAGS_x86_64-unknown-dragonfly = None
CFLAGS_x86_64_unknown_dragonfly = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out/src/cmsg.o" "-c" "src/cmsg.c"
exit code: 0
AR_x86_64-unknown-dragonfly = None
AR_x86_64_unknown_dragonfly = None
HOST_AR = None
AR = None
running: "ar" "crs" "/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out/libcmsg.a" "/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out/src/cmsg.o"
exit code: 0
cargo:rustc-link-lib=static=cmsg
cargo:rustc-link-search=native=/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out

cargo:rerun-if-changed=../src/lib.rs
cargo:rerun-if-changed=../src/macros.rs
cargo:rerun-if-changed=../src/unix/mod.rs
cargo:rerun-if-changed=../src/unix/bsd/mod.rs
cargo:rerun-if-changed=../src/unix/bsd/freebsdlike/mod.rs
cargo:rerun-if-changed=../src/unix/bsd/freebsdlike/dragonfly/mod.rs
OPT_LEVEL = Some("0")
HOST = Some("x86_64-unknown-dragonfly")
CC_x86_64-unknown-dragonfly = None
CC_x86_64_unknown_dragonfly = None
HOST_CC = None
CC = None
CFLAGS_x86_64-unknown-dragonfly = None
CFLAGS_x86_64_unknown_dragonfly = None
HOST_CFLAGS = None
CFLAGS = None
DEBUG = Some("true")
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-Wall" "-Wextra" "-Werror" "-Wno-unused-parameter" "-Wno-type-limits" "-Wno-address-of-packed-member" "-Wno-deprecated-declarations" "-Wno-deprecated-declarations" "-o" "/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out/main.o" "-c" "/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out/main.c"
cargo:warning=/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out/main.c:9776:58: error: 'IP_SENDSRCADDR' undeclared here (not in a function); did you mean 'IP_RECVDSTADDR'?
cargo:warning= static int __test_const_IP_SENDSRCADDR_val = IP_SENDSRCADDR;
cargo:warning= ^~~~~~~~~~~~~~
cargo:warning= IP_RECVDSTADDR
cargo:warning=/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out/main.c:11666:57: error: 'BPF_ALIGNMENT' undeclared here (not in a function); did you mean 'RB_AUGMENT'?
cargo:warning= static int __test_const_BPF_ALIGNMENT_val = BPF_ALIGNMENT;
cargo:warning= ^~~~~~~~~~~~~
cargo:warning= RB_AUGMENT
cargo:warning=/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out/main.c: In function '__test_fn_lio_listio':
cargo:warning=/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out/main.c:11904:24: error: returning 'int ()(int, struct aiocb * const restrict restrict, int, struct sigevent * restrict)' from a function with incompatible return type 'int ()(int, struct aiocb * const, int, struct sigevent )' [-Werror=incompatible-pointer-types]
cargo:warning= return lio_listio;
cargo:warning= ^~~~~~~~~~
cargo:warning=/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out/main.c: In function '__test_field_type_statfs_f_mntonname':
cargo:warning=/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out/main.c:13335:28: error: returning 'char (
)[80]' from a function with incompatible return type 'char ()[90]' [-Werror=incompatible-pointer-types]
cargo:warning= return &b->f_mntonname;
cargo:warning= ^~~~~~~~~~~~~~~
cargo:warning=/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out/main.c: In function '__test_field_type_statfs_f_mntfromname':
cargo:warning=/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out/main.c:13377:28: error: returning 'char (
)[80]' from a function with incompatible return type 'char (*)[90]' [-Werror=incompatible-pointer-types]
cargo:warning= return &b->f_mntfromname;
cargo:warning= ^~~~~~~~~~~~~~~~~
cargo:warning=/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out/main.c: At top level:
cargo:warning=/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out/main.c:16755:63: error: 'SF_CACHE' undeclared here (not in a function); did you mean 'UF_CACHE'?
cargo:warning= static unsigned long __test_const_SF_CACHE_val = SF_CACHE;
cargo:warning= ^~~~~~~~
cargo:warning= UF_CACHE
cargo:warning=cc1: error: unrecognized command line option '-Wno-address-of-packed-member' [-Werror]
cargo:warning=cc1: all warnings being treated as errors
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-Wall" "-Wextra" "-Werror" "-Wno-unused-parameter" "-Wno-type-limits" "-Wno-address-of-packed-member" "-Wno-deprecated-declarations" "-Wno-deprecated-declarations" "-o" "/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out/main.o" "-c" "/home/zach/libc/target/debug/build/libc-test-2be4575c36aae7eb/out/main.c" with args "cc" did not execute successfully (status code exit code: 1).

', /home/zach/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.29/src/lib.rs:2314:5
note: Run with RUST_BACKTRACE=1 for a backtrace.

@asomers
Copy link
Contributor

asomers commented Feb 15, 2019

Oh wow, that's worse than I thought. The undefined symbols like IP_SENDSRCADDR are either not present in Dragonfly, in which case you should remove them, or they aren't present in your version of Dragonfly, in which case you should add them to the list of exceptions in libc-test/build.rs. The problems with lio_listio seem to be caused by the restrict pointers. I guess ctest doesn't like those. You'll probably have to create an exception for it too. And the problems with mntonname and mntfromname look like an error in the statfs definition.

@strangelittlemonkey
Copy link
Author

I made some progress on it last night, clearly my test applications aren't making full use of the library. In any event, I got it down to two warnings, I'll see if I can get it clean over the weekend.

@gnzlbg
Copy link
Contributor

gnzlbg commented Feb 19, 2019

@strangelittlemonkey any progress on this? I don't know if I should merge #1263 as soon as its ready, or wait for this to be fixed. Rebasing either of the PRs on top of the other shouldn't be too much work since the changes should be the same.

bors added a commit that referenced this pull request Feb 20, 2019
Test that targets without a shipping libcore / libstd build properly

This PR tests that `libc` builds on targets that currently don't ship a `libcore`/`libstd` by cross-compiling to them from Linux and MacOSX using `Xargo`.

This fixes the build on DragonflyBSD (superseeds #1237), Haiku, bitrig, and OpenBSD (superseeds #1259).

cc @asomers @strangelittlemonkey @semarie
bors added a commit that referenced this pull request Feb 20, 2019
Test that targets without a shipping libcore / libstd build properly

This PR tests that `libc` builds on targets that currently don't ship a `libcore`/`libstd` by cross-compiling to them from Linux and MacOSX using `Xargo`.

This fixes the build on DragonflyBSD (superseeds #1237), Haiku, bitrig, and OpenBSD (superseeds #1259).

cc @asomers @strangelittlemonkey @semarie
bors added a commit that referenced this pull request Feb 20, 2019
Test that targets without a shipping libcore / libstd build properly

This PR tests that `libc` builds on targets that currently don't ship a `libcore`/`libstd` by cross-compiling to them from Linux and MacOSX using `Xargo`.

This fixes the build on DragonflyBSD (superseeds #1237), Haiku, bitrig, and OpenBSD (superseeds #1259).

cc @asomers @strangelittlemonkey @semarie
bors added a commit that referenced this pull request Feb 20, 2019
Test that targets without a shipping libcore / libstd build properly

This PR tests that `libc` builds on targets that currently don't ship a `libcore`/`libstd` by cross-compiling to them from Linux and MacOSX using `Xargo`.

This fixes the build on DragonflyBSD (superseeds #1237), Haiku, bitrig, and OpenBSD (superseeds #1259).

cc @asomers @strangelittlemonkey @semarie
@bors
Copy link
Contributor

bors commented Feb 20, 2019

☔ The latest upstream changes (presumably #1263) made this pull request unmergeable. Please resolve the merge conflicts.

@gnzlbg
Copy link
Contributor

gnzlbg commented Feb 24, 2019

@strangelittlemonkey any progress on this? I'm on Zulip and Discord in case you encounter some errors that aren't clear enough and need help.

@gnzlbg
Copy link
Contributor

gnzlbg commented Feb 24, 2019

@asomers

The problems with lio_listio seem to be caused by the restrict pointers. I guess ctest doesn't like those.

Note the type signatures in the error message:

error: returning 
'int (_)(int, struct aiocb * const restrict_ restrict, int, struct sigevent * restrict)' 
from a function with incompatible return type
 'int (_)(int, struct aiocb * const_, int, struct sigevent _)' 

Note the last type isstruct sigevent in Rust vs struct sigevent * restrict in C. One is a pointer, and one is a struct.

@strangelittlemonkey
Copy link
Author

Sorry, I've been a bit busy with personal things of late. I'm not sure how or where the Zulip/Discord things are. Maybe I'm old, but I idle on IRC a lot.

@gnzlbg
Copy link
Contributor

gnzlbg commented Feb 24, 2019

So I will hang out on IRC for the next couple of days in case you have questions :)

(the only reason I use discord or zulip more is that i get notified when somebody pings me when i'm offline without needing a bouncer or similar)

@gnzlbg
Copy link
Contributor

gnzlbg commented May 16, 2019

This needs to be rebased.

@gnzlbg
Copy link
Contributor

gnzlbg commented Nov 28, 2019

@strangelittlemonkey ping :) let me know if there is a way I can help you with here!

@JohnTitor
Copy link
Member

I'm going to close this as inactive and the build works now. Thanks!

@JohnTitor JohnTitor closed this Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failing to build on DragonFly BSD because of incorrect casting
7 participants