[tz] Fwd: tz code 2012-e: Compilation issues on MacOS X 10.8
Guy Harris
guy at alum.mit.edu
Thu Aug 16 21:27:54 UTC 2012
On Aug 5, 2012, at 11:20 AM, Carlo Dapor wrote:
> I built the latest tz code on MacOS X 10.8.
> However, in localtime.c two methods are re-defined
Well, yeah - the time zone code in Mac OS X 10.x, for all values of x, is, err, umm, the Olson time zone code, so, not surprisingly, the tz code redefines stuff in the tz code....
> void tzsetwall (void) - line 1167
> void tzset (void) - line 1190
>
> Not sure this is the correct way, I placed an "#if !defined
> (__APPLE__) && !defined (__MACH__)" on lines 1167 and 1190.
> And on lines 1188 and 1233 an "#endif /* ! __APPLE__ && ! __MACH__ */".
It's not.
For one thing, the problem isn't that it's *redefining* routines - if it weren't redefining anything, there'd be no point in compiling tzcode! You're already redefining, for example, localtime().
The problem is that, by default, tzcode defines tzsetwall() as static, but some OSes, including, but not limited to, all versions of OS X (not just 10.8), supply it as a system library routine, and thus declare it in /usr/include/time.h, causing, at least in your case, a collision between a non-static declaration and a static definition.
I'm not sure why /usr/include/time.h is getting included; does the compiler indicate from what line /usr/include/time.h is being included? If so, is that the result of changes you've made to localtime.c? If so, you might want to undo those changes.
As for
> cc -DTZDIR=\"/usr/local/etc/zoneinfo\" -c -o localtime.o localtime.c
> localtime.c:1190:1: error: static declaration of 'tzset' follows
> non-static declaration
> tzset(void)
> ^
> /usr/include/time.h:136:6: note: previous declaration is here
> void tzset(void);
> ^
> 1 error generated.
*that* is either the result of
1) building a modified version of tzcode2012e's localtime.c
or
2) building with a buggy compiler
as localtime.c in tzcode2012e does *NOT* define tzset() as static.
More information about the tz
mailing list