getting below error when i ran codecrafters test
, when i ran locally using
zig run src/main -lc -lreadline
is working fine
my zig-version is: 0.14.0
chaitu@pop-os:~/Desktop/zig/codecrafters/codecrafters-shell-zig$ codecrafters test
Initiating test run...
Welcome back! Your first build could take slightly longer, please bear with us.
Subsequent ones will be snappy ⚡
[build] Starting build...
[build] If you don't see logs for 60s+, please contact us at hello@codecrafters.io
[build] Step 1 complete.
[build] Step 2 complete.
[build] Step 3 complete.
[build] Step 4 complete.
[build] Step 5 complete.
[build] Step 6 complete.
[build] Step 7 complete.
[build] Step 8 complete.
[build] Step 9 complete.
[build] Step 10 complete.
[build] Step 11 complete.
[build] Step 12 complete.
[build] Step 13 complete.
[build] Step 14 complete.
[build] Step 15 complete.
[build] Step 16 complete.
[build] > install
[build] > +- install main
[build] > +- zig build-exe main Debug native failure
[build] > error: error: unable to find dynamic system library 'readline' using strategy 'paths_first'. searched paths:
[build] > /usr/local/lib64/libreadline.so
[build] > /usr/local/lib64/libreadline.a
[build] > /usr/local/lib/libreadline.so
[build] > /usr/local/lib/libreadline.a
[build] > /usr/lib/x86_64-linux-musl/libreadline.so
[build] > /usr/lib/x86_64-linux-musl/libreadline.a
[build] > /lib64/libreadline.so
[build] > /lib64/libreadline.a
[build] > /lib/libreadline.so
[build] > /lib/libreadline.a
[build] > /usr/lib64/libreadline.so
[build] > /usr/lib64/libreadline.a
[build] > /usr/lib/libreadline.so
[build] > /usr/lib/libreadline.a
[build] > /lib/x86_64-linux-musl/libreadline.so
[build] > /lib/x86_64-linux-musl/libreadline.a
[build] >
[build] > error: the following command exited with error code 1:
[build] > /usr/local/zig/zig build-exe -lreadline -ODebug -Mroot=/app/src/main.zig -lc --cache-dir /app/.zig-cache --global-cache-dir /root/.cache/zig --name main --listen=-
[build] > Build Summary: 0/3 steps succeeded; 1 failed (disable with --summary none)
[build] > install transitive failure
[build] > +- install main transitive failure
[build] > +- zig build-exe main Debug native failure
[build] > error: the following build command failed with exit code 1:
[build] > /app/.zig-cache/o/0fcd6ac09dbab1c03edbc7591ca5f099/build /usr/local/zig/zig /app /app/.zig-cache /root/.cache/zig --seed 0xbabc9fcd -Z525ef4f4f4ff9f2e
[build] Error: process "/bin/sh -c .codecrafters/compile.sh" did not complete successfully: exit code: 1.
[build] > /lib/x86_64-linux-musl/libreadline.a
[build] >
[build] > error: the following command exited with error code 1:
[build] > /usr/local/zig/zig build-exe -lreadline -ODebug -Mroot=/app/src/main.zig -lc --cache-dir /app/.zig-cache --global-cache-dir /root/.cache/zig --name main --listen=-
[build] > Build Summary: 0/3 steps succeeded; 1 failed (disable with --summary none)
[build] > install transitive failure
[build] > +- install main transitive failure
[build] > +- zig build-exe main Debug native failure
[build] > error: the following build command failed with exit code 1:
[build] > /app/.zig-cache/o/0fcd6ac09dbab1c03edbc7591ca5f099/build /usr/local/zig/zig /app /app/.zig-cache /root/.cache/zig --seed 0xbabc9fcd -Z525ef4f4f4ff9f2e
[build] Build failed. Check the logs above for the reason.
[build] If you think this is a CodeCrafters error, please contact us at hello@codecrafters.io.
Looks like your codebase failed to build.
If you think this is a CodeCrafters error, please let us know at hello@codecrafters.io.
and also my build.zig is shown below
const std = @import("std");
// Learn more about this file here: https://ziglang.org/learn/build-system
pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{
.name = "main",
.root_source_file = b.path("src/main.zig"),
.target = b.standardTargetOptions(.{}),
.optimize = b.standardOptimizeOption(.{}),
});
exe.linkLibC();
exe.linkSystemLibrary("readline");
// This declares intent for the executable to be installed into the
// standard location when the user invokes the "install" step (the default
// step when running `zig build`).
b.installArtifact(exe);
// This *creates* a Run step in the build graph, to be executed when another
// step is evaluated that depends on it. The next line below will establish
// such a dependency.
const run_cmd = b.addRunArtifact(exe);
// This creates a build step. It will be visible in the `zig build --help` menu,
// and can be selected like this: `zig build run`
// This will evaluate the `run` step rather than the default, which is "install".
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
// This allows the user to pass arguments to the application in the build
// command itself, like this: `zig build run -- arg1 arg2 etc`
if (b.args) |args| {
run_cmd.addArgs(args);
}
}