Time zone confusion and implementation hints

lennox at cs.columbia.edu lennox at cs.columbia.edu
Tue Jul 6 18:57:20 UTC 2010

Some testing for me seems to reveal that if you:

* install MSYS as well as MINGW, and add both the MINGW and MSYS bin
  directories to your Windows PATH

* use the MSYS make

* set CFLAGS in the tzcode Makefile to

* set cc in the tzcode Makefile to gcc

* write a wrapper function for link() mapping it to the Windows NT
  CreateHardLink function:

#include <errno.h>
#define _WIN32_WINNT 0x0500
#include <windows.h>

int link(const char* path1, const char* path2)
  BOOL createdLink = CreateHardLinkA(path2, path1, NULL);
  if (!createdLink) {
     errno = EACCES; /* ?? Should map GetLastError to errno */
     return -1;
  return 0;

* include the source file containing link() in the Makefile's
  TZCSRCS variable, and its corresponding object file in TZCOBJS

* and run on a file system that supports hard links, e.g. NTFS

Then make zic; make zones works.

You'll probably also want to set the TZDIR variable in the makefile to
something more Windows-sensible than /usr/local/etc/zoneinfo.

If you need to support older filesystems, e.g. FAT32, you could alternately
map link() to CopyFile instead.

Jonathan Lennox
lennox at cs.columbia.edu

On Tuesday, July 6 2010, "Yves Goergen" wrote to "tz at lecserver.nci.nih.gov" saying:

> On 06.07.2010 18:30 CE(S)T, Alan Barrett wrote:
> > I thought you were trying to build zic?  tzselect is something different.
> > (Try "make zic" instead of just "make".)
> That leads to:
> > C:\Programme\MinGW\tz>mingw32-make zic
> > makefile:306: warning: overriding commands for target `install'
> > makefile:287: warning: ignoring old commands for target `install'
> > cc -DTZDIR=\"/usr/local/etc/zoneinfo\"    -c -o zic.o zic.c
> > process_begin: CreateProcess(NULL, cc -DTZDIR=\"/usr/local/etc/zoneinfo\" -c -o
> > zic.o zic.c, ...) failed.
> > make (e=2): Das System kann die angegebene Datei nicht finden.
> > mingw32-make: *** [zic.o] Error 2
> Seems tz resists building on Windows? Has nobody ever tried yet?
> Think I'll retry with Visual Studio and modify the source code to define
> some macros to make it more friendly.
> -- 
> Yves Goergen "LonelyPixel" <nospam.list at unclassified.de>
> Visit my web laboratory at http://beta.unclassified.de

More information about the tz mailing list