Skip Menu |

This queue is for tickets about the Time-y2038 CPAN distribution.

Report information
The Basics
Id: 40779
Status: resolved
Priority: 0/
Queue: Time-y2038

People
Owner: Nobody in particular
Requestors: cosimo [...] cpan.org
Cc: kwilliams [...] cpan.org
AdminCc:

Bug Information
Severity: Important
Broken in: 20081106
Fixed in: (no value)



CC: kwilliams [...] cpan.org
Subject: Build failure: undefined SYSTEM_LOCALTIME_MIN under Win32/MSVC
Build of latest Time::y2038 CPAN fails for me under Windows Vista and MSVC 2008 Express. I managed to fix the issues, but I'm not sure if the applied patches are right to the point. I'll describe errors and fixes tried. 1) perl Build.PL fails with the following error message: Generating script 'C:\Users\Cosimo\AppData\Local\Temp\compilet.ccs' cl -nologo -c @"C:\Users\Cosimo\AppData\Local\Temp\compilet.ccs" - Fo"C:\Users\Cosimo\AppData\Local\Temp\compilet.obj" "C:\Users\Cosimo \AppData\Local\Temp\compilet.c" compilet.c Generating script 'C:\Users\Cosimo\AppData\Local\Temp\compilet.lds' link @"C:\Users\Cosimo\AppData\Local\Temp\compilet.lds" -out:"C: \Users\Cosimo\AppData\Local\Temp\compilet.dll" Creating library C:\Users\Cosimo\AppData\Local\Temp\compilet.lib and object C:\Users\Cosimo\AppData\Local\Temp\compilet.exp mt -nologo -manifest "C:\Users\Cosimo\AppData\Local\Temp \compilet.dll.manifest" -outputresource:"C:\Users\Cosimo\AppData\Local \Temp\compilet.dll";2 Checking whether your kit is complete... Looks good Checking prerequisites... Looks good Building a program to test the range of your system time functions... Generating script 'check_max.ccs' cl -nologo -c @"check_max.ccs" -Fo"check_max.obj" "check_max.c" check_max.c link -o check_max.exe check_max.obj Microsoft (R) Incremental Linker Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. LINK : warning LNK4044: unrecognized option '/o'; ignored check_max.exe : fatal error LNK1107: invalid or corrupt file: cannot read at 0x248 error building check_max.exe from check_max.obj at c:/dev/perl510/ lib/ExtUtils/CBuilder/Base.pm line 213. The problem is that MSVC wants `link /OUT:file.exe file.c' instead of `link -o file.exe file.c' I tracked this issue down to ExtUtils::CBuilder. Adding the following overridden method in ExtUtils::CBuilder::Platform::Windows seems to do the trick. # Special case for MSVC linker sub arg_exec_file { my ($self, $file) = @_; my $arg_exec_file; # MSVC linker wants /OUT:file.exe if ($self->_compiler_type eq 'MSVC') { $arg_exec_file = "/OUT:$file"; } # Normal behavior else { $arg_exec_file = $self->SUPER::arg_exec_file($file); } return $arg_exec_file; } 2) Applying 1) allows to correctly pass the first step. However, build fails with a syntax error: C:\.cpan\build\Time-y2038-20081106-3Bmqot>Build Generating script 'y2038\time64.ccs' cl -nologo -c @"y2038\time64.ccs" -Fo"y2038\time64.obj" "y2038\time64.c" time64.c y2038\time64.c(174) : warning C4244: '=' : conversion from 'Year' to 'int', possible loss of data y2038\time64.c(179) : warning C4244: '=' : conversion from 'Year' to 'int', possible loss of data y2038\time64.c(433) : warning C4244: '=' : conversion from 'Year' to 'int', possible loss of data y2038\time64.c(438) : warning C4244: '=' : conversion from 'Year' to 'int', possible loss of data y2038\time64.c(620) : error C2059: syntax error : ')' y2038\time64.c(633) : error C2059: syntax error : 'if' y2038\time64.c(638) : error C2065: 'gm_tm' : undeclared identifier y2038\time64.c(638) : error C2224: left of '.tm_year' must have struct/union type y2038\time64.c(640) : error C2059: syntax error : 'if' y2038\time64.c(648) : error C2065: 'gm_tm' : undeclared identifier y2038\time64.c(648) : warning C4133: 'function' : incompatible types - from 'int *' to 'const TM64 *' y2038\time64.c(648) : error C2099: initializer is not a constant y2038\time64.c(649) : error C2059: syntax error : 'if' y2038\time64.c(654) : error C2143: syntax error : missing ')' before '&' y2038\time64.c(654) : error C2143: syntax error : missing '{' before '&' y2038\time64.c(654) : error C2059: syntax error : '&' y2038\time64.c(654) : error C2059: syntax error : ')' y2038\time64.c(656) : error C2143: syntax error : missing '{' before '->' y2038\time64.c(656) : error C2059: syntax error : '->' y2038\time64.c(657) : error C2059: syntax error : 'if' y2038\time64.c(668) : error C2065: 'local_tm' : undeclared identifier y2038\time64.c(668) : error C2223: left of '->tm_mon' must point to struct/union y2038\time64.c(668) : error C2065: 'gm_tm' : undeclared identifier y2038\time64.c(668) : error C2224: left of '.tm_mon' must have struct/union type y2038\time64.c(673) : error C2059: syntax error : 'if' y2038\time64.c(680) : error C2059: syntax error : 'if' y2038\time64.c(690) : error C2059: syntax error : 'if' y2038\time64.c(693) : error C2059: syntax error : 'type' y2038\time64.c(695) : error C2059: syntax error : 'return' y2038\time64.c(696) : error C2059: syntax error : '}' error building dll file from 'y2038/time64.c' at c:/dev/perl510/lib/ ExtUtils/CBuilder/Platform/Windows.pm line 159. Again, tracking down the issue reveals a problem in the preprocessed source code: /* SHOULD_USE_SYSTEM_LOCALTIME */ /* SYSTEM_LOCALTIME_MIN is missing */ if ( ((*time) <= 32535244799 && (*time) >= ) { safe_time = *time; // ... return local_tm; } and in y2038/time64_config.h: #define SYSTEM_LOCALTIME_MAX 32535244799 #define SYSTEM_LOCALTIME_MIN #define SYSTEM_GMTIME_MAX 32535291599 #define SYSTEM_GMTIME_MIN -43200 SYSTEM_LOCALTIME_MIN is defined but empty, so this causes the syntax error. The following ugly patch to Build.PL works for me: --- Build.PL.orig Sun Nov 09 12:01:02 2008 +++ Build.PL Sun Nov 09 12:01:50 2008 @@ -40,7 +40,10 @@ # Windows lies about being able to handle just a little bit of # negative time. for my $key (qw(gmtime_min localtime_min)) { - if( -10_000 < $limits{$key} && $limits{$key} < 0 ) { + if( ! defined $limits{$key} ) { + $limits{$key} = 0; + } + elsif( -10_000 < $limits{$key} && $limits{$key} < 0 ) { $limits{$key} = 0; } } That's it.
Subject: eu-cb.patch
# Special case for MSVC linker sub arg_exec_file { my ($self, $file) = @_; my $arg_exec_file; # MSVC linker wants /OUT:file.exe if ($self->_compiler_type eq 'MSVC') { $arg_exec_file = "/OUT:$file"; } # Normal behavior else { $arg_exec_file = $self->SUPER::arg_exec_file($file); } return $arg_exec_file; }
Subject: y2038time64_preprocess.c
// SHOULD_USE_SYSTEM_LOCALTIME if ( ((*time) <= 32535244799 && (*time) >= ) { safe_time = *time; ((void)0); fake_localtime_r(&safe_time, &safe_date); copy_tm_to_TM(&safe_date, local_tm); (void)( (!!(check_tm(local_tm))) || (_wassert(L"check_tm(local_tm)", L"y2038\\time64.c", 628), 0) ); return local_tm; } if( gmtime64_r(time, &gm_tm) == ((void *)0) ) { ((void)0); return ((void *)0); }
Subject: time-y2038-buildpl.patch
--- Build.PL.orig Sun Nov 09 12:01:02 2008 +++ Build.PL Sun Nov 09 12:01:50 2008 @@ -40,7 +40,10 @@ # Windows lies about being able to handle just a little bit of # negative time. for my $key (qw(gmtime_min localtime_min)) { - if( -10_000 < $limits{$key} && $limits{$key} < 0 ) { + if( ! defined $limits{$key} ) { + $limits{$key} = 0; + } + elsif( -10_000 < $limits{$key} && $limits{$key} < 0 ) { $limits{$key} = 0; } }
Subject: Re: [rt.cpan.org #40779] Build failure: undefined SYSTEM_LOCALTIME_MIN under Win32/MSVC
Date: Sun, 09 Nov 2008 22:27:07 -0800
To: bug-Time-y2038 [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
Cosimo Streppone via RT wrote: Show quoted text
> Build of latest Time::y2038 CPAN fails for me under Windows Vista > and MSVC 2008 Express.
But it works on Windows XP + MSVC 2008 Express, yarrrrrgh! Or at least it did a month ago. Maybe I broke something. Hopefully I can replicate without having to pirate^W^W^W^Wbuy a copy of Vista. Sorry, that has nothing to do with you. Just venting. Thanks for the report. Show quoted text
> The problem is that MSVC wants `link /OUT:file.exe file.c' instead of > `link -o file.exe file.c' > I tracked this issue down to ExtUtils::CBuilder. Adding the following > overridden method in > ExtUtils::CBuilder::Platform::Windows seems to do the trick.
Nice job. Could you report that in the ExtUtils::CBuilder bug queue? I'd forward it myself but I wouldn't be able to explain/test the problem. Show quoted text
> Again, tracking down the issue reveals a problem in the preprocessed > source code: > > /* SHOULD_USE_SYSTEM_LOCALTIME */ > /* SYSTEM_LOCALTIME_MIN is missing */ > if ( ((*time) <= 32535244799 && (*time) >= ) { > safe_time = *time; > // ... > return local_tm; > } > > and in y2038/time64_config.h: > > #define SYSTEM_LOCALTIME_MAX 32535244799 > #define SYSTEM_LOCALTIME_MIN > #define SYSTEM_GMTIME_MAX 32535291599 > #define SYSTEM_GMTIME_MIN -43200 > > SYSTEM_LOCALTIME_MIN is defined but empty, so this causes the syntax > error.
Well that's bizarre. Should be something there. This means that bin/check_max gave some strange output. Could you run bin/check_max and tell me the result? Please use the released version as well as this one: http://code.google.com/p/y2038/source/browse/trunk/bin/check_max.c I'll try this all on XP. -- Robrt: People can't win Schwern: No, but they can riot after the game.
On Lun. 10 Nov. 2008 01:28:15, schwern@pobox.com wrote: Show quoted text
>
> > The problem is that MSVC wants `link /OUT:file.exe file.c' instead > > of `link -o file.exe file.c'
> > Nice job. Could you report that in the ExtUtils::CBuilder bug queue?
Done. Cc'd you. (http://rt.cpan.org/Ticket/Display.html?id=40819) Show quoted text
> > and in y2038/time64_config.h: > > > > #define SYSTEM_LOCALTIME_MAX 32535244799 > > #define SYSTEM_LOCALTIME_MIN > > #define SYSTEM_GMTIME_MAX 32535291599 > > #define SYSTEM_GMTIME_MIN -43200
> > Well that's bizarre. Should be something there.
Yes, I think so too. I tried to understand, but failed. Show quoted text
> Could you run bin/check_max > and tell me the result?
Look, this is funny: C:\.cpan\build\Time-y2039-20081106>perl Build.PL Generating script ... [...] Checking prerequisites... [...] cl -nologo -c @"check_max.ccs" -Fo"check_max.obj" "check_max.c" check_max.c link /OUT:check_max.exe check_max.obj and running it... Done. Use of uninitialized value within %limits in numeric lt (<) at Build.PL line 46. Use of uninitialized value within %limits in numeric lt (<) at Build.PL line 46. gmtime_max: -1 gmtime_min: -43200 localtime_max: -1 Deleting Build Removed previous script 'Build' Creating new 'Build' script for 'Time-y2038' version '20081106' But then, right after I executed check_max.exe, and: C:\.cpan\build\Time-y2038-20081106>check_max.exe gmtime_max 32535291599 localtime_max 32535244799 gmtime_min -43200 localtime_min 0 So I think the problem is instead in Build.PL. The following patch (also attached) solves it, and also removes the warnings on `%limits' values: --- Build.PL.orig Mon Nov 10 22:00:01 2008 +++ Build.PL Mon Nov 10 22:03:00 2008 @@ -33,14 +33,15 @@ my %limits; for my $line (@maxes) { my($key, $val) = split /\s+/, $line; - next unless $key and $val; + next unless $key and $val ne ''; $limits{$key} = $val; } # Windows lies about being able to handle just a little bit of # negative time. for my $key (qw(gmtime_min localtime_min)) { - if( -10_000 < $limits{$key} && $limits{$key} < 0 ) { + if( defined $limits{$key} && + -10_000 < $limits{$key} && $limits{$key} < 0 ) { $limits{$key} = 0; } } Case closed?
--- Build.PL.orig Mon Nov 10 22:00:01 2008 +++ Build.PL Mon Nov 10 22:03:00 2008 @@ -33,14 +33,15 @@ my %limits; for my $line (@maxes) { my($key, $val) = split /\s+/, $line; - next unless $key and $val; + next unless $key and $val ne ''; $limits{$key} = $val; } # Windows lies about being able to handle just a little bit of # negative time. for my $key (qw(gmtime_min localtime_min)) { - if( -10_000 < $limits{$key} && $limits{$key} < 0 ) { + if( defined $limits{$key} && + -10_000 < $limits{$key} && $limits{$key} < 0 ) { $limits{$key} = 0; } }
Subject: Re: [rt.cpan.org #40779] Build failure: undefined SYSTEM_LOCALTIME_MIN under Win32/MSVC
Date: Tue, 11 Nov 2008 16:01:49 -0800
To: bug-Time-y2038 [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
Cosimo Streppone via RT wrote: Show quoted text
> So I think the problem is instead in Build.PL. > The following patch (also attached) solves it, and also removes the > warnings on `%limits' values: > > --- Build.PL.orig Mon Nov 10 22:00:01 2008 > +++ Build.PL Mon Nov 10 22:03:00 2008 > @@ -33,14 +33,15 @@ > my %limits; > for my $line (@maxes) { > my($key, $val) = split /\s+/, $line; > - next unless $key and $val; > + next unless $key and $val ne ''; > $limits{$key} = $val; > }
*head smack* Of course! With that fix the rest should not be necessary. Show quoted text
> Case closed?
Please try the latest version in SVN at http://y2038.googlecode.com/svn/trunk/ The module is in perl/Time-y2038 but you have to check out the whole thing because of the symlinks. -- 184. When operating a military vehicle I may *not* attempt something "I saw in a cartoon". -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army http://skippyslist.com/list/
On Mar. 11 Nov. 2008 19:02:34, schwern@pobox.com wrote: Show quoted text
> > Case closed?
> > Please try the latest version in SVN at > http://y2038.googlecode.com/svn/trunk/ > The module is in perl/Time-y2038 but you have to check out the whole > thing > because of the symlinks.
Doesn't work for me. I had to update ExtUtils::CBuilder to 0.24, and that's fine. But... E:\dev\src\time-y2038-svn\perl\Time-y2038>perl Build.PL Checking whether your kit is complete... Looks good Checking prerequisites... Looks good Deleting Build Removed previous script 'Build' Creating new 'Build' script for 'Time-y2038' version '20081111' E:\dev\src\time-y2038-svn\perl\Time-y2038>Build Building a program to test the range of your system time functions... Can't locate object method "cbuilder" via package "Local::Module::Build" at inc/Local/Module/Build.pm line 13.
Subject: Re: [rt.cpan.org #40779] Build failure: undefined SYSTEM_LOCALTIME_MIN under Win32/MSVC
Date: Wed, 12 Nov 2008 00:15:05 -0800
To: bug-Time-y2038 [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
Cosimo Streppone via RT wrote: Show quoted text
> E:\dev\src\time-y2038-svn\perl\Time-y2038>Build > Building a program to test the range of your system time functions... > Can't locate object method "cbuilder" via package > "Local::Module::Build" at inc/Local/Module/Build.pm line 13.
Sorry, I guess that was added in Module::Build 0.2809. Could you upgrade and try again? -- Robrt: People can't win Schwern: No, but they can riot after the game.
On Mer. 12 Nov. 2008 03:15:48, schwern@pobox.com wrote: Show quoted text
> Sorry, I guess that was added in Module::Build 0.2809. Could you > upgrade and > try again?
Seems to work. Tests pass. There are some minor problems, but not Time- y2038-related I guess... 1) if I execute `perl Build.PL' from where I used to (drive E:, which is different from C:, where perl.exe is), Module::Build 0.30 fails now. I tried with 0.2808 as well. Same problem. I guess this is a M::B problem. So I moved everything to C:, just to go on, and: 2) Symlinks in svn do not work for me. I guess this is an svn-on- linkless-filesystem problem. I had to copy the files manually. 3) I see some strange "warnings", like 'Cant find source file for up_to_date check', and others. Build log follows: ---------------------------------------------------- C:\dev\time-y2038-svn\perl\Time-y2038>perl Build.PL Checking whether your kit is complete... Looks good Checking prerequisites... Looks good Deleting Build Removed previous script 'Build' Creating new 'Build' script for 'Time-y2038' version '20081111' C:\dev\time-y2038-svn\perl\Time-y2038>Build Building a program to test the range of your system time functions... Generating script 'check_max.ccs' cl -nologo -c @"check_max.ccs" -Fo"check_max.obj" "check_max.c" check_max.c check_max.c(83) : warning C4146: unary minus operator applied to unsigned type, result still unsigned link -o check_max check_max.obj Microsoft (R) Incremental Linker Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. LINK : warning LNK4044: unrecognized option '/o'; ignored check_max.obj : warning LNK4042: object specified more than once; extras ignored Can't find source file check_max for up-to-date check at c:/dev/perl510/ lib/Module/Build/Base.pm line 4304. C:\dev\time-y2038-svn\perl\Time-y2038>Build test Building a program to test the range of your system time functions... Generating script 'check_max.ccs' cl -nologo -c @"check_max.ccs" -Fo"check_max.obj" "check_max.c" check_max.c check_max.c(83) : warning C4146: unary minus operator applied to unsigned type, result still unsigned link -o check_max check_max.obj Microsoft (R) Incremental Linker Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. LINK : warning LNK4044: unrecognized option '/o'; ignored check_max.obj : warning LNK4042: object specified more than once; extras ignored Can't find source file check_max for up-to-date check at c:/dev/perl510/ lib/Module/Build/Base.pm line 4304. t\everywhere....ok t\time..........ok 6/33 skipped: various reasons t\timegm........ok 4/17 skipped: various reasons All tests successful, 10 subtests skipped. Files=3, Tests=52, 17 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 CPU) C:\dev\time-y2038-svn\perl\Time-y2038> ---------------------------------------------------- Thanks!
Show quoted text
> 1) if I execute `perl Build.PL' from where I used to (drive E:, which > is different from C:, where perl.exe is), Module::Build 0.30 fails now. > I tried with 0.2808 as well. Same problem. I guess this is a M::B > problem.
Module::Build should have solved that by now. Show quoted text
> 2) Symlinks in svn do not work for me. I guess this is an svn-on- > linkless-filesystem problem. I had to copy the files manually.
Sorry. Released versions will not have symlinks. We're using git now if that helps. Show quoted text
> 3) I see some strange "warnings", like 'Cant find source file for > up_to_date check', and others. Build log follows:
Sounds like a transient Module::Build misfeature. I'm going to close this up as the primary problem is solved. I've been doing alpha releases leading up to a new stable, please try them out.