Re: GDB 8.3.1 gdbserver linker error: needs -lrt

Simon Marchi <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
On 2020-01-31 12:23 p.m., Paul Smith wrote:
> On Fri, 2020-01-31 at 19:17 +0200, Eli Zaretskii wrote:
>>> In this case, we need a new library to link gdbserver directly, not
>>> because of some other package that gdbserver depends on, so we
>>> don't have a package that might contain a pkg-config we could use.
>>
>> Sorry, I thought liblzma needed -lrt.  Apologies if I was confused.
> 
> Oh I see the confusion.
> 
> No, you're absolutely right, liblzma DOES need -lrt.  And indeed, we DO
> use pkg-config to get info about liblzma.
> 
> And that's why linking of gdb itself succeeds: it links lzma with its
> pkg-config options and that causes -lrt to be linked, as a side-effect.
> 
> However, I'm whinging about gdbserver (and libinproctrace.so), and
> liblzma is not not linked into those, and so neither is -lrt.

I have tried to reproduce the build failure using a Docker container of
Centos 6.10.  I used the gcc 8 toolchain from softwarecollections.org,
and didn't see the undefined reference to clock_gettime.  This is despite
the system running glibc 2.12, and the clock_gettime man page saying that
-lrt is needed to use clock_gettime for glibc < 2.17.

Anyway, I suppose adding this to gdbserver's configure.ac would help, could
you try?

  AC_SEARCH_LIBS ([clock_gettime], [rt])

Simon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.