This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Cannot use static linking with librt.a?
- From: Andrew Haley <aph at redhat dot com>
- To: Hei Chan <structurechart at yahoo dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Tue, 04 Sep 2012 09:27:39 +0100
- Subject: Re: Cannot use static linking with librt.a?
- References: <1346711317.64064.YahooMailNeo@web165005.mail.bf1.yahoo.com>
On 09/03/2012 11:28 PM, Hei Chan wrote:
> I have searched online for awhile and I still can't find a good explanation why I can't use static linking with librt.a.
>
> /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/librt.a(clock_gettime.o): In function `clock_gettime':
> (.text+0x197): undefined reference to `_dl_cpuclock_offset'
> collect2: ld returned 1 exit status
>
>
> It seems like librt.a is a static library but it doesn't use static linking for its actual implementation _dl_cpuclock_offset?
That's right. It seems to me like your `_dl_cpuclock_offset' actually
requires the dynamic linker. There's only one solution: download the
source of your librt and have a look.
Andrew.