GNU bug report logs - #66699
zig: fail to link SDL2

Previous Next

Package: guix;

Reported by: Nguyễn Gia Phong <cnx <at> loang.net>

Date: Mon, 23 Oct 2023 10:46:02 UTC

Severity: normal

Done: Nguyễn Gia Phong <mcsinyx <at> disroot.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Nguyễn Gia Phong <cnx <at> loang.net>
To: 66699 <at> debbugs.gnu.org, ekaitz <at> elenq.tech
Subject: bug#66699: zig: fail to link SDL2
Date: Mon, 23 Oct 2023 16:34:22 +0900
[Message part 1 (text/plain, inline)]
I am trying to package Mepo, an OpenStreetMap frontend written in Zig.
The currently packaged Zig fails to find transitive dependencies of SDL2:
https://paste.sr.ht/~cnx/db21e1ef9a6828f3ec898db43b790d71b5ef213a

Here's a minimal reproducible Zig project:

// main.zig
const c = @cImport(@cInclude("SDL2/SDL.h"));
pub fn main() !void {
    if (c.SDL_Init(c.SDL_INIT_VIDEO) != 0)
        return error.SDLInitializationFailed;
    c.SDL_Quit();
}

// build.zig
pub fn build(b: *@import("std").build.Builder) void {
    const exe = b.addExecutable("sdl2-smoke-test", "main.zig");
    exe.linkSystemLibrary("SDL2");
    exe.setTarget(b.standardTargetOptions(.{}));
    exe.setBuildMode(b.standardReleaseOptions());
    exe.install();
}

For convenience, here goes a manifest for use with guix build -f:

(use-modules (guix build-system zig)
             (guix gexp)
             (guix licenses)
             (guix packages)
             (gnu packages pkg-config)
             (gnu packages sdl))
(package
  (name "sdl2-smoke-test")
  (version "0.0.0")
  (source (local-file "." "sdl2-smoke-test" #:recursive? #t))
  (build-system zig-build-system)
  (arguments (list #:tests? #f
                   #:zig-release-type "safe"))
  (native-inputs (list pkg-config))
  (inputs (list sdl2))
  (synopsis "Zig build system SDL2 linkage failure reproducer")
  (description
    (string-append "This is a reproducer of zig-build-system"
                   " failing to link SDL2's transitive dependencies,"
                   " as seen when trying to package mepo."))
  (home-page "https://larkspur.one/notice/Ab24w1IMGVoZ72J9xg")
  (license zlib))
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 47 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.