ftime doesn't fetch from libcompat.a using -lcompat

Dmitry Pryanishnikov dmitry at atlantis.dp.ua
Thu Dec 18 01:54:43 PST 2003


Hello!

 I've found a very unusual bug. I've tried to build a legacy program which
uses ftime(), but I've got unresolved reference to `ftime'. I've created a
very simple program that demonstrates a bug:

#include <sys/types.h>
#include <sys/timeb.h>
main()
{
 struct timeb tb;
 return ftime(&tb);
}

dmitry at test$ cc -lcompat a.c
/tmp/cck3ZpNz.o: In function `main':
/tmp/cck3ZpNz.o(.text+0xe): undefined reference to `ftime'
dmitry at test$ cc -lcompat -static a.c
/tmp/ccbGUAGZ.o: In function `main':
/tmp/ccbGUAGZ.o(.text+0xe): undefined reference to `ftime'

The most interesting thing here is that I can extract module ftime.o from
my /usr/lib/libcompat.a and link against it:

dmitry at test$ ar p /usr/lib/libcompat.a ftime.o >ftime.o
dmitry at test$ cc a.c ftime.o
dmitry at test$

It seems that symbol `ftime' gets somehow "undeclared" in library symbol
table. Could this error be fixed? It's present in 4.8-RELEASE and 4.9-RELEASE.
I haven't found anything in GNATS about this issue.

Sincerely, Dmitry
-- 
Atlantis ISP, System Administrator
e-mail:  dmitry at atlantis.dp.ua
nic-hdl: LYNX-RIPE


More information about the freebsd-stable mailing list