public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Maciej W. Rozycki" <macro@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/3] GDB: Run `pkg-config' with `--static' to pull libguile dependencies
Date: Mon, 28 Nov 2022 15:35:24 +0200	[thread overview]
Message-ID: <83iliznqw3.fsf@gnu.org> (raw)
In-Reply-To: <alpine.DEB.2.20.2211272338130.19931@tpp.orcam.me.uk> (macro@embecosm.com)

> Date: Mon, 28 Nov 2022 12:59:52 +0000 (GMT)
> From: "Maciej W. Rozycki" <macro@embecosm.com>
> 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. <https://bugs.freedesktop.org/show_bug.cgi?id=19541>.
> 
>  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.

  reply	other threads:[~2022-11-28 13:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24 23:50 [PATCH 0/3] GDB: Fix `pkg-config' issues with configuring for Guile Maciej W. Rozycki
2022-11-24 23:51 ` [PATCH 1/3] GDB: Run `pkg-config' with `--static' to pull libguile dependencies Maciej W. Rozycki
2022-11-25  7:56   ` Eli Zaretskii
2022-11-28 12:59     ` Maciej W. Rozycki
2022-11-28 13:35       ` Eli Zaretskii [this message]
2022-11-24 23:51 ` [PATCH 2/3] GDB: Permit a lone version of Guile with `--with-guile=' Maciej W. Rozycki
2022-11-26 23:38   ` Mike Frysinger
2022-11-28 13:00     ` Maciej W. Rozycki
2022-11-24 23:51 ` [PATCH 3/3] GDB: Use standard autoconf macros for `pkg-config' Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83iliznqw3.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@embecosm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).