bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnulib] Re: no rpl_mktime in mktime.c


From: James Gallagher
Subject: Re: [bug-gnulib] Re: no rpl_mktime in mktime.c
Date: Mon, 11 Jul 2005 17:59:16 -0600

I'm dropping in in the middle of this thread, but I may have some useful information. Patrice Dumas was adding gnulib functions to libdap, which is part of my project. We found that when building on Red Hat Enterprise Linux 3 (Workstation) running on a dual processor x86_64 and using gcc 3.2.3, the compilation would fail when the gnulib version of mktime was used. The compilation failure happened because config.h, which is included before all other headers in libdap, contained the line "#define mktime rpl_mktime." This breaks ctime which is included from /usr/include/c++/3.2.3 (which looks just like the version from 3.3 you show below).

One way to get the compilation to succeed was to remove the "#defined mktime rpl_mktime" from config.h.

One suggestion passed on to me by Patrice was to write a header like:

#include <time.h>

#ifdef HAVE_BROKEN_MKTIME
#define mktime rpl_mktime
#endif

and include that in just the source files that use mktime. I found that to get this header to compile I had to add a declaration for rpl_mktime to the header. However, although this did solve the compilation problem (the #define was no longer in config.h since I modified the gl macro to remove it and define the HAVE_BROKEN_MKTIME symbol), there was a link-time failure to find the symbol mktime.

In the end I decided to not use mktime for time being, but if it would help I'll add it back in so I can send along the exact error message (which was something along the lines of 'mktime undefined').

Thanks for making gnulib available!

James

On Jul 11, 2005, at 5:05 PM, Paul Eggert wrote:

Bruno Haible <address@hidden> writes:

- Which header files are included by the program, in which order?

That I don't know, but it's pretty easy to see how the problem
would arise by looking at the header (see the pattern below).

- Which C++ header undefines mktime?

On my Debian GNU/Linux 3.1 r0a host, it's /usr/include/c++/3.3/ctime.
Its contents look like this:

   #ifndef _CPP_CTIME
   #define _CPP_CTIME 1

   #pragma GCC system_header
   #include <cstddef>
   #include <time.h>

// Get rid of those macros defined in <time.h> in lieu of real functions.
   #undef clock
   #undef difftime
   #undef mktime
   ...

   namespace std
   {
     using ::clock_t;
     using ::time_t;
     using ::tm;

     using ::clock;
     using ::difftime;
     using ::mktime;
     ...
   }

   #endif


_______________________________________________
bug-gnulib mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/bug-gnulib

--
James Gallagher                jgallagher at opendap.org
OPeNDAP, Inc                   406.723.8663





reply via email to

[Prev in Thread] Current Thread [Next in Thread]