Re: [PATCH v2] Enable GDB build with in-tree GMP and MPFR

Simon Marchi
2020-12-14T22:17:36Z

On 2020-12-14 4:35 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simark@simark.ca> writes:
>
> Simon> So with this patch, we now have:
>
> Simon> --with-gmp-include=DIR GMP include directory
> Simon> --with-gmp-lib=DIR GMP lib directory
> Simon> --with-gmp=DIR GMP install directory
> Simon> --with-libgmp-prefix[=DIR] search for libgmp in DIR/include and DIR/lib
> Simon> --without-libgmp-prefix don't search for libgmp in includedir and libdir
>
> Simon> I think that's getting a bit confusing. That's too many ways to set gmp
> Simon> paths, with -with-libgmp-prefix and --with-gmp doing the same thing.
>
> FWIW we have the same situation with MPFR.

:(
> Simon> It might mean that we have to stop using AC_LIB_HAVE_LINKFLAGS
> Simon> though, or customize it.
>
> Yes. Perhaps alternatively we could promote its use to the top level.
> It's maybe a pain to do that.

Perhaps, but --with-{gmp,mpfr} would need to be kept as backwards
compatibility. I think it would be hard to convince the gcc people of
the benefits of such a change.

> Simon> An alternative to downloading the pre-requisites would be to check them
> Simon> in the repo. We do it for readline already: there is a copy in the
> Simon> repo, which is used by default, but you can specify
> Simon> --with-system-readline if you want to use the system's readline. We
> Simon> could do the same with gmp and mpfr. The downside is that we deviate a
> Simon> bit from how gcc does, the the upside is that it's simpler, IMO.
>
> For me the main difference here is that, historically, we've had to
> patch readline. In cases where GDB has never needed to patch a
> dependency (libiconv comes to mind), we've haven't bothered.

Ok, when you put it like that then it doesn't make as much sense to
check the code in the repo.

Thinking about it a bit more, I don't see why gmp and mpfr get this
treatment, what is it that makes them different from other dependencies?
If you want to build GDB with XML support, you download and build expat,
or install it using your package manager. Why can't you do the same
with mpfr/gmp? The only reason for us I can see is "because gcc does
it" and we share the build system with gcc. But otherwise, I'd just
tell people to build/install mpfr and gmp themselves.

Simon