Fwd: tz code 2012-e: Compilation issues on MacOS X 10.8
Hello TZ maintainers Paul Eggert asked asked me to forward the e-Mail below to tz@iana.org. Can you incorporate the suggested change, please ? A feedback is most welcome, thanks. Regards, -- Carlo ---------- Forwarded message ---------- From: Carlo Dapor <catull@gmail.com> Date: 5 August 2012 12:35 Subject: tz code 2012-e: Compilation issues on MacOS X 10.8 To: Paul Eggert <eggert@cs.ucla.edu> Hello Paul I built the latest tz code on MacOS X 10.8. However, in localtime.c two methods are re-defined 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__ */". For completeness, see the two compilation attempts before this change. #1 cc -DTZDIR=\"/usr/local/etc/zoneinfo\" -c -o localtime.o localtime.c localtime.c:1167:1: error: static declaration of 'tzsetwall' follows non-static declaration tzsetwall(void) ^ /usr/include/time.h:150:6: note: previous declaration is here void tzsetwall(void); ^ 1 error generated. gmake: *** [localtime.o] Error 1 #2 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. gmake: *** [localtime.o] Error 1 Regards, -- Carlo
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.
On 2012-08-16 22:27, Guy Harris wrote:
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?
tzcode2012e has #include "time.h" on line 79 of "private.h", which is the first thing included by "localtime.c". -- -=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
On 2012-08-05 19:20, Carlo Dapor wrote:
I built the latest tz code on MacOS X 10.8. However, in localtime.c two methods are re-defined
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__ */".
For completeness, see the two compilation attempts before this change.
#1
cc -DTZDIR=\"/usr/local/etc/zoneinfo\" -c -o localtime.o localtime.c localtime.c:1167:1: error: static declaration of 'tzsetwall' follows non-static declaration tzsetwall(void) ^ /usr/include/time.h:150:6: note: previous declaration is here void tzsetwall(void); ^ 1 error generated. gmake: *** [localtime.o] Error 1
Does adding -DSTD_INSPIRED to your CFLAGS in the Makefile fix this without introducing other problems?
#2
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. gmake: *** [localtime.o] Error 1
That's strange because I see no sign of tzset being declared static in tzcode. -- -=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
participants (3)
-
Carlo Dapor -
Guy Harris -
Ian Abbott