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 5FB243945C16 for ; Fri, 25 Nov 2022 07:56:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5FB243945C16 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 1oyTZ2-0001j4-HK; Fri, 25 Nov 2022 02:56:00 -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=+qLW4Q5QYOP73J4hQcYKepu9GdK9LQSXpChwXpzKElk=; b=DMN5Tx9zBjrx 7pE2UVh/tzMnzW6uRpzHQbZFkOVNqXtRMCHVMRMEirLszKEfBlcXIVmc0kbifj5wOsBLH01G7h9QW TxVYFWemvutvAyu2Uhn7xhbE5yeVhmhhrKGC9n19HREq8HaU3935Uy2ep30flGE2QeoAH2LA7Whta K6SSxu3zCdSpjBam7GsHjldw3bWKhNxObIPikNNkUfPiXE6M+RQ/WtdLEfSnSU52CCY+4fR9x5iq2 4zCT+bpW/m3QOu04sMMglqZx+dkoW4m2nWxNjxVYLHUV/45C2gvzx/JyGPVF5wXqvdBEW1iNbjKph X8M0oDLcehmpsRGhD3fMUQ==; 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 1oyTZ1-0000Kp-GX; Fri, 25 Nov 2022 02:55:59 -0500 Date: Fri, 25 Nov 2022 09:56:21 +0200 Message-Id: <83pmdbv55m.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: 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: Thu, 24 Nov 2022 23:51:09 +0000 (GMT) > From: "Maciej W. Rozycki" > > 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.