public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* how to build gdbserver as a static binary ?
@ 2022-02-03 21:15 William Tambe
  2022-02-04 18:12 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: William Tambe @ 2022-02-03 21:15 UTC (permalink / raw)
  To: gdb-patches

Is it possible to build gdbserver as a static binary ?

Using --enable-static --with-static-standard-libraries has not helped.

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

* Re: how to build gdbserver as a static binary ?
  2022-02-03 21:15 how to build gdbserver as a static binary ? William Tambe
@ 2022-02-04 18:12 ` Tom Tromey
  2022-02-05  0:28   ` Maciej W. Rozycki
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2022-02-04 18:12 UTC (permalink / raw)
  To: William Tambe via Gdb-patches

>>>>> "William" == William Tambe via Gdb-patches <gdb-patches@sourceware.org> writes:

William> Is it possible to build gdbserver as a static binary ?
William> Using --enable-static --with-static-standard-libraries has not helped.

I don't know the answer.  I guess you could check to see if
--with-static-standard-libraries even affects gdbserver.

Also, I wonder if it's even possible.  Isn't there some problem with
statically linked programs using dlopen?  (I only vaguely recall
something like this.)  Anyway, this matters because gdbserver has to
dlopen libthread_db.

Tom

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

* Re: how to build gdbserver as a static binary ?
  2022-02-04 18:12 ` Tom Tromey
@ 2022-02-05  0:28   ` Maciej W. Rozycki
  0 siblings, 0 replies; 3+ messages in thread
From: Maciej W. Rozycki @ 2022-02-05  0:28 UTC (permalink / raw)
  To: Tom Tromey; +Cc: William Tambe via Gdb-patches

On Fri, 4 Feb 2022, Tom Tromey wrote:

> William> Is it possible to build gdbserver as a static binary ?
> William> Using --enable-static --with-static-standard-libraries has not helped.
> 
> I don't know the answer.  I guess you could check to see if
> --with-static-standard-libraries even affects gdbserver.

$ /path/to/configure --disable-bfd --disable-binutils --disable-gas \
	--disable-gdb --disable-gold --disable-gprof --disable-ld \
	--disable-libctf --disable-libdecnumber --disable-opcodes \
	--disable-readline --disable-sim LDFLAGS=-static
$ make

or suchlike.

 ISTM `--with-static-standard-libraries' does affect `gdbserver', but that 
option only causes static libgcc and libstdc++ to be pulled anyway rather 
than building a proper static executable.

> Also, I wonder if it's even possible.  Isn't there some problem with
> statically linked programs using dlopen?  (I only vaguely recall
> something like this.)  Anyway, this matters because gdbserver has to
> dlopen libthread_db.

 It shouldn't be an issue with glibc on Linux systems nowadays, though 
when running such a `gdbserver' executable you may have to make sure the 
release number of shared libthread_db used matches the release number of 
glibc `gdbserver' has been statically linked with.

 I can't speak of other hosts.

  Maciej

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

end of thread, other threads:[~2022-02-05  0:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 21:15 how to build gdbserver as a static binary ? William Tambe
2022-02-04 18:12 ` Tom Tromey
2022-02-05  0:28   ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).