From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91656 invoked by alias); 30 Jan 2020 22:17:39 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 91645 invoked by uid 89); 30 Jan 2020 22:17:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=H*f:sk:49c1cc4, H*i:sk:49c1cc4, H*MI:sk:49c1cc4 X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (209.51.188.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 30 Jan 2020 22:17:37 +0000 Received: from fencepost.gnu.org ([2001:470:142:3::e]:49435) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ixI7z-0001X9-QK; Thu, 30 Jan 2020 17:17:35 -0500 Received: from [50.226.24.42] (port=58938 helo=pdslaptop) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ixI7z-0002Qd-IX; Thu, 30 Jan 2020 17:17:35 -0500 Message-ID: Subject: Re: GDB 8.3.1 gdbserver linker error: needs -lrt From: Paul Smith Reply-To: psmith@gnu.org To: Simon Marchi , gdb@sourceware.org Date: Thu, 30 Jan 2020 22:17:00 -0000 In-Reply-To: <49c1cc4a-fe1b-8e35-b16b-76d9faec2173@simark.ca> References: <06b764efa74573c9422da526f9d92aa2d9440e73.camel@gnu.org> <49c1cc4a-fe1b-8e35-b16b-76d9faec2173@simark.ca> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg00082.txt.bz2 On Thu, 2020-01-30 at 16:35 -0500, Simon Marchi wrote: > GDBSERVER_LIBS is a variable in gdb/gdbserver/Makefile, but I don't > think it's meant to be overriden from the command line. Sure, but even if it's not meant to be overridden it should be possible to do so. make always obeys variable overrides on the command line, and also passes those overrides along to sub-makes; the only way to avoid that is do to odd things with make recursion. > It would probably work to set LIBS while configuring gdbserver: > > ./configure LIBS="-lrt" When you say "configuring gdbserver" I'm not sure what you mean, but definitely doing this in the root of the GDB distribution does not work. The root makefile will have LIBS=-lrt in it, but that variable is not passed on. Further, the link line for gdbserver doesn't include that variable; it's just: gdbserver$(EXEEXT): $(sort $(OBS)) ${CDEPS} $(LIBGNU) $(LIBIBERTY) $(SILENCE) rm -f gdbserver$(EXEEXT) $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \ -o gdbserver$(EXEEXT) $(OBS) $(LIBGNU) $(LIBIBERTY) \ $(GDBSERVER_LIBS) $(XM_CLIBS) None of the "normal" libs variables are listed in this link line. That's why I chose GDBSERVER_LIBS. The link line for libinproctrace.so is even less configurable: $(IPA_LIB): $(sort $(IPA_OBJS)) ${CDEPS} $(SILENCE) rm -f $(IPA_LIB) $(ECHO_CXXLD) $(CC_LD) -shared -fPIC -Wl,--soname=$(IPA_LIB) \ -Wl,--no-undefined $(INTERNAL_CFLAGS) $(INTERNAL_LDFLAGS) \ -o $(IPA_LIB) ${IPA_OBJS} -ldl -pthread > That would work around the problem, but if you want to fix it for > good, for all users in the same situation, then it would probably > require a patch to configure.ac, to add "-lrt" to LIBS when needed. Yes, definitely... that's why I posted the message :). Cheers!