alexcrichton / filetime

Accessing file timestamps in a platform-agnostic fashion in Rust
Apache License 2.0
122 stars 56 forks source link

Build failure on OpenBSD 6.4 due to missing libc::lutimes #33

Closed thendiscard closed 5 years ago

thendiscard commented 5 years ago

Hi, I was trying to build https://github.com/jwilm/alacritty on OpenBSD 6.4-current and I've ran into the failure bellow.

It seems related to the latest version of https://github.com/rust-lang/libc (v2.4.3) and triggered by db5cc8d3efaed39007a200f36d2e4a3ec75681ea . If I try to take out this commit out of filetime then it builds correctly. But I'm quite new to Rust so I can't say what is the best course of action.

Build failure on HEAD:

user ~/ALACRITTY/filetime $ sysctl kern.version
kern.version=OpenBSD 6.4-current (GENERIC.MP) #433: Sun Nov 11 10:08:54 MST 2018
    deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP

user ~/ALACRITTY/filetime $ rustc -Vv
rustc 1.30.1
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-openbsd
release: 1.30.1
LLVM version: 6.0

user ~/ALACRITTY/filetime $ cargo test
    Updating crates.io index
 Downloading tempdir v0.3.7
   Compiling libc v0.2.43
   Compiling cfg-if v0.1.6
   Compiling remove_dir_all v0.5.1
   Compiling rand v0.4.3
   Compiling filetime v0.2.2 (/home/user/ALACRITTY/filetime)
error[E0425]: cannot find value `lutimes` in module `libc`
  --> src/unix/utimes.rs:12:42
   |
12 |     super::utimes(p, atime, mtime, libc::lutimes)
   |                                          ^^^^^^^ did you mean `futimes`?

error: aborting due to previous error

For more information about this error, try `rustc --explain E0425`.
error: Could not compile `filetime`.
warning: build failed, waiting for other jobs to finish...
error: build failed

Build successful on df8da97ee26e9262246630ddca73561d823e0cc7:

user ~/ALACRITTY/filetime $ git checkout df8da97ee26e9262246630ddca73561d823e0cc7
Note: checking out 'df8da97ee26e9262246630ddca73561d823e0cc7'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at df8da97 Bump to 0.2.2

user ~/ALACRITTY/filetime $ cargo clean

user ~/ALACRITTY/filetime $ cargo test
   Compiling libc v0.2.43
   Compiling cfg-if v0.1.6
   Compiling remove_dir_all v0.5.1
   Compiling rand v0.4.3
   Compiling filetime v0.2.2 (/home/user/ALACRITTY/filetime)
   Compiling tempdir v0.3.7
    Finished dev [unoptimized + debuginfo] target(s) in 5.69s
     Running target/debug/deps/filetime-f76c9a59801532b5

running 5 tests
test tests::from_unix_time_test ... ok
test tests::from_system_time_test ... ok
test tests::set_file_times_pre_unix_epoch_test ... ok
test tests::set_symlink_file_times_test ... ok
test tests::set_file_times_test ... ok

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

   Doc-tests filetime

running 1 test
test src/lib.rs -  (line 17) ... ok

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

user ~/ALACRITTY/filetime $ cargo build --release
   Compiling libc v0.2.43
   Compiling cfg-if v0.1.6
   Compiling filetime v0.2.2 (/home/user/ALACRITTY/filetime)
    Finished release [optimized] target(s) in 2.13s
alexcrichton commented 5 years ago

This crate doesn't have CI for OpenBSD, but patches to get it compiling are more than welcome!

ltratt commented 5 years ago

I've addressed this (I hope) in https://github.com/alexcrichton/filetime/pull/34

thendiscard commented 5 years ago

@ltratt Thanks! With 32fa04c83bf2dcb503f9473f4af6040a8aaca8f0 I can successfully build filetime on OpenBSD and I can also build and use https://github.com/jwilm/alacritty .

user ~/ALACRITTY/filetime-ltratt $ git log -n 2
commit 32fa04c83bf2dcb503f9473f4af6040a8aaca8f0 (HEAD -> master, origin/master, origin/HEAD)
Author: Laurence Tratt <laurie@tratt.net>
Date:   Thu Nov 15 18:53:30 2018 +0000

    OpenBSD doesn't have lutimes so use utimensat instead.

commit 209a366b57a51ae921d3de637f934af2d43176e8
Merge: df8da97 db5cc8d
Author: Alex Crichton <alex@alexcrichton.com>
Date:   Mon Nov 12 09:22:36 2018 -0600

    Merge pull request #32 from derkbell/master

    missing libc def for utimensat in 0.2.43, *bsd targets should use uti<E2><80><A6>
~
~

user ~/ALACRITTY/filetime-ltratt $ cargo test
    Updating crates.io index
 Downloading tempdir v0.3.7
 Downloading remove_dir_all v0.5.1
   Compiling libc v0.2.43
   Compiling cfg-if v0.1.6
   Compiling remove_dir_all v0.5.1
   Compiling rand v0.4.3
   Compiling filetime v0.2.2 (/home/user/ALACRITTY/filetime-ltratt)
   Compiling tempdir v0.3.7
    Finished dev [unoptimized + debuginfo] target(s) in 10.18s
     Running target/debug/deps/filetime-f76c9a59801532b5

running 5 tests
test tests::from_unix_time_test ... ok
test tests::from_system_time_test ... ok
test tests::set_file_times_pre_unix_epoch_test ... ok
test tests::set_file_times_test ... ok
test tests::set_symlink_file_times_test ... ok

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

   Doc-tests filetime

running 1 test
test src/lib.rs -  (line 17) ... ok

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

user ~/ALACRITTY/filetime-ltratt $ cargo build
    Finished dev [unoptimized + debuginfo] target(s) in 0.11s

user ~/ALACRITTY/filetime-ltratt $ cargo build --release
   Compiling cfg-if v0.1.6
   Compiling libc v0.2.43
   Compiling filetime v0.2.2 (/home/user/ALACRITTY/filetime-ltratt)
    Finished release [optimized] target(s) in 1.59s
thendiscard commented 5 years ago

I've seen that #34 is merged and the bump to 0.2.4. With 0.2.4 I can build and use alacritty on OpenBSD 6.4 . Thanks @ltratt , thanks @alexcrichton !