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: Fri, 25 Nov 2022 09:56:21 +0200	[thread overview]
Message-ID: <83pmdbv55m.fsf@gnu.org> (raw)
In-Reply-To: <alpine.DEB.2.20.2211241907010.19931@tpp.orcam.me.uk> (macro@embecosm.com)

> Date: Thu, 24 Nov 2022 23:51:09 +0000 (GMT)
> From: "Maciej W. Rozycki" <macro@embecosm.com>
> 
> Fix a configuration error:
> 
> checking whether to use guile... guile-2.2
> checking for pkg-config... /usr/bin/pkg-config
> checking for usable guile from /usr/bin/pkg-config... checking for scm_set_automatic_finalization_enabled... no
> configure: error: in `.../gdb':
> configure: error: linking guile version guile-2.2 test program failed
> See `config.log' for more details
> make[1]: *** [Makefile:12160: configure-gdb] Error 1
> 
> coming from link errors as recorded in `config.log' referred:
> 
> configure:19349: checking for scm_set_automatic_finalization_enabled
> configure:19349: gcc -o conftest -pipe -O2      -pthread -I.../include/guile/2.2   conftest.c -lncursesw -lm -ldl  -L.../lib -lguile-2.2 -lgc >&5
> /usr/bin/ld: .../lib/libguile-2.2.a(libguile_2.2_la-ports.o): in function `scm_ungetc':
> (.text+0x5561): undefined reference to `u32_conv_to_encoding'
> /usr/bin/ld: (.text+0x56e1): undefined reference to `u32_to_u8'
> 
> etc., etc., in a valid configuration where a static version of libguile 
> has only been installed, which is a pefectly valid system configuration.  
> This is due to symbols being required from libguile's dependencies that 
> have not been included in the linker invocation.
> 
> In configurations using the ELF format dynamic libguile implicitly pulls 
> indirect dependencies in the link, but to satisfy static libguile they 
> need to be named explicitly.  These dependencies have been recorded and 
> can be supplied by `pkg-config', but for that to happen the tool has to 
> be invoked with the `--static' option in addition to `--libs'.  Moreover 
> it is recommended, at least with systems using the ELF format, to have 
> indirect dependencies included with static linker invocation even where 
> they all are satisfied by dynamic libraries.

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?

> 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.

Thanks.

  reply	other threads:[~2022-11-25  7:56 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 [this message]
2022-11-28 12:59     ` Maciej W. Rozycki
2022-11-28 13:35       ` Eli Zaretskii
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=83pmdbv55m.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).