tigerbeetle-rust / tigerbeetle-unofficial

Safe bindings to tigerbeetle client
Apache License 2.0
43 stars 8 forks source link

Fails to build in docker environment #20

Open dyc3 opened 3 weeks ago

dyc3 commented 3 weeks ago

Whenever I try to build the crate in a docker environment, the zig client fails to build, complaining that it's not in a git repository.

I'm using this dockerfile:

FROM rust:1.82-bullseye AS builder

WORKDIR /app
RUN apt-get update && apt-get install -y build-essential libclang-dev clang
COPY . .
RUN cargo check -p my-crate

I've managed to work around it with my own fork that adds the -Dgit-commit argument to the build script.

Full error ``` 47.05 error: failed to run custom build command for `tigerbeetle-unofficial-sys v0.4.1+0.15.3` 47.05 47.05 Caused by: 47.05 process didn't exit successfully: `/app/target/debug/build/tigerbeetle-unofficial-sys-9c1a52e0030e5eb8/build-script-build` (exit status: 101) 47.05 --- stdout 47.05 cargo:rerun-if-env-changed=DOCS_RS 47.05 cargo:rerun-if-changed=src/wrapper.h 47.05 Installing Zig 0.11.0 release build... 47.05 /usr/bin/wget 47.05 Downloading https://ziglang.org/download/0.11.0/zig-linux-x86_64-0.11.0.tar.xz... 47.05 /usr/bin/wget 47.05 Extracting zig-linux-x86_64-0.11.0.tar.xz... 47.05 Installing zig-linux-x86_64-0.11.0 to 'zig' in current working directory... 47.05 Congratulations, you have successfully installed Zig 0.11.0 to /app/target/debug/build/tigerbeetle-unofficial-sys-3a416fd41afb3cfc/out/tigerbeetle/zig/zig. Enjoy! 47.05 47.05 --- stderr 47.05 error: command failed 47.05 $ git rev-parse --verify HEAD 47.05 error: stdout: 47.05 47.05 stderr: 47.05 fatal: not a git repository (or any of the parent directories): .git 47.05 47.05 error: NonZeroExitStatus 47.05 /app/target/debug/build/tigerbeetle-unofficial-sys-3a416fd41afb3cfc/out/tigerbeetle/src/shell.zig:495:42: 0x2febe7 in exec_stdout_options__anon_26649 (build) 47.05 .Exited => |code| if (code != 0) return error.NonZeroExitStatus, 47.05 ^ 47.05 /app/target/debug/build/tigerbeetle-unofficial-sys-3a416fd41afb3cfc/out/tigerbeetle/src/shell.zig:426:5: 0x2ff7d7 in exec_stdout__anon_26646 (build) 47.05 return shell.exec_stdout_options(.{}, cmd, cmd_args); 47.05 ^ 47.05 /app/target/debug/build/tigerbeetle-unofficial-sys-3a416fd41afb3cfc/out/tigerbeetle/src/shell.zig:619:20: 0x2ff843 in git_commit (build) 47.05 const stdout = try shell.exec_stdout("git rev-parse --verify HEAD", .{}); 47.05 ^ 47.05 /app/target/debug/build/tigerbeetle-unofficial-sys-3a416fd41afb3cfc/out/tigerbeetle/build.zig:68:14: 0x301370 in build (build) 47.05 ) orelse try shell.git_commit(); 47.05 ^ 47.05 /app/target/debug/build/tigerbeetle-unofficial-sys-3a416fd41afb3cfc/out/tigerbeetle/zig/lib/std/Build.zig:1639:24: 0x2e8607 in runBuild__anon_7186 (build) 47.05 .ErrorUnion => try build_zig.build(b), 47.05 ^ 47.05 /app/target/debug/build/tigerbeetle-unofficial-sys-3a416fd41afb3cfc/out/tigerbeetle/zig/lib/build_runner.zig:297:9: 0x2e452f in main (build) 47.05 try builder.runBuild(root); 47.05 ^ 47.05 error: the following build command failed with exit code 1: 47.05 /app/target/debug/build/tigerbeetle-unofficial-sys-3a416fd41afb3cfc/out/tigerbeetle/zig-cache/o/1cae8d5d9cb7f97e828684d1e5f36662/build /app/target/debug/build/tigerbeetle-unofficial-sys-3a416fd41afb3cfc/out/tigerbeetle/zig/zig /app/target/debug/build/tigerbeetle-unofficial-sys-3a416fd41afb3cfc/out/tigerbeetle /app/target/debug/build/tigerbeetle-unofficial-sys-3a416fd41afb3cfc/out/tigerbeetle/zig-cache /root/.cache/zig c_client -Dtarget=x86_64-linux-gnu 47.05 thread 'main' panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/tigerbeetle-unofficial-sys-0.4.1+0.15.3/build.rs:97:9: 47.05 zig build failed with ExitStatus(unix_wait_status(256)) 47.05 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace 47.05 warning: build failed, waiting for other jobs to finish... ```