From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id gE5uG+NC6GU7yDoAWB0awg (envelope-from ) for ; Wed, 06 Mar 2024 05:18:11 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Dy0mfr/p; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 550D11E0D2; Wed, 6 Mar 2024 05:18:11 -0500 (EST) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id E2C331E092 for ; Wed, 6 Mar 2024 05:18:08 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 43DCA385843A for ; Wed, 6 Mar 2024 10:18:08 +0000 (GMT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E3B223858296 for ; Wed, 6 Mar 2024 10:17:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E3B223858296 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E3B223858296 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709720264; cv=none; b=V+fWnx3FODuUll25IRzGKlkuF+fnIv0tUa+AueKZws1XjklsXuLxoW1FuVskeDg8goVSvOdQ1q5wvADBg9YgL3M1fuFd+Ibv4hw/dSbcCYvj9Q6gx9Nvo358BvU68Neh/XYpfrUgX1/ks4QGVrFcxlyxfzFczYjC19vBwvUCyQs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709720264; c=relaxed/simple; bh=By09wYipvAwWRVgn12In8ew7/LnLcno8X4aoV99N0BU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=oQJkfCUlRYDbn1O74XqfMIW/XxujWDl+rhLwqm/fPEGk3br1QsP1hiqkqaxOtVXgKrMGGfqIuvTHILq+8ix8iwijQMypNKQHvUJmEsP/xGJG/lnPKDbqvDSIcVyFavv50LO4WK0p0wRSR/KTriOmOZsDQX0X1Hb21Cj2tDOmykA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1709720253; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1lv3YoDD4P1bBkIwr2Pctnmr+jITvfNQ9HLGYGITI10=; b=Dy0mfr/pKG7jGbLAdPvGJz3P8r8+NnI2Wv6bzdgCmtYv/8lcZyTfWy0dqig41DJ+85LIuW /eyKVq5KF5zFfy/HTHTdYSdzgnpvvLGczG07k/SLuUn2egP9U9+WTKuNNS/K5DG8jMd5AL ssJpPSMrnh2zeVw6hftGzpX/LLfFfRc= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-240-yzALvP-xOA-gNcb76BZI2Q-1; Wed, 06 Mar 2024 05:17:32 -0500 X-MC-Unique: yzALvP-xOA-gNcb76BZI2Q-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a440b057909so400749666b.3 for ; Wed, 06 Mar 2024 02:17:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709720250; x=1710325050; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1lv3YoDD4P1bBkIwr2Pctnmr+jITvfNQ9HLGYGITI10=; b=RTXb7qcjxZlTpv0DC4K1sBcQmrRK9PQgjrnaHNGgbGo15m3ieTrXwVzSNRO/oLn3Xe 18yYd4/XrqVCB9U1D5HYxV1c4B83hyipHCzp9GTzZDRfr6T97GOJuI7ap4MJr/ncxZxp 5UGnHbSMKUulSz+ypGZxJBzWirgnUxPSsSRo0mae3e9i/9hsjkkazVq+7boQjqlGn0hV 0X1jYacfOvJohZHagyohLrdiTuvl7D6F4T80Mkd2juTeKBTBN6+csQFmpM6qkGPhb3Qv yoFV9SpSPCF/+qHWNNZkKnom9Vir2ajmG2wRJKzdJpZbvnIY0X2P1TMIxO0hWt/3wUdc Insw== X-Gm-Message-State: AOJu0Yx+950c+PiSd9jD3v7JctMzHTz/HaLsfEYRQqQK4qDR4WKhkh/z J5naNTNffZtNCPRmzqgUS6/ZOs8amYcgfquWbW60l04Ph5sSwa7o1Q3cXtmZkhyhXJ4rn0yauNm sygdBGN3MVwpOF0hZGJpyM/sh82mhPCN6yMDhh2cV7suWpDAk+5zKIGc5CdUtxGQb5Kk= X-Received: by 2002:a17:906:8da:b0:a3f:ab4d:f7e3 with SMTP id o26-20020a17090608da00b00a3fab4df7e3mr10886983eje.0.1709720249690; Wed, 06 Mar 2024 02:17:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IGKcBRSWa5JTYqf3yoJHqSnyoxZGmv6a5BdeaC68TsJFTl5G1mx5+gsUg7qSs+cfGcz+b+r2g== X-Received: by 2002:a17:906:8da:b0:a3f:ab4d:f7e3 with SMTP id o26-20020a17090608da00b00a3fab4df7e3mr10886960eje.0.1709720248935; Wed, 06 Mar 2024 02:17:28 -0800 (PST) Received: from localhost (185.223.159.143.dyn.plus.net. [143.159.223.185]) by smtp.gmail.com with ESMTPSA id qu24-20020a170907111800b00a433e8cfb7esm6975212ejb.64.2024.03.06.02.17.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 02:17:28 -0800 (PST) From: Andrew Burgess To: Tom Tromey , gcc-patches@gcc.gnu.org Cc: gdb-patches@sourceware.org, Tom Tromey Subject: Re: [PATCH] Revert "Pass GUILE down to subdirectories" In-Reply-To: <20240123001928.787780-1-tom@tromey.com> References: <20240123001928.787780-1-tom@tromey.com> Date: Wed, 06 Mar 2024 10:17:27 +0000 Message-ID: <877cifbr60.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Tom Tromey writes: > This reverts commit b7e5a29602143b53267efcd9c8d5ecc78cd5a62f. > > This patch caused problems for some users when building gdb, because > it would cause 'guild' to be invoked with the wrong versin of guile. > On the whole it seems simpler to just back this out. Tom, After once again forgetting to add GUILE=guile2.2 to my GDB build I was thinking about this issue again. Given that GDB has a --with-guile=... configure option, and that our configure scripts try to identify a matching version of guild and a shared library to link GDB against, I wondered why we don't just force the use of a matching version of guile. I guess I'm suggesting that for building GDB's guile components we should respect either the --with-guile=... configure option, or what the configure script auto-detected, and should not be picking up any build time GUILE=... flag -- setting GUILE=... isn't going to change the version of guild used, nor is it going to change the shared library that GDB links against, so just changing the guile version seems like a recipe for incompatibility problems. Below is a patch that forces GDB to compile our guile scripts using a suitable version of guile. This could be applied irrespective of whether you revert b7e5a29602143b53267efcd9c8d5ecc78cd5a62f or not. What do you think? Thanks, Andrew --- commit 6d326010217a2c94ad27d4063f90f689f7c11615 Author: Andrew Burgess Date: Tue Mar 5 12:35:05 2024 +0000 gdb/data-directory: set GUILE for compiling GDB's guile scripts After this commit: commit d006ec41c448d9f4a84df50391e87cbf0aa8c152 Date: Thu Dec 28 14:08:39 2023 -0700 Pass GUILE down to subdirectories I have had issues with GDB's guile support. Commit d006ec41c448 sets the GUILE variable in the top-level Makefile to the default value 'guile'. The problem this causes for me is that 'guile' on my system is 2.0.14. I also have guile2.2 available on my system, and this is version 2.2.6. When GDB configures it selects looks for a suitable guile version to use, and it looks in the order: guile-3.0 guile-2.2 guile-2.0 This means that on my system GDB chooses to use the guile2.2 library to link against, and uses guild2.2 as the compiler to pre-compile GDB's guile scripts. However, guild (and guile2.2) check for the GUILE environment variable, and use the value of this variable as the version of guile interpreter which is used when compiling things. What this means is that after commit d006ec41c448, I am now using the guild2.2 binary (version 2.2.6), but this is then invoking the guile binary (version 2.0.14). The compiled scripts are then loaded by GDB, which is linking against libguile-2.2.so.1, this results in the following error: $ ./gdb/gdb --data-directory ./gdb/data-directory Exception caught while booting Guile. Error in function "load-thunk-from-memory": not an ELF file ./gdb/gdb: warning: Could not complete Guile gdb module initialization from: /tmp/binutils-gdb/build/gdb/data-directory/guile/gdb/boot.scm. Limited Guile support is available. Suggest passing --data-directory=/path/to/gdb/data-directory. GDB Version: 15.1 (gdb) We could fix this by reverting some parts of d006ec41c448, specifically, the part which sets 'guile' as the default value of GUILE in the top-level Makefile. However, I wonder if there's a better solution. GDB already has a configure flag `--with-guile=...` if this isn't provided then GDB looks for a sensible default. I think that when compiling GDB's guile files we should use a consistent set of tools, i.e. a matching version of guild and guile, both of which correspond to the shared library GDB will link against. I propose that this should be done by setting the GUILE environment variable in gdb/data-directory/Makefile.in based on the version of guile that GDB's configure script selected. This does mean that doing: make all-gdb GUILE=.... will no longer work, GDB will ignore this setting, however, if we really want to compile GDB's guile scripts using a different guile version then surely we should also be linking to a corresponding shared library, and (maybe) using the corresponding guild version too? This can be achieved by configuring GDB using `--with-guile=....`. After this commit I no longer have issues compiling GDB with guile support. diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4 index 915082056dd..6e4b96f0acf 100644 --- a/gdb/acinclude.m4 +++ b/gdb/acinclude.m4 @@ -284,7 +284,29 @@ AC_DEFUN([GDB_GUILE_PROGRAM_NAMES], [ fi GUILD="$ac_cv_guild_program_name" + + AC_CACHE_CHECK([for the absolute file name of the 'guile' command], + [ac_cv_guile_program_name], + [ac_cv_guile_program_name="`$1 --variable guile $2`" + + # In Guile up to 2.0.11 included, guile-2.0.pc would not define + # the 'guile' and 'bindir' variables. In that case, try to guess + # what the program name is, at the risk of getting it wrong if + # Guile was configured with '--program-suffix' or similar. + if test "x$ac_cv_guile_program_name" = "x"; then + guile_exec_prefix="`$1 --variable exec_prefix $2`" + ac_cv_guile_program_name="$guile_exec_prefix/bin/guile" + fi + ]) + + if ! "$ac_cv_guile_program_name" --version >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then + AC_MSG_ERROR(['$ac_cv_guile_program_name' appears to be unusable]) + fi + + GUILE="$ac_cv_guile_program_name" + AC_SUBST([GUILD]) + AC_SUBST([GUILE]) ]) dnl GDB_GUILD_TARGET_FLAG diff --git a/gdb/configure b/gdb/configure index d0fd1760b88..6a780810bc8 100755 --- a/gdb/configure +++ b/gdb/configure @@ -721,6 +721,7 @@ HAVE_GUILE_TRUE GUILE_LIBS GUILE_CPPFLAGS GUILD_TARGET_FLAG +GUILE GUILD pkg_config_prog_path HAVE_PYTHON_FALSE @@ -11499,7 +11500,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11502 "configure" +#line 11503 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11605,7 +11606,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11608 "configure" +#line 11609 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -28780,6 +28781,34 @@ $as_echo "$ac_cv_guild_program_name" >&6; } GUILD="$ac_cv_guild_program_name" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the absolute file name of the 'guile' command" >&5 +$as_echo_n "checking for the absolute file name of the 'guile' command... " >&6; } +if ${ac_cv_guile_program_name+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_guile_program_name="`"${with_guile}" --variable guile "${guile_version}"`" + + # In Guile up to 2.0.11 included, guile-2.0.pc would not define + # the 'guile' and 'bindir' variables. In that case, try to guess + # what the program name is, at the risk of getting it wrong if + # Guile was configured with '--program-suffix' or similar. + if test "x$ac_cv_guile_program_name" = "x"; then + guile_exec_prefix="`"${with_guile}" --variable exec_prefix "${guile_version}"`" + ac_cv_guile_program_name="$guile_exec_prefix/bin/guile" + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_guile_program_name" >&5 +$as_echo "$ac_cv_guile_program_name" >&6; } + + if ! "$ac_cv_guile_program_name" --version >&5 2>&5; then + as_fn_error $? "'$ac_cv_guile_program_name' appears to be unusable" "$LINENO" 5 + fi + + GUILE="$ac_cv_guile_program_name" + + + ;; *) @@ -28810,6 +28839,34 @@ $as_echo "$ac_cv_guild_program_name" >&6; } GUILD="$ac_cv_guild_program_name" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the absolute file name of the 'guile' command" >&5 +$as_echo_n "checking for the absolute file name of the 'guile' command... " >&6; } +if ${ac_cv_guile_program_name+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_guile_program_name="`"${pkg_config_prog_path}" --variable guile "${guile_version}"`" + + # In Guile up to 2.0.11 included, guile-2.0.pc would not define + # the 'guile' and 'bindir' variables. In that case, try to guess + # what the program name is, at the risk of getting it wrong if + # Guile was configured with '--program-suffix' or similar. + if test "x$ac_cv_guile_program_name" = "x"; then + guile_exec_prefix="`"${pkg_config_prog_path}" --variable exec_prefix "${guile_version}"`" + ac_cv_guile_program_name="$guile_exec_prefix/bin/guile" + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_guile_program_name" >&5 +$as_echo "$ac_cv_guile_program_name" >&6; } + + if ! "$ac_cv_guile_program_name" --version >&5 2>&5; then + as_fn_error $? "'$ac_cv_guile_program_name' appears to be unusable" "$LINENO" 5 + fi + + GUILE="$ac_cv_guile_program_name" + + + ;; esac diff --git a/gdb/configure.ac b/gdb/configure.ac index aa91bfb3a17..b18187c6d7e 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1104,6 +1104,7 @@ dnl pkg-config --exists $version dnl pkg-config --cflags $version dnl pkg-config --libs $version dnl pkg-config --variable guild $version +dnl pkg-config --variable guile $version dnl The script will be called with $version having each value in dnl $try_guile_versions until --exists indicates success. diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in index 2a40be4ade0..c1aded24ca8 100644 --- a/gdb/data-directory/Makefile.in +++ b/gdb/data-directory/Makefile.in @@ -147,6 +147,7 @@ GUILE_COMPILED_FILES = \ GUILD = @GUILD@ GUILD_TARGET_FLAG = @GUILD_TARGET_FLAG@ +GUILE = @GUILE@ # Flags passed to 'guild compile'. # Note: We can't use -Wunbound-variable because all the variables