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

Disable clock_getres on redox #1327

Closed
wants to merge 4 commits into from

Conversation

coolreader18
Copy link
Contributor

No description provided.

Copy link
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please explain why, and also add an entry to CHANGELOG?

@coolreader18
Copy link
Contributor Author

Should I explain why as a comment in the code, or just here? If the latter, it's because clock_getres isn't available on Redox, so nix would fail to compile when targeting Redox.

@asomers
Copy link
Member

asomers commented Nov 15, 2020

Except that it doesn't fail. We build for Redox in CI. Why does that pass, but whatever you're doing does not?

@coolreader18
Copy link
Contributor Author

Huh, really? Weird... here's the error I get:

    Checking nix v0.19.0
error[E0425]: cannot find function `clock_getres` in crate `libc`
    --> /home/coolreader18/.cargo/registry/src/github.com-1ecc6299db9ec823/nix-0.19.0/src/time.rs:209:30
     |
209  |     let ret = unsafe { libc::clock_getres(clock_id.as_raw(), c_time.as_mut_ptr()) };
     |                              ^^^^^^^^^^^^ help: a function with a similar name exists: `clock_gettime`
     | 
    ::: /home/coolreader18/.cargo/git/checkouts/libc-d1297d136f47e864/d588f99/src/unix/redox/mod.rs:1061:5
     |
1061 |     pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
     |     -------------------------------------------------------------------------- similarly named function `clock_gettime` defined here

@coolreader18
Copy link
Contributor Author

I guess I'm building under redoxer, whereas CI builds just using cross-compilation.

@coolreader18
Copy link
Contributor Author

It's strange though, because libc doesn't define clock_getres for redox:

libc on  master is 📦 v0.2.80 via 🦀 v1.49.0-nightly took 3s 
❯ rg clock_getres src/unix/redox

libc on  master is 📦 v0.2.80 via 🦀 v1.49.0-nightly 
❯ 

@asomers
Copy link
Member

asomers commented Nov 15, 2020

Nope, it's our mistake. There's an error in the Travis file. Could you please add this to your PR?

--- a/.travis.yml
+++ b/.travis.yml
@@ -104,7 +104,7 @@ matrix:
         - curl --proto '=https' --tlsv1.2 -sSf --output rustup.sh https://sh.rustup.rs
         - sh rustup.sh -y --profile=minimal --default-toolchain 1.36.0 --target x86_64-unknown-redox
         - . $HOME/.cargo/env
-        - cargo build --all-targets
+        - cargo build --target x86_64-unknown-redox --all-targets
 
 before_install: set -e

@asomers
Copy link
Member

asomers commented Nov 29, 2020

You'll have to rebase to fix the CI errors, not to mention the merge conflict.

@asomers
Copy link
Member

asomers commented Dec 3, 2020

@coolreader18 did you notice the build failures for Redox? I think you'll have to switch Redox's compiler to nightly. libc seems to require it.

@coolreader18
Copy link
Contributor Author

Ah, alright

@asomers
Copy link
Member

asomers commented Dec 5, 2020

Since Travis has been working so poorly this week, I'm working on replacing it. I've pulled your changes into PR #1350 . Let's continue there.

@asomers asomers closed this Dec 5, 2020
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 this pull request may close these issues.

None yet

2 participants