From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id F28173853D66 for ; Mon, 28 Nov 2022 13:34:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F28173853D66 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org 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 1ozeHe-0005vj-GL; Mon, 28 Nov 2022 08:34:54 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=dOyxwWQ2wyK3aEmXuzI/+pb2+qNoOHchMClFX376kW0=; b=RjB0OHrToJcP 00jbvebYjDXra4eGG57BH9aWO+WWLlDTPqOH4tJ9H5kKyIOLKXPl/EKbPqUpCXe8Ai332E0qib4mA z9YMFZuM05m4Hl/hGbI0jH8Rq9WXZF6fDhrCe3gPTmI9ceo6OI0S6cNQ9yhsSRTix2oTikIbPH4cO ctGm48XjnACu3ki2mQbGROoa5vcxiOnqhutrbvlTdl4b2DHfau5h29c6hTj518qnsjSbGtgdw8gdP OOehEQvG8KaByu7CgIaKvo+WmjaKqMTKfgT19yqEZ/ZORofcdZKMPN7YX0NH16usXtMLdEXd3vI5Q zgMh7ZJLTBL7JAJePA4Y9A==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ozeHd-0006oV-I4; Mon, 28 Nov 2022 08:34:53 -0500 Date: Mon, 28 Nov 2022 15:35:24 +0200 Message-Id: <83iliznqw3.fsf@gnu.org> From: Eli Zaretskii To: "Maciej W. Rozycki" Cc: gdb-patches@sourceware.org In-Reply-To: (macro@embecosm.com) Subject: Re: [PATCH 1/3] GDB: Run `pkg-config' with `--static' to pull libguile dependencies References: <83pmdbv55m.fsf@gnu.org> X-Spam-Status: No, score=1.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > Date: Mon, 28 Nov 2022 12:59:52 +0000 (GMT) > From: "Maciej W. Rozycki" > cc: gdb-patches@sourceware.org > > > If only a static version of the Guile library is installed, how come > > "pkg-config --libs" doesn't produce the list of all the dependency libraries > > for static linking? Isn't that a bug in Guile installation on that system? > > If anything, it's a bug in Guile itself Well, "bug in Guile installation" and "bug in Guile itself" are almost synonymous... > or more likely a design issue with pkg-config. That I don't think. Basically, I think a static-library only installation should have the same list of libraries in Libs and in Libs.private. And this should be produced by the build when the user selects --disable-shared. > But any such provision looks to me like a lot of effort for software > writers, to take away which is the very purpose of pkg-config. So what I > think pkg-config should do is to provide a flag for the .pc file to be set > by `configure' or otherwise, which would tell pkg-config that said package > has been built with no shared libraries available, via `--disable-shared' > or an equivalent. That "flag" is the value of Libs, AFAIU. > In such a case pkg-config would always include Libs.private along with > Libs when requested by `--libs', even if no `--static' option has been > given. Which leads me to a conclusion it's an oversight in the pkg-config > design that it does not provide for the static-only link scenario in a > reasonable way. I'm not sure it's an oversight in the design of pkg-config, but I'm not an expert on that enough to be sure. > > > Therefore fix the issue by using the `--static' option unconditionally > > > with `pkg-config', adding the dependencies required: > > > > I don't think I've every seen a configure script that explicitly includes > > the --static switch to pkg-config. Did you? If not, how do they deal with > > this issue? Almost any external library with which GDB is linked can be > > installed as a static-only library, so do we need to use --static in all > > pkg-config tests? I see that your proposed patch only changes the tests for > > Guile and for source-highlight libraries. > > It seems to me that distributions universally build libraries as shared > and do not provide for installing static libraries without their shared > counterparts. And that people hardly ever build from sources nowadays. If that is what happens, maybe we shouldn't support this use case so easily and OOTB? > So it looks to me like this issue is not dealt with at all, and while we > might try to fix the world outside, it could be a futile effort. And in > any case it'd be long until any solution lands downstream. Then as I say > indirect dependencies are best included in ELF links involving dynamic > shared objects anyway, so I think using `--static' is in my opinion a > reasonable solution. I think it's also needed for the `CFLAGS=-static' > case too. Cf. . > > I haven't looked at pieces coming from outside gdb/, and I can see now > that the debuginfod library isn't handled at this point (I don't know if > it has any indirect dependencies). It's use here is a strong argument in > favour of 3/3, so that we don't use $pkg_config and $PKG_CONFIG variables > both at a time for the same thing in a single script (what a mess!). > > Do you find my observations a sufficient justification for my proposed > change now? Thank you for your insights! I'm not opposed to installing your changes, as they cannot do any harm, AFAICT. maybe just add enough commentary about this unusual practice to explain why we do it. Thanks.