baoyachi / shadow-rs

A build-time information stored in your rust project.(binary,lib,cdylib,dylib)
https://docs.rs/shadow-rs
MIT License
447 stars 41 forks source link

Fail to build using cross #100

Closed appaquet closed 2 years ago

appaquet commented 2 years ago

Last release (v0.13.0) doesn't build anymore when using cross.

Trying to build the examples from the repository with:

cross build -p example_shadow --target x86_64-unknown-linux-gnu

leads to:

error: failed to run custom build command for `example_shadow v0.1.8-beta3 (/project/example_shadow)`

Caused by:
  process didn't exit successfully: `/target/debug/build/example_shadow-97a9495984081d63/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=SOURCE_DATE_EPOCH

  --- stderr
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: IoError(Os { code: 2, kind: NotFound, message: "No such file or directory" })', src/time.rs:21:40
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

The reasons it fails is that the tz-rs crates tries to parse the timezone data from /etc/localtime, which probably doesn't exist in cross's Docker image. See: https://github.com/x-hgg-x/tz-rs/blob/master/src/timezone/mod.rs#L518

A good alternative for me would be to expose a way to either fallback to UTC or simply force UTC.

Thanks!

baoyachi commented 2 years ago

Oh, I will fix right now.

About ref: https://github.com/x-hgg-x/tz-rs/issues/32

baoyachi commented 2 years ago

@appaquet Thx for your report.

Now, fix with https://github.com/baoyachi/shadow-rs/pull/102

Upgarde shadow-rs version

...
[dependencies]
shadow-rs = "0.13.1"
...