[uClibc] Problem compiling VDR (is timegm implemented?)

Davide davide125 at tiscali.it
Mon May 3 12:55:56 UTC 2004


Hello,
I'm trying to compile VDR 1.3.6 
(ftp://ftp.cadsoft.de/vdr/Developer/vdr-1.3.6.tar.bz2) with uClibc, in an 
uwoody development system. When the make process reaches util.c in libsi, it 
outputs:
make -C ./libsi all
make[1]: Entering directory `/opt/mediabox/sources/vdr/vdr-1.3.6/libsi'
g++ -O2 -g -Wall -Woverloaded-virtual -c   util.c
util.c: In function `time_t SI::DVBTime::getTime(unsigned char, unsigned char,
   unsigned char, unsigned char, unsigned char)':
util.c:208: error: `timegm' undeclared (first use this function)
util.c:208: error: (Each undeclared identifier is reported only once for each
   function it appears in.)
make[1]: *** [util.o] Error 1
make[1]: Leaving directory `/opt/mediabox/sources/vdr/vdr-1.3.6/libsi'
make: *** [libsi/libsi.a] Error 2

The function which causes the error is:
time_t DVBTime::getTime(unsigned char date_hi, unsigned char date_lo, unsigned 
char time_hour, unsigned char time_minute, unsigned char time_second) {
   u_int16_t mjd = date_hi << 8 | date_lo;
   struct tm t;

   t.tm_sec = bcdToDec(time_second);
   t.tm_min = bcdToDec(time_minute);
   t.tm_hour = bcdToDec(time_hour);

   int k;
   t.tm_year = (int) ((mjd - 15078.2) / 365.25);
   t.tm_mon = (int) ((mjd - 14956.1 - (int)(t.tm_year * 365.25)) / 30.6001);
   t.tm_mday = (int) (mjd - 14956 - (int)(t.tm_year * 365.25) - (int)
(t.tm_mon*30.6001));
   k = (t.tm_mon == 14 || t.tm_mon == 15) ? 1 : 0;
   t.tm_year = t.tm_year + k;
   t.tm_mon = t.tm_mon - 1 - k * 12;
   t.tm_mon--;

   t.tm_isdst = -1;
   t.tm_gmtoff = 0;

   return timegm(&t);
}

If I grep for timegm in /usr/include, I find it'n in time.h but it's ifdefed 
out:

#if 0
/* Like `mktime', but for TP represents Universal Time, not local time.  */
extern time_t timegm (struct tm *__tp) __THROW;
#endif

Is this function actually implemented? If I ifdef it in, the function 
compiles, but a few lines after I get:

./libsi/libsi.a(util.o)(.text+0x891): In function 
`SI::DVBTime::getTime(unsigned char, unsigned char, unsigned char, unsigned 
char, unsigned char)':
/opt/mediabox/sources/vdr/vdr-1.3.6/libsi/util.c:208: undefined reference to 
`timegm'
collect2: ld returned 1 exit status
make: *** [vdr] Error 1

Do you have any suggestions on how to make that code compile?

Thank you,
Davide
davide125 at tiscali.it



More information about the uClibc mailing list