From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by sourceware.org (Postfix) with ESMTPS id E2AD3386545A for ; Fri, 18 Aug 2023 22:31:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E2AD3386545A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3fe1a17f983so13256015e9.3 for ; Fri, 18 Aug 2023 15:31:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1692397908; x=1693002708; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=7AcBpDfRkXeOKzhiMKxnc9A/ekDNc8SvxC+tv+gMpXo=; b=FmU0ESmTSg1bB8Vy8Wzpkcm/xhMcxqwr64a+GsRAFZMbelw7ANWxqQfKxi6dV5RBuJ XZvryDK6TeYrtPCbgrlLtq71KFmHNyQKVYCk67hpleXgB002C2MvV5TZ4USEJIa5zsGm +LZ25d6bLgTeCM8vFxdswmDXFRmfLPUr+EK/vUj1R3p97iDaF8vPZfXr+0yRw1LhO5zi LzJk/mQuW0GRaOqNaUxkt9Xwacwr2y7rdMyOyE1TGF7I085MyZsXS4Y0qx9FSdyc0eFD um+J2gdY3Yj9YxNcT5tC2nY7Y+7BxElk5KADgoDfi51wEUf/1HT1237oHtLUHQws2Doq 6+jA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692397908; x=1693002708; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7AcBpDfRkXeOKzhiMKxnc9A/ekDNc8SvxC+tv+gMpXo=; b=U72zzwRoZxjz2JEaHjk/4u9OATW9pzQTmAEsZOh37zvGfSjAkzRBejo+RI4eQMhLYk Xwh55d139KKYHcwDnRMihTKMI2pzzXPdI7gFCLBswG8qEq6KCCg6CEeWpQQI0pZkw/Zc reyzDe78yS2of+v/UFuxZ/eIj+gvRmTcUFTnYlvYd4YtoqjgPTOBJWC7xVltVuXw00hi FwZ3TSoVURuPysIsDHbDFFZr1piU0pLVwQFhPdObcrt5d+IiYuE0Adkgvg73JaVB/SHx Zzzzta+kOx3YYgLUTgzCdDteKAU8eEpG7rOCvuTCpykQUaSDYbHdmav6XghFxqf5n5GO dk6A== X-Gm-Message-State: AOJu0YxbMtPwmBDYGeUBDenU/pGTMHUTfBiSdjbPuAi2dIZBh3jM75xX NOXsA2DyblX55GFmA1afODw= X-Google-Smtp-Source: AGHT+IHmB2XtfIrV+a8F8xY03FCZDfe36XD0FBzVqT3612oUKotv4tLextEHfUdEbXPdQwg7Y9OJjA== X-Received: by 2002:a05:600c:2218:b0:3fe:ad3:b072 with SMTP id z24-20020a05600c221800b003fe0ad3b072mr323473wml.17.1692397908200; Fri, 18 Aug 2023 15:31:48 -0700 (PDT) Received: from smtpclient.apple (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.gmail.com with ESMTPSA id t10-20020a5d49ca000000b0031ad2f9269dsm4101541wrs.40.2023.08.18.15.31.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2023 15:31:47 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.4\)) Subject: Re: Darwin: Replace environment runpath with embedded [PR88590] From: Iain Sandoe In-Reply-To: <92993a50-9667-45da-a62-5089e7e052f8@codesourcery.com> Date: Fri, 18 Aug 2023 23:31:46 +0100 Cc: FX Coudert , GCC Patches Content-Transfer-Encoding: quoted-printable Message-Id: <192597CA-AB73-4D97-94B8-C30B8AC1FFC3@gmail.com> References: <92993a50-9667-45da-a62-5089e7e052f8@codesourcery.com> To: Joseph Myers X-Mailer: Apple Mail (2.3696.120.41.1.4) X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi Joseph, > On 18 Aug 2023, at 21:17, Joseph Myers = wrote: >=20 > On Tue, 15 Aug 2023, FX Coudert via Gcc-patches wrote: >=20 >> I am currently retesting the patches on various archs (Linux and = Darwin)=20 >> after a final rebase, but various previous versions were=20 >> regression-tested, and have been shipped for a long time in Homebrew. >>=20 >> OK to commit? >=20 > The driver changes are OK. >=20 > I think the new configure options and the new -nodefaultrpaths = compiler=20 > option need documenting (I suppose there might be a case for the = configure=20 > option defined in libtool code being documented somewhere in libtool, = if=20 > there's somewhere appropriate, but I don't see that in the libtool = patch=20 > submission). >=20 > The help text for --enable-darwin-at-rpath refers to it as=20 > --enable-darwin-at-path. OK, we need to fix those things. > Somewhere the documentation ought to discuss the considerations around=20= > embedding such paths in binaries, and what's appropriate for building = a=20 > binary on the system where it's going to be used, versus using the=20 > compiler to build redistributed binaries that will be run on a system = that=20 > doesn't have the compiler installed (and so shouldn't have hardcoded = paths=20 > that were only applicable on the system with the compiler, but will = need=20 > to be able to find shared libraries - probably shipped with the binary = -=20 > somehow). Actually, the changes are not so dramatic as they seem (for Darwin) = since we already have less flexibility than other unix-like systems. The status quo is that installed libraries embed their runpath e.g: /path/to/compiler/install/lib/libgfortran.dylib When executables are built, they embed the full library names for = dependent libraries (this "two-level" namespacing has some useful and = not-so-useful sides to it). However, Darwin compiler installations are not relocatable without = re-writing the library names and, because of the vendor=E2=80=99s decision to neuter DYLD_LIBRARY_PATH, (the Darwin equivalent of LD_LIBRARY_PATH) it makes it quite involved to do such a move. =3D=3D=3D After the change: libraries are identified as @rpath/libgfortran.dylib (for example) and any executable built by the compiler has a runpath = /path/to/compiler/install/lib. Actually, after this change the compiler is initially relocatable (that = is you can choose to install it anywhere) but once installed, if you move it, that would = break executables already built because they embed the path to the installation. So, in practice, for the =E2=80=9Cout of the tin=E2=80=9D self-use of = GCC, there is no practical difference between the existing fixed installation and a =E2=80=9Cplaced once=E2=80=9D = installation. [however, the change means that we can correctly configure the compiler, = since the runpaths at build time can be made to point to the uninstalled libraries, which = is the underlying problem we are solving]. =E2=80=94 on the topic of building applications for distribution: The expectation for Darwin platforms is that dependent libraries are = shipped along with applications (it is not desirable to require that end users have to have = elevated privs to install them in some Well Known Place, and [other than OSS distributions = like macports and homebrew] there is no common place to expect to find OSS libraries). There is quite extensive Apple Developer documentation on delivering = packages with co-installed libraries using @rpath (that is the intended mechanism for = delivery since it allows drag-and-drop installation and moving of built applications). The revised compiler has libraries already built in a suitable manner = for that distribution model. I would not propose that we repeated such information - but we could = refer to it? Generally, I=E2=80=99d prefer we suggested searching for such = documentation, rather than linking to it, since links can expire - does that seem reasonable? thanks for the reviews Iain > --=20 > Joseph S. Myers > joseph@codesourcery.com