public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Paul Smith <psmith@gnu.org>
To: gdb@sourceware.org
Subject: GDB 8.3.1 gdbserver linker error: needs -lrt
Date: Thu, 30 Jan 2020 21:23:00 -0000	[thread overview]
Message-ID: <06b764efa74573c9422da526f9d92aa2d9440e73.camel@gnu.org> (raw)

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...

             reply	other threads:[~2020-01-30 21:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-30 21:23 Paul Smith [this message]
2020-01-30 21:35 ` Simon Marchi
2020-01-30 22:17   ` Paul Smith
2020-01-30 22:50     ` Simon Marchi
2020-01-31  7:44       ` Eli Zaretskii
2020-01-31 16:48         ` Paul Smith
2020-01-31 17:17           ` Eli Zaretskii
2020-01-31 17:23             ` Paul Smith
2020-02-01  3:05               ` Simon Marchi

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=06b764efa74573c9422da526f9d92aa2d9440e73.camel@gnu.org \
    --to=psmith@gnu.org \
    --cc=gdb@sourceware.org \
    /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).