Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Statically linking with libgmp and libmpfr
@ 2025-05-16  8:24 Vahedi, Shahab via Gdb
  2025-05-16  8:55 ` Vahedi, Shahab via Gdb
  0 siblings, 1 reply; 4+ messages in thread
From: Vahedi, Shahab via Gdb @ 2025-05-16  8:24 UTC (permalink / raw)
  To: gdb; +Cc: Vahedi, Shahab

Up to and including GDB 13.2, it was possible to statically link GDB with
GMP and MPFR libraries. It was as simple as:

$ ./configure ... --with-libgmp-type=static --with-libmpfr-type=static

However, that all changed after this commit [1]. Those parameters are
ignored after this patch. I've tried the following approaches to no
avail (See [2] why they don't work):


$ ./configure GMPLIBS="/usr/lib/libmgmp.a /usr/lib/libmpfr.a"
$ ./configure --with-gmp-lib=/usr/lib/libgmp.a --with-mpfr-lib=...
$ ./configure --with-gmp-lib=-l:libgmp.a --with-mpfr-lib=-l:libmpfr.a


Is anyone aware of other ways to do so? 


Cheers,
Shahab


[1] Use toplevel configure for GMP and MPFR for gdb
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=99118062785


[2] reasons that the illustrated alternatives don't work:

- configure GMPLIBS=...: the GMPLIBS is ignored and not transferred from
                         the top-level configure to gdb/configure

- --with-gmp-lib=/usr/lib/libgmp.a: the value is supposed to be a dir

- --with-gmp-lib=-l:libgmp.a: it gets prefixed with "-L" in configure
                              (-L-l:libgmpa.a)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Statically linking with libgmp and libmpfr
  2025-05-16  8:24 Statically linking with libgmp and libmpfr Vahedi, Shahab via Gdb
@ 2025-05-16  8:55 ` Vahedi, Shahab via Gdb
  2025-05-16  9:42   ` Andrew Pinski via Gdb
  0 siblings, 1 reply; 4+ messages in thread
From: Vahedi, Shahab via Gdb @ 2025-05-16  8:55 UTC (permalink / raw)
  To: gdb; +Cc: Vahedi, Shahab

I've managed to _work around_ this by populating a "static only" lib dir
and pointing the "configure" to it:

$ mkdir -p /only/static/libs
$ cp /usr/lib/libgmp.a  /only/static/libs
$ cp /usr/lib/libmpfr.a /only/static/libs

$ tree /only/static/libs
  /only/static/libs
  |-- libgmp.a
  `-- libmpfr.a


$ configure ...                              \
            --with-gmp-lib=/only/static/libs \
            --with-mpfr-lib=/only/static/libs
$ make

$ libtree -vv gdb/gdb
  [ no signs of gmp or mpfr ]


I still am interested in an out-of-the-box approach, if any, like GDB <= 13.2.


Cheers,
Shahab

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Statically linking with libgmp and libmpfr
  2025-05-16  8:55 ` Vahedi, Shahab via Gdb
@ 2025-05-16  9:42   ` Andrew Pinski via Gdb
  2025-05-16 12:49     ` Vahedi, Shahab via Gdb
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Pinski via Gdb @ 2025-05-16  9:42 UTC (permalink / raw)
  To: Vahedi, Shahab; +Cc: gdb

On Fri, May 16, 2025 at 1:57 AM Vahedi, Shahab via Gdb
<gdb@sourceware.org> wrote:
>
> I've managed to _work around_ this by populating a "static only" lib dir
> and pointing the "configure" to it:
>
> $ mkdir -p /only/static/libs
> $ cp /usr/lib/libgmp.a  /only/static/libs
> $ cp /usr/lib/libmpfr.a /only/static/libs
>
> $ tree /only/static/libs
>   /only/static/libs
>   |-- libgmp.a
>   `-- libmpfr.a
>
>
> $ configure ...                              \
>             --with-gmp-lib=/only/static/libs \
>             --with-mpfr-lib=/only/static/libs
> $ make
>
> $ libtree -vv gdb/gdb
>   [ no signs of gmp or mpfr ]
>
>
> I still am interested in an out-of-the-box approach, if any, like GDB <= 13.2.

The out of the box approach is to put the GMP/MPFR sources in the top
level directory and that will build gmp/mpfr (static only) and link
against those .
So don't build GMP/MPFR separately when building gdb.

Thanks,
Andrew

>
>
> Cheers,
> Shahab

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Statically linking with libgmp and libmpfr
  2025-05-16  9:42   ` Andrew Pinski via Gdb
@ 2025-05-16 12:49     ` Vahedi, Shahab via Gdb
  0 siblings, 0 replies; 4+ messages in thread
From: Vahedi, Shahab via Gdb @ 2025-05-16 12:49 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gdb, Vahedi, Shahab

Hi Andrew,

On 5/16/25 11:42 AM, Andrew Pinski wrote:

> On Fri, May 16, 2025 at 1:57 AM Vahedi, Shahab via Gdb
> <gdb@sourceware.org> wrote:
>>
>>
>> I still am interested in an out-of-the-box approach, if any, like GDB <= 13.2.
> 
> The out of the box approach is to put the GMP/MPFR sources in the top
> level directory and that will build gmp/mpfr (static only) and link
> against those .

Like how GCC does it too. It basically works, because those libs are built
with:

  --disable-shared
  --enable-static

Same logic applies as the work-around I mentioned earlier, because there's
no *.so files to pick first, the build falls back to the static libraries.

Before, it was possible to instruct the build process to pick the static
version of these libraries wherever it is hinted (system-level or
--with-{gmp,mpfr}-lib).


Cheers,
Shahab




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-05-16 12:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-16  8:24 Statically linking with libgmp and libmpfr Vahedi, Shahab via Gdb
2025-05-16  8:55 ` Vahedi, Shahab via Gdb
2025-05-16  9:42   ` Andrew Pinski via Gdb
2025-05-16 12:49     ` Vahedi, Shahab via Gdb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox