From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id AJ4mGOq6QmVYngAA9RJhRA:P1 (envelope-from ) for ; Wed, 01 Nov 2023 21:54:02 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id AJ4mGOq6QmVYngAA9RJhRA (envelope-from ) for ; Wed, 01 Nov 2023 21:54:02 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C8CA9104D2 for ; Wed, 1 Nov 2023 21:54:01 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=elenq.tech header.s=protonmail2 header.b=hOfwnn0c; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=elenq.tech (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1698872042; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=KdBjoW8PUdg88AaM7JDMy5WKwp7nY+A6sucG/WTGXk0=; b=ZSyzUfvIipQS55U5LgpFj1eqt+NYC6LOe83ly6iMitnuFVZeX+kIXhGTpN/jbqLcb6nwU7 cembioEstbl4Ipr6uWYkN/3eBMkpv1vhQB8PYqRj1eLE0EDVnGpkOp2hhYSP7LDbpEI2M+ 8vm9tPgytjCSFd+jT97ZpQG0Rr3Zl2/D1DPS4qnjBg9+wo4AwL4mVy96t9ZgrhD1mPZX3+ 8jwH8AE5IVpYV79XlUqB+ijyeskbN7br6NlQa/1KxtzMvG9P+rBUI/rcRa3meGNlU+EKna 4bdFFRbwZbgX53Or3ks6WIueGtrqkZxCAowIURttqDsnfS7roVE5CGUDKtiIiQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=elenq.tech header.s=protonmail2 header.b=hOfwnn0c; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=elenq.tech (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1698872042; a=rsa-sha256; cv=none; b=b6Cj9ZzqaCg8/cF2g1u+bBZ7+b53PcDqKcARgJg8xy1jYHPpsoEWMYnXfvuaGRaBgN0l9t vpMR9l9/qauXAMnXo49NWqVUKqv7KfJEjH0v1trvJ6eCcMvz+Vzo1325gw4C7hddFXYT/S iUBRi3z16xckI4Rw4CVmrRfaRz+U09es06jwJrtAf5s60TYVJ8mIxMtVJJr0YYSI9aKoyA F6j3mHM3XC9NfeOzvX8rHEFT+Sy0pnIkg4BxxdJuOVTOHSYTU9zdyUe50Po3HvD9s0tCzb fU1CZI0G1mvTLxLuIe+HlzBo9lhvivS+VusCm0CgKC0CASJpawOCxJW0PqMj/g== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qyIDS-0003bt-CH; Wed, 01 Nov 2023 16:53:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qyIDQ-0003bd-5E for bug-guix@gnu.org; Wed, 01 Nov 2023 16:53:28 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qyIDP-0003Zh-Ix for bug-guix@gnu.org; Wed, 01 Nov 2023 16:53:27 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qyIDx-0004ra-R3 for bug-guix@gnu.org; Wed, 01 Nov 2023 16:54:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#66699: zig: fail to link SDL2 Resent-From: Ekaitz Zarraga Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Wed, 01 Nov 2023 20:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66699 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: =?UTF-8?Q?Nguy=E1=BB=85n?= Gia Phong Cc: 66699@debbugs.gnu.org X-Debbugs-Original-Cc: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.169887201818661 (code B ref -1); Wed, 01 Nov 2023 20:54:01 +0000 Received: (at submit) by debbugs.gnu.org; 1 Nov 2023 20:53:38 +0000 Received: from localhost ([127.0.0.1]:52719 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyIDa-0004qu-7i for submit@debbugs.gnu.org; Wed, 01 Nov 2023 16:53:38 -0400 Received: from lists.gnu.org ([2001:470:142::17]:33796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qyIDX-0004qe-7q for submit@debbugs.gnu.org; Wed, 01 Nov 2023 16:53:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qyICr-0003Ta-Td for bug-guix@gnu.org; Wed, 01 Nov 2023 16:52:54 -0400 Received: from mail-4018.proton.ch ([185.70.40.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qyICo-0003Ql-MJ for bug-guix@gnu.org; Wed, 01 Nov 2023 16:52:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=elenq.tech; s=protonmail2; t=1698871965; x=1699131165; bh=KdBjoW8PUdg88AaM7JDMy5WKwp7nY+A6sucG/WTGXk0=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=hOfwnn0cmm+f1h5T9SBOiU0CbFXaal9u5a2D25c025FrVHK+5wsXW9tH4wXmPXbtP hzQ7wvkXWebAsXR4QL9Ku+i98e+4Sn6eXnZ968gfan64OfjTIIsUNNC90kXIPwljZi 9EVdsJNS/Gyk+8h3L8aX79qba10iCnfWACENZDdgtBfoaCwZxpufob1jy42MwKZHFq bTRMUAXWvxJwnmGgeyrb54I8NTu8zKU7I1rguf40vYhjEsp21rSVW6hVB/dPNsPIMk BiEzDr89caNWm6v9NYLZB+eB6z0PfRpAPL8BAVzYga0dPOniLK22FWplUjW+PyN/Or UsjQ1AEQkoN6w== Date: Wed, 01 Nov 2023 20:52:35 +0000 From: Ekaitz Zarraga Message-ID: In-Reply-To: References: Feedback-ID: 3263582:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=185.70.40.18; envelope-from=ekaitz@elenq.tech; helo=mail-4018.proton.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: bug-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: 2.89 X-Spam-Score: 2.89 X-Migadu-Queue-Id: C8CA9104D2 X-Migadu-Scanner: mx13.migadu.com X-TUID: gP30YODXb45D ------- Original Message ------- On Monday, October 23rd, 2023 at 09:34, Nguy=E1=BB=85n Gia Phong wrote: > 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 >=20 > Here's a minimal reproducible Zig project: >=20 > // main.zig > const c =3D @cImport(@cInclude("SDL2/SDL.h")); > pub fn main() !void { > if (c.SDL_Init(c.SDL_INIT_VIDEO) !=3D 0) > return error.SDLInitializationFailed; > c.SDL_Quit(); > } >=20 > // build.zig > pub fn build(b: *@import("std").build.Builder) void { > const exe =3D b.addExecutable("sdl2-smoke-test", "main.zig"); > exe.linkSystemLibrary("SDL2"); > exe.setTarget(b.standardTargetOptions(.{})); > exe.setBuildMode(b.standardReleaseOptions()); > exe.install(); > } >=20 > For convenience, here goes a manifest for use with guix build -f: >=20 > (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)) Hi, I have good and bad news for you. I tried to replicate the problem, and I certainly did. I also managed to mi= tigate the problem adding `exe.linkSystemLibrary()` lines to the build.zig = with the transitive dependencies. And later I wondered how did this all work in GCC, just in case. (NOTE: take in account you also need to link with libc! for that you can ad= d it as a linkSystemLibrary("c")) The problem is not Zig specific, look: I tried a random example from a repo in Github using SDL2 and SDL2-Image:= =20 https://github.com/aminosbh/sdl2-image-sample/blob/master/src/main.c Made a shell for it: guix shell sdl2 sdl2-image gcc-toolchain glibc:static And tried to build: $ gcc a.c -static -lSDL2 -lSDL2_image -lm -lc 2>&1 | head ld: /gnu/store/0mhh6ycg8dq6n43qwpvpvr2smbxlixpi-profile/lib/libSDL2.a(SDL_d= ynapi.o):(.text+0x27d8): warning: Using 'dlopen' in statically linked appli= cations requires at runtime the shared libraries from the glibc version use= d for linking ld: /gnu/store/0mhh6ycg8dq6n43qwpvpvr2smbxlixpi-profile/lib/libSDL2.a(SDL_w= aylandvideo.o):(.text+0x48f): undefined reference to `wl_proxy_get_version' ld: /gnu/store/0mhh6ycg8dq6n43qwpvpvr2smbxlixpi-profile/lib/libSDL2.a(SDL_w= aylandvideo.o):(.text+0xd3e): undefined reference to `wl_proxy_get_version' ld: /gnu/store/0mhh6ycg8dq6n43qwpvpvr2smbxlixpi-profile/lib/libSDL2.a(SDL_w= aylandvideo.o):(.text+0xd5a): undefined reference to `wl_proxy_marshal_flag= s' ld: /gnu/store/0mhh6ycg8dq6n43qwpvpvr2smbxlixpi-profile/lib/libSDL2.a(SDL_w= aylandvideo.o):(.text+0xd73): undefined reference to `wl_proxy_add_listener= ' ld: /gnu/store/0mhh6ycg8dq6n43qwpvpvr2smbxlixpi-profile/lib/libSDL2.a(SDL_w= aylandvideo.o):(.text+0xeb9): undefined reference to `wl_proxy_get_version' ld: /gnu/store/0mhh6ycg8dq6n43qwpvpvr2smbxlixpi-profile/lib/libSDL2.a(SDL_w= aylandvideo.o):(.text+0xfa8): undefined reference to `wl_proxy_marshal_flag= s' ld: /gnu/store/0mhh6ycg8dq6n43qwpvpvr2smbxlixpi-profile/lib/libSDL2.a(SDL_w= aylandvideo.o):(.text+0x1002): undefined reference to `wl_proxy_marshal_fla= gs' ld: /gnu/store/0mhh6ycg8dq6n43qwpvpvr2smbxlixpi-profile/lib/libSDL2.a(SDL_w= aylandvideo.o):(.text+0x1071): undefined reference to `wl_proxy_add_listene= r' ld: /gnu/store/0mhh6ycg8dq6n43qwpvpvr2smbxlixpi-profile/lib/libSDL2.a(SDL_w= aylandvideo.o):(.text+0x107e): undefined reference to `wl_proxy_set_tag' The list of errors are basically the same you have. Zig builds statically if I'm not mistaken so it's triggering the same probl= em GCC would for that case. We need to research this further... I also checked Mepo, how do they manage to build directly? I don't have the Zig knowledge to know how does all this work, but I know i= t's not just the build-system's fault because it happens in GCC too, and al= so with a normal shell with `zig` available, and running the command by han= d. The build-system just replicates that behavior. We need to dig on this further. Are you, Nguy=E1=BB=85n, a Zig programmer? = Maybe you can help me figure out this? Thanks for the report, the patience and the help! All the best, Ekaitz