Subject: Re: bug#9960: Compiling Emacs trunk with MSVC

From: Tim Crews <[email-masked]>
Date: Wed, 30 Nov 2011 12:42:08 -0700

On 11/30/2011 12:17 PM, Eli Zaretskii wrote:
>> Date: Wed, 30 Nov 2011 11:22:05 -0700
>> From: Tim Crews<[email-masked]>
>> Cc: [email-masked]
>>
>>> If you tried a 64-bit build, then it is not yet supported on Windows.
>>> Try the 32-bit build, it should work.
>>
>> I was doing a 32-bit build.  There are still a few minor changes from
>> Fabrice Popineau that haven't made it into bzr yet.
>> (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9960#224)   With those
>> changes, the build succeeds.
>
> Which changes, specifically, are needed?  I know only about one issue:
> the one with _tzname.  The rest, to the best of my knowledge, are for
> a 64-bit build.  If I'm wrong, I'd like to know which other changes
> are still needed for the 32-bit build with MSVC.
>
>> I built from the latest bzr source and can confirm that the linum-mode
>> crash no longer occurs on my end.
>
> Thanks.

There are only two changes listed in but 9960 message 224, both related 
to _tzname.  (The patch is repeated for reference at the bottom of this 
message.)  The changes are to lib/strftime.c and src/s/ms-w32.h.

If I back out Fabrice's proposed change to lib/strftime.c, the build 
succeeds through the compilation phase but fails to link because of 
unresolved external _tzname.

If I back out Fabrice's proposed change to src/s/ms-w32.h, compilation 
of ntlib.c fails with "time.h(270) : error C2090: function returns array".

So it appears that both changes are needed for the MSVC 32-bit build.

Tim Crews

=== modified file 'lib/strftime.c'
--- lib/strftime.c      2011-03-31 04:24:03 +0000
+++ lib/strftime.c      2011-11-28 15:38:55 +0000
@@ -36,9 +36,13 @@
  #include <ctype.h>
  #include <time.h>

+#ifdef _MSC_VER
+#define tzname _tzname
+#else
  #if HAVE_TZNAME && !HAVE_DECL_TZNAME
  extern char *tzname[];
  #endif
+#endif

  /* Do multibyte processing if multibytes are supported, unless
     multibyte sequences are safe in formats.  Multibyte sequences are
=== modified file 'src/s/ms-w32.h'
--- src/s/ms-w32.h      2011-11-27 18:52:53 +0000
+++ src/s/ms-w32.h      2011-11-28 15:33:33 +0000
@@ -286,7 +286,9 @@
  #define stricmp   _stricmp
  #define tzset     _tzset

+#ifndef _MSC_VER
  #define tzname    _tzname
+#endif
  #if !defined (_MSC_VER) || (_MSC_VER < 1400)
  #undef  utime
  #define utime    _utime