From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by sourceware.org (Postfix) with ESMTP id 64D343858D28 for ; Sat, 5 Feb 2022 00:28:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 64D343858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=orcam.me.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=orcam.me.uk Received: by angie.orcam.me.uk (Postfix, from userid 500) id 304B592009C; Sat, 5 Feb 2022 01:28:02 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 294D292009B; Sat, 5 Feb 2022 00:28:02 +0000 (GMT) Date: Sat, 5 Feb 2022 00:28:02 +0000 (GMT) From: "Maciej W. Rozycki" To: Tom Tromey cc: William Tambe via Gdb-patches Subject: Re: how to build gdbserver as a static binary ? In-Reply-To: <87leyqwlfm.fsf@tromey.com> Message-ID: References: <87leyqwlfm.fsf@tromey.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-3489.2 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_INFOUSMEBIZ, KAM_LAZY_DOMAIN_SECURITY, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Sat, 05 Feb 2022 00:28:05 -0000 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