Skip to content

Fresh clone build/test failures: missing libcrypto_wrappers.a and log tests fail #863

@vladfdp

Description

@vladfdp

The following is slop ⚠️:

Summary

After cloning the repo without modifications, zig build and zig build test-unit fail. Two issues appear:

  1. zig build fails because lib/voltaire/target/release/libcrypto_wrappers.a is missing.
  2. zig build test-unit fails because the log tests emit err output, which the test runner treats as an error.

Both failures occur on a clean checkout.

Environment

  • OS: macOS (darwin 25.2.0)
  • Zig: 0.15.1
  • Shell: zsh

Repro Steps

  1. git clone <repo>
  2. zig build
  3. zig build test-unit

Observed Errors

1) Missing crypto wrappers library

error: /Users/.../lib/voltaire/target/release/libcrypto_wrappers.a: file not found

The build invokes cargo in lib/voltaire, but the output ends up in the workspace root target/ rather than lib/voltaire/target/, so Zig’s expected path doesn’t exist.

2) Unit tests fail on logging

zig build test-unit shows:

error: 'log.test.log functions compile and execute without error' logged errors
[default] (err): [EVM2] test error message: error

The tests in src/log.zig call err(), and the test harness treats any error log as a test failure.

Proposed Fixes

A) Ensure cargo outputs to lib/voltaire/target/

In lib/voltaire/lib/build.zig, set CARGO_TARGET_DIR=target before invoking cargo so libcrypto_wrappers.a lands where Zig expects.

Suggested change:

cargo_build.setEnvironmentVariable("CARGO_TARGET_DIR", "target");

B) Avoid treating err() as test failure

In src/log.zig, route err() to std.log.warn when running tests (builtin.is_test) so the tests don’t fail on expected output.

Suggested approach:

  • If builtin.is_test, call std.log.warn(...) instead of std.log.err(...).
  • Keep normal behavior in non-test builds.

Notes

  • Adding lib/voltaire to the workspace members also resolves a cargo workspace warning.
  • If you prefer not to alter logging behavior in tests, another option is to update the log tests to avoid calling err().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions