From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 392083858C27 for ; Mon, 14 Dec 2020 18:47:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 392083858C27 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark@simark.ca Received: from [172.16.0.95] (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id A606A1E590; Mon, 14 Dec 2020 13:47:37 -0500 (EST) Subject: Re: [PATCH v2] Enable GDB build with in-tree GMP and MPFR To: Bernd Edlinger , Joel Brobecker , Pedro Alves , Eli Zaretskii , Andrew Burgess , "gdb-patches@sourceware.org" References: <1604817017-25807-1-git-send-email-brobecker@adacore.com> <1605429345-78384-1-git-send-email-brobecker@adacore.com> <1605429345-78384-2-git-send-email-brobecker@adacore.com> <20201116034518.GA609903@adacore.com> <20201118034455.GE617116@adacore.com> <71f5437f-c4f5-b58d-06f7-67a4d0b31007@simark.ca> From: Simon Marchi Message-ID: <214e9564-5dfd-65a2-c2d8-6e8398ebc913@simark.ca> Date: Mon, 14 Dec 2020 13:47:37 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Language: tl Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_MANYTO, NICE_REPLY_A, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Dec 2020 18:47:39 -0000 I'll give a shot at reviewing this, to make it progress. Joel, there's a question for you below. On 2020-12-14 12:40 p.m., Bernd Edlinger wrote: > Well, > > I thought, I should add a few words in the README > about this feature: > > diff --git a/gdb/README b/gdb/README > index e65c5ea..db0a774 100644 > --- a/gdb/README > +++ b/gdb/README > @@ -488,6 +488,9 @@ more obscure GDB `configure' options are not listed here. > Build GDB using the GMP library installed at the directory DIR. > If your host does not have GMP installed, you can get the latest > version at `https://gmplib.org/'. > + You can also build GMP in-tree when you use the script > + ./contrib/download_prerequisites. Note however, that this > + does only work with a separate build directory. > > `--with-mpfr' > Build GDB with GNU MPFR, a library for multiple-precision > @@ -499,6 +502,9 @@ more obscure GDB `configure' options are not listed here. > available, GDB will fall back to using host floating-point > arithmetic. If your host does not have GNU MPFR installed, you > can get the latest version from `https://www.mpfr.org/'. > + You can also build MPFR in-tree when you use the script > + ./contrib/download_prerequisites. Note however, that this > + does only work with a separate build directory. > > `--with-python[=PYTHON]' > Build GDB with Python scripting support. (Done by default if > > > Tested on x86_64-pc-linux-gnu. > Is it OK for trunk? > > > Thanks > Bernd. > There is already --with-libgmp-prefix / --without-libgmp-prefix, provided (I think by): # Verify that we have a usable GMP library. AC_LIB_HAVE_LINKFLAGS([gmp], [], [#include ], [mpz_t n; mpz_init (n);]) So with this patch, we now have: --with-gmp-include=DIR GMP include directory --with-gmp-lib=DIR GMP lib directory --with-gmp=DIR GMP install directory --with-libgmp-prefix[=DIR] search for libgmp in DIR/include and DIR/lib --without-libgmp-prefix don't search for libgmp in includedir and libdir I think that's getting a bit confusing. That's too many ways to set gmp paths, with -with-libgmp-prefix and --with-gmp doing the same thing. If the rest of the binutils/gcc ecosystem already uses --with-gmp, --with-gmp-include and --with-gmp-lib, I think we should align with those. Fortunately, we haven't yet shipped a GDB with --with-libgmp-prefix, so I think it's safe to remove it. It might mean that we have to stop using AC_LIB_HAVE_LINKFLAGS though, or customize it. Joel, do you agree? In this line, in top-level Makefile.def, do you need to also add something about gmp, and why pass flags about mpc_mpfr (I sincerely don't know what it is/does)? host_modules= { module= gdb; extra_configure_flags='@extra_mpfr_configure_flags@ @extra_mpc_mpfr_configure_flags@';}; In the README, you say: You can also build GMP in-tree when you use the script ./contrib/download_prerequisites. Note however, that this does only work with a separate build directory. That leaves me with some questions: - do I need to run this script myself before configure? - if I do, does that mean the build will use the downloaded version, even if there is a working version on my system? It would be good to answer those questions in the README text. An alternative to downloading the pre-requisites would be to check them in the repo. We do it for readline already: there is a copy in the repo, which is used by default, but you can specify --with-system-readline if you want to use the system's readline. We could do the same with gmp and mpfr. The downside is that we deviate a bit from how gcc does, the the upside is that it's simpler, IMO. Note that any change to the files outside GDB will have to be approved by the binutils folks too. And changes to the top-level Makefile will have to be replicated to the gcc repo. Simon