From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id uIu0FuuvMGcyPQEAqHPOHw:P1 (envelope-from ) for ; Sun, 10 Nov 2024 13:06:51 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id uIu0FuuvMGcyPQEAqHPOHw (envelope-from ) for ; Sun, 10 Nov 2024 14:06:51 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b="s1FM+/LE"; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=UNd7TddE; 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=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1731244011; 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=hSxv+CsXObb851fo1aPTVrdf3pzhHPMYrcl5fOGz5xE=; b=CsEg8CEdZKqiGSdb97yloPYZ6AhzzcP6AT6pWFKmEhgRgvnJMzoDZEJUP1PIWivsOsYTBU ay0kc6T10Iot+u7tjaHM6vZxPbF6TX1p2cHQ+ahX59zLDDskYQp8F8rVpH7bhdPfIiXirn 1gWOHaM9ztv5pkOOK3djRZ6Mph9wnlfU5Wqj5K1d28SZIvOUW23VkirkyqoytqGNtvWh1n +PBXsKctWo8FPgAPXfLWgLjryq9rpbDKL2K1eXSxh1H10vo2f9ylJlWlN/drXA1yQhXMxk yL4lBB9MqVfD/mlqEu1qoxTzkwWZJllY3Citd23jbmAeopVEoIz9aOy/6HUosQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b="s1FM+/LE"; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=UNd7TddE; 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=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1731244011; a=rsa-sha256; cv=none; b=nXI7hhB8TMaqBjnbpGAmMj9bY0xEJedRrKZeK5RpdmvAnDt7r3MCK4txiuerAY+mRCqwt3 uUGsfOBaO7TrUXDWCzlSBYt6xuuWqr8ysXAVI+zZeUPFdpEifGepxATyi5mfZX56nJvenh ucTXtG7o8lQQS7yWKGnIh77FUhU9p4D/29lJVaDNJmW/re/2yj579HdaEa769+nDczR6pJ Mj5YtnQUbxIppkmY+7ODTAvn+6Nn+TalVoYHRVDUQMqQYd98IFJdTkmFYEWvgz45CUYmbg 1GMgpeBOlV6XYUTc4xEHc36W7AqQeXIZ6PElN8gMtn4MrrV/SOkUbh6/Hi3s4g== 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 C0C007F3DC for ; Sun, 10 Nov 2024 14:06:50 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tA6QH-0006et-Ao; Sun, 10 Nov 2024 06:48:05 -0500 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 1tA6QE-0006ek-SE for bug-guix@gnu.org; Sun, 10 Nov 2024 06:48:03 -0500 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 1tA6QE-0000xV-K2 for bug-guix@gnu.org; Sun, 10 Nov 2024 06:48:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=hSxv+CsXObb851fo1aPTVrdf3pzhHPMYrcl5fOGz5xE=; b=s1FM+/LE9yjwf1slVdNsebQFiRmy6YFuWibJJPlQID9ohEZzQnHLusFTgYv5Ozr8WD0/o7JMKcdmyQ6nOZxnD65sA5gS7sLqlBSlMwjDZHe78jvQYf988btdv3zjg08YH4Z/1qFSYwlvqEnDipE3KxnhXdMYwhTZcSEaARztWaVxM5jEMvg0P+S87d4JzCFjznNEe9IU/B0hqOgGlC+QtjVaYLJTM6JXhWpWrxBiSafzgki3TxCM54sfQB2LaZRCltCGRsRrQTf4YOwU2zHaXX4gJA/ZN6DUvZdiIHHv/LaGsS0x9tnxaK3jph6VqqvE3Wd2sWPVNfwLGN2r923/rg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tA6QE-0005q5-Ef for bug-guix@gnu.org; Sun, 10 Nov 2024 06:48:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#73979: validate-runpath phases fails when binaries linked to package's own libraries Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 10 Nov 2024 11:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73979 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Maxim Cournoyer Cc: 73979@debbugs.gnu.org Received: via spool by 73979-submit@debbugs.gnu.org id=B73979.173123925022400 (code B ref 73979); Sun, 10 Nov 2024 11:48:02 +0000 Received: (at 73979) by debbugs.gnu.org; 10 Nov 2024 11:47:30 +0000 Received: from localhost ([127.0.0.1]:55989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tA6Ph-0005pE-Jp for submit@debbugs.gnu.org; Sun, 10 Nov 2024 06:47:30 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33690) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tA6Pf-0005p0-Iu for 73979@debbugs.gnu.org; Sun, 10 Nov 2024 06:47:28 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tA6PZ-0000vY-RG; Sun, 10 Nov 2024 06:47:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=hSxv+CsXObb851fo1aPTVrdf3pzhHPMYrcl5fOGz5xE=; b=UNd7TddENqyCs0c7z22n uu4EnbPgcMJatM8LjKYYrVhqAacFIrXJ+d0pmIT+yMIjJLDeNeOc+wjfGdeHqfAgM9mpO+gRHDv46 WCRzJhNh2m48ZPV3AAbOe67krO45IfkLbB0ArF036Ny2VFhg8VyyRnNntepIMb+x/WeGYzT683cEr 0z3WVLAWb+NmkIG+0tmJ4ZIpkR7eK0c7wo0CpkplvfDWYMYoEjGcuGufD5bRdEJIFyS1Fhh1c+SLy 0bDVKoFhWb/utHkzE2IQgmp+8DzlTx7XpUuIm0ZOGCT6l6WAdt4JTUPHSXheBK1Kah+4h0oB0Q0fp mfL7K7RRvIRbZg==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: <87y12excns.fsf@gmail.com> (Maxim Cournoyer's message of "Thu, 24 Oct 2024 15:01:11 +0900") References: <87y12excns.fsf@gmail.com> Date: Sun, 10 Nov 2024 12:47:19 +0100 Message-ID: <87jzdbwbso.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: -0.12 X-Spam-Score: -0.12 X-Migadu-Queue-Id: C0C007F3DC X-TUID: H9s/mLCxNF7E Hi, Maxim Cournoyer skribis: > There's a common pattern in packages where the validate-runpath phases > fail, which is when a binary is linked to libraries provided by the same > package. In this case, our ld-wrapper script appears to not bake the > required runpath, which then fails the validate-runpath phase. > > When this happens, the common workaround is adding link directives such > as (string-append "-Wl,-rpath=3D" #$output "/lib/subdir") to LDFLAGS (see > for example the 'dmraid' package definition). I believe this is the exception, not the rule, and I see that as a bug in the build system of those packages. (As a counterexample, any package built with Automake/Libtool is fine.) > g++ mainaccc.o ../../linux/linuxspec.o ac3dload.o ac3dgroup.o -L/tmp/guix= -build-torcs-1.3.7.drv-0/torcs-1.3.7/export/lib -lopenal -lalut -lvorbisfi= le -L/usr/lib -ltgf -lplibssg -lplibsg -lplibul -ltxml -lplibjs -lplibssga= ux -lplibssg -lplibsm -lplibsl -lplibsg -lplibul -lglut -lGLU -lGL -lpng -l= z -ldl -lXrandr -lXrender -lXxf86vm -lXmu -lXi -lXt -lSM -lICE -lXext -lX11= -lm -o accc-bin Here it=E2=80=99s missing =E2=80=9C-LOUTPUT/lib=E2=80=9D or similar, which = is why =E2=80=98ld-wrapper=E2=80=99 does not add =E2=80=98-Wl,-rpath=E2=80=99. (Libtool, and I believe some ot= her build systems as well, relink binaries upon installation.) Note that probably =E2=80=9C-L/usr/lib=E2=80=9D is meant as =E2=80=9C-LOUTP= UT/lib=E2=80=9D. > So we see that ld-wrapper saw the accc-bin binary being linked against > the package's own > /tmp/guix-build-torcs-1.3.7.drv-0/torcs-1.3.7/export/lib/libtgf.so, but > this is later dismissed for "not being in the store", by this code in > gnu/packages/ld-wrapper.in: Well, yeah. > One idea could be to allow creating rpaths to %BUILD-DIRECTORY prefixed > libraries, and have these entries refined in a phase that would run > after the package is installed, before the validate-runpath phase runs. > It could be called e.g. 'sanitize-runpath' and proceed along those > lines: > > Scan for RUNPATH entries being prefixed by %BUILD-DIRECTORY; attempt to > have them rewritten to libraries (.so) found under the package's own > libdir library prefix (at any depth), including a potential "lib" > output. In case it couldn't, it would error. > > Does that sound feasible? It might be feasible, but I think it=E2=80=99s the wrong approach. The pro= blem here is in the build system itself; Guix is =E2=80=9Cnot at fault=E2=80=9D,= so to speak. Nevertheless, from a practical viewpoint, whether or not Guix is at fault is largely irrelevant. So the question becomes: how widespread is this issue? If it=E2=80=99s widespread, can it be solved at a (guix build-system =E2=80=A6) level? (For instance, I think =E2=80=98cmake-build= -system=E2=80=99 and =E2=80=98meson-build-system=E2=80=99 do the right things in that regard.) If it=E2=80=99s a per-package issue, which seems to be the case given what = you describe, then I would fix it locally in this package, for instance by passing =E2=80=98-Wl,-rpath=3D$ORIGIN/../lib=E2=80=99 or whatever is conven= ient. HTH! Ludo=E2=80=99.