From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64865 invoked by alias); 30 Jan 2020 21:23:27 -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 64857 invoked by uid 89); 30 Jan 2020 21:23:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy= 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 21:23:26 +0000 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48315) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ixHHY-0001ya-7a for gdb@sourceware.org; Thu, 30 Jan 2020 16:23:24 -0500 Received: from [50.226.24.42] (port=58582 helo=pdslaptop) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ixHHX-0000SX-OT for gdb@sourceware.org; Thu, 30 Jan 2020 16:23:24 -0500 Message-ID: <06b764efa74573c9422da526f9d92aa2d9440e73.camel@gnu.org> Subject: GDB 8.3.1 gdbserver linker error: needs -lrt From: Paul Smith Reply-To: psmith@gnu.org To: gdb@sourceware.org Date: Thu, 30 Jan 2020 21:23:00 -0000 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/msg00080.txt.bz2 Hi all; I was trying to compile the latest GDB for my system and the link of gdbserver failed: .../lib64/libstdc++.a(chrono.o):function std::chrono::_V2::system_clock::now(): error: undefined reference to 'clock_gettime' .../lib64/libstdc++.a(chrono.o):function std::chrono::_V2::steady_clock::now(): error: undefined reference to 'clock_gettime' As you can see I compile with static libstdc++. Also, I'm building against a pretty old version of GNU/Linux with an older GNU libc (CentOS 6.5 or so). The problem is that on systems this old you need to add -lrt to the link line in order to get clock_gettime(), and the configure script doesn't look for this. This causes both gdbserver and libinproctrace.so to fail to link, unless I hack the makefiles. Gdb itself links properly because I'm linking with lzma and those libs happen to include -lrt: LIBLZMA = .../lib/liblzma.a -lrt Oddly enough, adding GDBSERVER_LIBS="-ldl -lrt" to the top GDB make command doesn't work (even for gdbserver: libinproctrace.so has no equivalent customizable library). I didn't look through the build system to figure out how my command line overrides are being lost but that's also something that should be fixed...