We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const std = @import("std"); const Sdk = @import("sdl/Sdk.zig"); pub fn build(b: *std.build.Builder) void { const target = b.standardTargetOptions(.{}); const sdk = Sdk.init(b); const mode = b.standardReleaseOptions(); const exe = b.addExecutable("ziggyboy", "src/main.zig"); exe.setTarget(target); exe.setBuildMode(mode); sdk.link(exe, .static); exe.addPackage(sdk.getNativePackage("sdl2")); // exe.linkSystemLibrary("SDL2"); // exe.linkSystemLibrary("c"); exe.install(); const run_cmd = exe.run(); run_cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| { run_cmd.addArgs(args); } const run_step = b.step("run", "Run the app"); run_step.dependOn(&run_cmd.step); const tests = b.addTest("src/main.zig"); tests.setBuildMode(mode); const test_step = b.step("test", "Run all the tests"); test_step.dependOn(&tests.step); }
ld.lld: error: unable to find library -lsdl2 error: LLDReportedFailure ziggyboy...The following command exited with error code 1: /nix/store/rfpl182slqas5nq68xbla2901jc6f6c6-zig-master-unstable-2021-06-27/bin/zig build-exe /home/devin/Repos/ziggyboy/src/main.zig -lc -lsdl2 --cache-dir /home/devin/Repos/ziggyboy/zig-cache --global-cache-dir /home/devin/.cache/zig --name ziggyboy --enable-cache error: the following build command failed with exit code 1: /home/devin/Repos/ziggyboy/zig-cache/o/fd09d5499e7e1e5f701e4b7c647cdf96/build /nix/store/rfpl182slqas5nq68xbla2901jc6f6c6-zig-master-unstable-2021-06-27/bin/zig /home/devin/Repos/ziggyboy /home/devin/Repos/ziggyboy/zig-cache /home/devin/.cache/zig
{ pkgs ? import <nixpkgs> { } }: pkgs.mkShell { nativeBuildInputs = with pkgs; [ SDL2 pkgconf ]; NIX_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ pkgs.pkgconf pkgs.SDL2 pkgs.lld ]; NIX_LD = builtins.readFile "${pkgs.stdenv.cc}/nix-support/dynamic-linker"; }
Using Andrew's build.zig as an example, linking them as system libraries does compile using the shell.nix.
exe.linkSystemLibrary("SDL2"); exe.linkSystemLibrary("c");
Might be related to NixOS/nixpkgs#24744
The text was updated successfully, but these errors were encountered:
Actually it seems that just changing line 229 fixes it, but I'm not sure if this is portable to other distros.
- exe.linkSystemLibrary("sdl2"); + exe.linkSystemLibrary("SDL2");
Sorry, something went wrong.
Afaik the official pkg-config name is SDL2, not sdl2. This means that NixOS isn't compatible here to other linux distributions having pkg-config.
pkg-config
SDL2
sdl2
It would be a good idea to verify this and maybe file a bug report to NixOS
No branches or pull requests
build.zig
Error from LLD
My shell.nix
Using Andrew's build.zig as an example, linking them as system libraries does compile using the shell.nix.
Might be related to NixOS/nixpkgs#24744
The text was updated successfully, but these errors were encountered: