Discussion:
[PATCH] localtime-buffer: Prevent rpl_gmtime and rpl_localtime from calling themselves
Akash Rawal
2017-07-07 05:18:31 UTC
Permalink
Hello everyone,

I found this issue when building for MinGW. rpl_gmtime is
calling itself unconditionally.

Regards,
Akash Rawal
Bruno Haible
2017-07-07 07:50:29 UTC
Permalink
Hi,
Post by Akash Rawal
I found this issue when building for MinGW. rpl_gmtime is
calling itself unconditionally.
localtime-buffer.{o.obj} is expected to be empty on native Windows platforms:

$ i686-w64-mingw32-objdump --disassemble localtime-buffer.obj

localtime-buffer.obj: file format pe-i386

You are having a problem with autoconfiguration.
GETTIMEOFDAY_CLOBBERS_LOCALTIME should be 1 only on Mac OS X.
(See doc/posix-functions/gettimeofday.texi.)
TZSET_CLOBBERS_LOCALTIME should be 1 only on Solaris.
(See doc/posix-functions/tzset.texi.)

What is the environment that you are using?
What are the arguments that you pass to configure?
Whar are the values of CC, CFLAGS, CPPFLAGS, LDFLAGS that you pass to configure?

Bruno
Bruno Haible
2017-07-07 10:41:39 UTC
Permalink
Hi Akash,
I am using Arch linux, cross-compiling with mingw-w64-gcc 7.1.1.
...
Apparently the logic breaks when cross-compiling. I have 1 here.
configure:24258: checking whether gettimeofday clobbers localtime
buffer
configure:24307: result: guessing yes
Indeed; this explains it.

Cross-compilation to native Windows was not really tested so far.
Maybe add more cases to m4/gettimeofday.m4 for 'action when
cross-compiling'?
Yes, this is the required fix. I'll go through all ca. 280 cross-compilation
guesses that we have in m4/* and update them for native Windows...

As a workaround, in the mean time, please set the environment variables
gl_cv_func_gettimeofday_clobber=no
gl_cv_func_tzset_clobber=no
when running configure.

Bruno
Bruno Haible
2017-07-13 19:23:18 UTC
Permalink
Maybe add more cases to m4/gettimeofday.m4 for 'action when
cross-compiling'?
This should be fixed now. Thanks for the report.

Bruno
Tim Rühsen
2017-07-17 07:21:49 UTC
Permalink
Thanks for the fix !

Tested, could revoke my two work-arounds :-)


With Best Regards, Tim
Post by Bruno Haible
Maybe add more cases to m4/gettimeofday.m4 for 'action when
cross-compiling'?
This should be fixed now. Thanks for the report.
Bruno
Loading...