public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@orcam.me.uk>
To: Tom Tromey <tom@tromey.com>
Cc: William Tambe via Gdb-patches <gdb-patches@sourceware.org>
Subject: Re: how to build gdbserver as a static binary ?
Date: Sat, 5 Feb 2022 00:28:02 +0000 (GMT)	[thread overview]
Message-ID: <alpine.DEB.2.21.2202050005370.34636@angie.orcam.me.uk> (raw)
In-Reply-To: <87leyqwlfm.fsf@tromey.com>

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

      reply	other threads:[~2022-02-05  0:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-03 21:15 William Tambe
2022-02-04 18:12 ` Tom Tromey
2022-02-05  0:28   ` Maciej W. Rozycki [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.21.2202050005370.34636@angie.orcam.me.uk \
    --to=macro@orcam.me.uk \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).