From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by sourceware.org (Postfix) with ESMTPS id 492EC3896C12 for ; Thu, 24 Nov 2022 23:51:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 492EC3896C12 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com Received: by mail-wm1-x32b.google.com with SMTP id p13-20020a05600c468d00b003cf8859ed1bso2233836wmo.1 for ; Thu, 24 Nov 2022 15:51:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=mime-version:user-agent:references:message-id:in-reply-to:subject :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=A7KCHwxRqviVuOXtx47VPcLQHVCF3zFrNUiGft3Vh2k=; b=W3oAx39ZJaozAhcE7GYYw+g2Gj0oq6J8yJLwyfblCWj0ZcZoZ2b0/pIzqNgi+cvbPX vQkf+v7XBYa5msDfjuEdoY6Dv17cAAaxPgCBXEGN3cXH5KrqI8PaN+uCX1IZU9A4JMs0 YJsaPLXVNDZYy7yo47uLr60UJVGfFjb6GwYn6Ml2fPNMUlNjmx4ymG07NF/bzoVKLlHE I2gyNov54xdDGiXsoFR5zEOxPq/JJTPp/mUNZiKw5oLbmZQXfwrFbcuPFap+MTNA4Zno WRe2z1Wr2yPVmd0xW87VvYwENX8HSMdsVaqDDrMWu8feZNKv2c9ICLxknH3u/dp9aPtR E2hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:references:message-id:in-reply-to:subject :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=A7KCHwxRqviVuOXtx47VPcLQHVCF3zFrNUiGft3Vh2k=; b=w6pcypHcvdw083nlc6wY0fFAJ7cOphxkxxoYafwRxXG/bANxp5ZqE4+TRO5Iqz30Dv ECpE2G0l5BBVyy14HsYvWngaxhpschQjyeG75env0RripZ+D3rTCmzOjZoWC5AJkXPED ism7ogwew1h1qyy6Gmk0ZnKqhgdc33c74ZVzsMDbuomU/tgk1bYYpj1trwms0LwbyuuQ es21Aiehvx4JT+J3Onr1mDROqbnw43njjQGLatEhrvegRuzp/JFUKzUZYhDDpEeuXq6/ INr4O9KGZq9/qCZ1ZAEhESuPmKYwppWYiPm0r1oB68fg7xjhpYHzV1r6j0VopMFlEKMm G7Gg== X-Gm-Message-State: ANoB5pkq4TJ0pK9HXe6fwZBDdQ8u97VLXteIIvAg9tiqVJm2ekibXNd4 IjCLh/xPQo9SzXZSP5dCyTK9HcZtHOeXeUrx X-Google-Smtp-Source: AA0mqf5tgacMAmzIMGZsoPVN/zuEHSN5e/NkVvKZmKEQqvvR7oCoFbeFrLqgyoUh3Sa3EioHIBv0hg== X-Received: by 2002:a05:600c:2241:b0:3cf:9ced:dce4 with SMTP id a1-20020a05600c224100b003cf9ceddce4mr24868317wmm.120.1669333871032; Thu, 24 Nov 2022 15:51:11 -0800 (PST) Received: from tpp.orcam.me.uk (tpp.orcam.me.uk. [2001:8b0:154:0:ea6a:64ff:fe24:f2fc]) by smtp.gmail.com with ESMTPSA id w16-20020adfd4d0000000b00238df11940fsm2423393wrk.16.2022.11.24.15.51.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Nov 2022 15:51:10 -0800 (PST) Date: Thu, 24 Nov 2022 23:51:09 +0000 (GMT) From: "Maciej W. Rozycki" To: gdb-patches@sourceware.org Subject: [PATCH 1/3] GDB: Run `pkg-config' with `--static' to pull libguile dependencies In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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. Therefore fix the issue by using the `--static' option unconditionally with `pkg-config', adding the dependencies required: configure:19349: gcc -o conftest -pipe -O2 -pthread -I.../include/guile/2.2 conftest.c -lncursesw -lm -ldl -L.../lib -lguile-2.2 -lgc -lgmp -lltdl -lffi -lunistring -lcrypt -lm >&5 and removing the errors quoted above. --- gdb/configure | 10 +++++----- gdb/configure.ac | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) gdb-pkgconfig-static.diff Index: src/gdb/configure =================================================================== --- src.orig/gdb/configure +++ src/gdb/configure @@ -22917,7 +22917,7 @@ $as_echo_n "checking for usable guile fr if test $? != 0; then as_fn_error $? "failure running pkg-config --cflags ${guile_version}" "$LINENO" 5 fi - new_LIBS=`${pkg_config} --libs ${guile_version}` + new_LIBS=`${pkg_config} --static --libs ${guile_version}` if test $? != 0; then as_fn_error $? "failure running pkg-config --libs ${guile_version}" "$LINENO" 5 fi @@ -23001,7 +23001,7 @@ $as_echo_n "checking for usable guile fr if test $? != 0; then as_fn_error $? "failure running pkg-config --cflags ${guile_version}" "$LINENO" 5 fi - new_LIBS=`${pkg_config} --libs ${guile_version}` + new_LIBS=`${pkg_config} --static --libs ${guile_version}` if test $? != 0; then as_fn_error $? "failure running pkg-config --libs ${guile_version}" "$LINENO" 5 fi @@ -23082,7 +23082,7 @@ $as_echo_n "checking for usable guile fr if test $? != 0; then as_fn_error $? "failure running pkg-config --cflags ${guile_version}" "$LINENO" 5 fi - new_LIBS=`${pkg_config} --libs ${guile_version}` + new_LIBS=`${pkg_config} --static --libs ${guile_version}` if test $? != 0; then as_fn_error $? "failure running pkg-config --libs ${guile_version}" "$LINENO" 5 fi @@ -23173,7 +23173,7 @@ $as_echo_n "checking for usable guile fr if test $? != 0; then as_fn_error $? "failure running pkg-config --cflags ${guile_version}" "$LINENO" 5 fi - new_LIBS=`${pkg_config} --libs ${guile_version}` + new_LIBS=`${pkg_config} --static --libs ${guile_version}` if test $? != 0; then as_fn_error $? "failure running pkg-config --libs ${guile_version}" "$LINENO" 5 fi @@ -23418,7 +23418,7 @@ $as_echo "no - pkg-config not found" >&6 esac srchigh_pkg_cflags=`${pkg_config_prog_path} --cflags source-highlight` - srchigh_pkg_libs=`${pkg_config_prog_path} --libs source-highlight` + srchigh_pkg_libs=`${pkg_config_prog_path} --static --libs source-highlight` # Now that we have found a source-highlight library, check if we can use # it. In particular, we're trying to detect the situation that the Index: src/gdb/configure.ac =================================================================== --- src.orig/gdb/configure.ac +++ src/gdb/configure.ac @@ -1020,7 +1020,7 @@ AC_DEFUN([AC_TRY_LIBGUILE], if test $? != 0; then AC_MSG_ERROR([failure running pkg-config --cflags ${guile_version}]) fi - new_LIBS=`${pkg_config} --libs ${guile_version}` + new_LIBS=`${pkg_config} --static --libs ${guile_version}` if test $? != 0; then AC_MSG_ERROR([failure running pkg-config --libs ${guile_version}]) fi @@ -1082,7 +1082,7 @@ dnl NOTE: This needn't be the "re dnl It could be a shell script. It is invoked as: dnl pkg-config --exists $version dnl pkg-config --cflags $version -dnl pkg-config --libs $version +dnl pkg-config --static --libs $version dnl pkg-config --variable guild $version dnl The script will be called with $version having each value in dnl $try_guile_versions until --exists indicates success. @@ -1212,7 +1212,7 @@ either use --disable-source-highlight or esac srchigh_pkg_cflags=`${pkg_config_prog_path} --cflags source-highlight` - srchigh_pkg_libs=`${pkg_config_prog_path} --libs source-highlight` + srchigh_pkg_libs=`${pkg_config_prog_path} --static --libs source-highlight` # Now that we have found a source-highlight library, check if we can use # it. In particular, we're trying to detect the situation that the