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 8IAvMkCrY2cgCQAAqHPOHw:P1 (envelope-from ) for ; Thu, 19 Dec 2024 05:12:32 +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 8IAvMkCrY2cgCQAAqHPOHw (envelope-from ) for ; Thu, 19 Dec 2024 06:12:32 +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=egXPu4qk; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=TugnMNg0; 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), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1734585152; 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-to: 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=VSVsbImh0rdmHWYPLMCdbVfkEMap8O/oWq1YdLhz0bI=; b=iR1odx/BGezP4aXeK+F5sBuOPCXhKs79myqQWKuKpT6Loqqn9Z4j+XaH+aHH6+GrNy0Chp Ab10jBaKx96GarxDIVOS+dhmTfegRMeRULEEdZEauI8FeNvk8oTXcwNYnxfATy4l5Ht58N EtPv/C7mLVkNs1Y1FhAmviRfp80gF5fuLWyJakmW3D65YwN+BBIoeZ6vJPPIT0eYF/bC4B QJEP/NQXG864z0l7K9LI6BcMBjI87ZhMvaXARQTfqcB+ZKA40xPi4KKcldP4o/aiOd5Zzm zYBLPnvmSBJ5W8xF4x+7QJrS1M4TAHQW5aOb/TXRw2z/YFBbMlODTmW00NvDiA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1734585152; a=rsa-sha256; cv=none; b=UGPPy95qlz5ywMxMmiIGyJTO80V0JACgnTO8meESqSEfVnZ+6M5s7C9CokFJle4J+XNt+H g/9YReLkQ0rY2VMyjIdHSzG1IsC+2pcw1l0epblb3jpKB7B/nSCf/xyCUpcnkiUHCmqgOZ BUBQdoqV9eXKkCcsKccl3SOFs1vPL+zretoBpPomwecxh41SrrkVRMLe7sZz+2kfjMme7C 8nq1RjlAC2jDoB4j9OiRKFKomMBA2Tf4iZMDzCHIr9ZBd0/0oYKxhisQHugSMBFTfKjuYu J4soH9gDFNvHkI7BpZimicmflA4SIyx+PQjBVnvudk4oLK+Wl3BvMRskF9ejDA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=egXPu4qk; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=TugnMNg0; 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), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none) 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 F411F872A4 for ; Thu, 19 Dec 2024 06:12:31 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tO8pR-0003zZ-Bf; Thu, 19 Dec 2024 00:12: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 1tO8pP-0003z8-6G for bug-guix@gnu.org; Thu, 19 Dec 2024 00:12: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 1tO8pO-0007Bf-TY for bug-guix@gnu.org; Thu, 19 Dec 2024 00:12: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=VSVsbImh0rdmHWYPLMCdbVfkEMap8O/oWq1YdLhz0bI=; b=egXPu4qkdCKSo3E+l54iGFayYGTsEnscz6J+kEgIzRnsarvBo1LEcJv/A0XXPHe+mWwup2Vdl0ZvXMbubhNnuKDQ2YAF77/iJq0VeOZGZl7cmQyR/7tmnsLVZ1Wq9rU4hWwbwMhOTVEIUjPE2i/NoNjnoKEqf/+VMYyOvaYENBdqiLuiD1R3FVyf2ppLIiWmQ8zczH6RLt2rIlQRMP5RX80s2IfRz0hblRBdZLsEWX59194t3STTr/Vv/FTPDhSpPRYrlqnfyz41ivIUu9Mr21VEjNUFIw4gcywigzPkM+TxEoSJP+C+Qu0Ef7hs1zGc8iFh7Ss/XaS+uAVQollWgw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tO8pO-0000Aq-OC for bug-guix@gnu.org; Thu, 19 Dec 2024 00:12:02 -0500 Subject: bug#73979: validate-runpath phases fails when binaries linked to package's own libraries Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-To: bug-guix@gnu.org Resent-Date: Thu, 19 Dec 2024 05:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 73979 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 73979-done@debbugs.gnu.org Mail-Followup-To: 73979@debbugs.gnu.org, maxim.cournoyer@gmail.com, maxim.cournoyer@gmail.com Received: via spool by 73979-done@debbugs.gnu.org id=D73979.1734585100596 (code D ref 73979); Thu, 19 Dec 2024 05:12:02 +0000 Received: (at 73979-done) by debbugs.gnu.org; 19 Dec 2024 05:11:40 +0000 Received: from localhost ([127.0.0.1]:36985 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tO8p2-00009X-8t for submit@debbugs.gnu.org; Thu, 19 Dec 2024 00:11:40 -0500 Received: from mail-pf1-f175.google.com ([209.85.210.175]:55716) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tO8p0-00009F-Ay for 73979-done@debbugs.gnu.org; Thu, 19 Dec 2024 00:11:38 -0500 Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-728f337a921so426299b3a.3 for <73979-done@debbugs.gnu.org>; Wed, 18 Dec 2024 21:11:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734585031; x=1735189831; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VSVsbImh0rdmHWYPLMCdbVfkEMap8O/oWq1YdLhz0bI=; b=TugnMNg05Qsh0gxHCJarVI+AA0dpDh7VopdiNb4vx/Rr/XXREOTRs/COquYaOtyzo0 JVjD81ufTVrgy9XduW+feNutRJt4VL3/RHoYNZrOL+1ax1ut+l9gYv/uPYHzMEiEXxu7 0uaffWutFJa2w4FsPqh7vaXlOur4viD7WF3H8FZ9QqBQzUybCrJYhmBuHUvHf7Jb6Mx6 +DKLVkajyfGtt6TlovCz2O4sIkLXEuThDJ0q2a/ame/knVtU8nPfkA5QLDf4rLst5yx2 s8tH/+Qd3uI81LLwMy7S7kTEScxYVt9prSKF0cymxwFQwVJ8JGZ9al5iP1sgqdC1+5Ih KtvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734585031; x=1735189831; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=VSVsbImh0rdmHWYPLMCdbVfkEMap8O/oWq1YdLhz0bI=; b=QcOc1EIzDr8T66Qrp7tlT8oFOfwZiNLyqJQEGYP/ZCKWXe2NE55oqnPEBWOjn9eSsg C+U/JDCYFrasQPShiX+4Pcn/VHHW0e8OOsweTVVFGd1E4EGcFqqsCMT2zlo0sJukKD8G TKx7tVoqX98gr867O/nF5KtvizjkuXNHrEpLB5WUsT8stE8iJnpyo7q8Mn+ZoLYA8OVf yMN4T+lqB9OP8YhtTVDDoSjVxDBG5ppBypR2i8VJ1asHkAUYhDFjFPqfXr0Bib5NP2Il /+7gr2WyxQINHZf6y7asYmlftvAwpZmp7Nhzk3/M722TgyXdc42U5egwXki443BGrX0+ 4IWQ== X-Gm-Message-State: AOJu0Yzuu2x7Euj3Lnx5i3KxkDrCZfrObM5T6cUIOxomm3CzVd1r9AG3 gJc+5qx3wkFwzf1aqCvKFJX/dcUBWaLFNlh3q2RySeQcuOQT0VAsW34j30SlRtI= X-Gm-Gg: ASbGncsiJO60JkHFf1+j2h9JOcJTYlp0e1+InaKCz/1f1TUNoha4LpHH5xgYx2jYqMk ogyz8XPhUefYvc3iYJr+t73Io5D/X7UIKHdXsKIZTQv6X3PDn5MYPpwZzfhRNqRgmLz+1mKjlSW YhE6Lqdm9HIhuYnRxOIiBuMbX0bPjxqq/98wqzzWMC/1xeQke47XrE3lIPpqRoqehtflz3FuyDm g/ZxfnNWzWdVXaaiJN4+NeUtylcyUPZxXb8qiVl/ISEa/4xxuPIzw== X-Google-Smtp-Source: AGHT+IEGhCHx+C5iVwU+eA4G2v1J4mPi8oKwVeWKhSW0OBLaY9gAPa+Il6t7vSWxtHVuo9CVadAIzQ== X-Received: by 2002:a05:6a21:3989:b0:1e0:bedf:5902 with SMTP id adf61e73a8af0-1e5c74f3209mr2494477637.6.1734585031347; Wed, 18 Dec 2024 21:10:31 -0800 (PST) Received: from terra ([2405:6586:be0:0:c8ff:1707:9b9:af89]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8fd610sm368928b3a.136.2024.12.18.21.10.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Dec 2024 21:10:30 -0800 (PST) From: Maxim Cournoyer In-Reply-To: <87jzdbwbso.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Sun, 10 Nov 2024 12:47:19 +0100") References: <87y12excns.fsf@gmail.com> <87jzdbwbso.fsf@gnu.org> Date: Thu, 19 Dec 2024 14:10:21 +0900 Message-ID: <87h670mf5u.fsf@gmail.com> 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: -3.68 X-Spam-Score: -3.68 X-Migadu-Queue-Id: F411F872A4 X-TUID: YdnrJdmY5f8j Hi Ludovic, Ludovic Court=C3=A8s writes: > 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.) Interesting. I had not considered that point of view (that the build system/usage of it could be at cause) enough; I think you are right. [...] >> 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 p= roblem > 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-bui= ld-system=E2=80=99 and > =E2=80=98meson-build-system=E2=80=99 do the right things in that regard.) I think CMake nowadays doesn't relink but uses some ELF-patching code to patch the installed binaries in place (which is faster than relinking); that would mean our ld-wrapper doesn't get involved in these case and we depend on RPATH being enabled in the CMake build system, which it normally is unless the package set CMAKE_SKIP_RPATH to false. I guess Meson is also patching binaries for speed. > If it=E2=80=99s a per-package issue, which seems to be the case given wha= t 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 conv= enient. There doesn't seem to be so many occurrences; grepping for '-Wl,-rpath.*output' I find 73 problematic packages. I've found one place where this happens is for Cythonized shared objects; this produced shared objects linked to a library of the build directory, and is not concerned with installing so nothing rewrites the runpath entries to their correct installed location. One such example is openpmix; the issue was dismissed as "we expect people to set LD_LIBRARY_PATH" [0]. [0] https://github.com/openpmix/openpmix/issues/3457 Anyway, sorry for the wall of text. Closing! --=20 Thanks, Maxim