Re: GDB 8.3.1 gdbserver linker error: needs -lrt

Paul Smith <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
On Fri, 2020-01-31 at 09:44 +0200, Eli Zaretskii wrote:
> > From: Simon Marchi <[email protected]>
> > Date: Thu, 30 Jan 2020 17:49:59 -0500
> > 
> > > > 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 :).
> 
> Any reason why we don't use pkg-config for finding out these
> dependencies?

I'm not sure how pkg-config helps in this situation... isn't pkg-config 
used for obtaining correct options for using another package?

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.

Maybe you mean, a pkg-config for libstdc++ static linking?  I'm not
sure GCC installs such a thing.

I'm pretty sure there are a LOT of configure.ac files out there that
search for -lrt that could be used as.  It's just that in this case we
didn't realize we needed it, because (a) it's needed by libstdc++.a but
probably not if you dynamically link libstdc++ (becase the .so probably
links librt.so) and (b) it's only needed with older GNU libc; I think
newer versions of GNU libc have moved clock_gettime etc. into the
normal library and -lrt is obsolete.
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.