perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: [mp2] source_scan on Win32
Date Fri, 18 Jun 2004 12:09:57 GMT
Randy Kobes wrote:
> I've been trying to get the build/source_scan.pl working
> on Win32, and made some progress, but came up against
> something. First off, there's a couple of things that
> are fixable:
> - in lib/Apache/ParseSource.pm, follow => 1 is used
> within a File::Find, which doesn't work on Win32;
> - in lib/ModPerl/CScan.pm, a different syntax is
> needed to run 'cppstdin':
> ======================================================
> Index: lib/ModPerl/CScan.pm
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/lib/ModPerl/CScan.pm,v
> retrieving revision 1.3
> diff -u -r1.3 CScan.pm
> --- lib/ModPerl/CScan.pm	15 Jun 2004 17:50:34 -0000	1.3
> +++ lib/ModPerl/CScan.pm	18 Jun 2004 04:32:36 -0000
> @@ -3,6 +3,7 @@
>  require Exporter;
>  use Config '%Config';
>  use File::Basename;
> +use Apache::Build ();
> 
>  # NOTE to distributors: this module is needed only for mp2 developers,
>  # it's not a requirement for mod_perl users
> @@ -929,8 +930,9 @@
>      $addincludes = "-I" . join(" -I", @$Includes)
>        if defined $Includes and @$Includes;
>      my($sym) = gensym;
> -    my $cmd = "echo '\#include \"$filename\"' | $Cpp->{cppstdin} $Defines $addincludes
$Cpp->{cppflags} $Cpp->{cppminus} |";
> -    #my $cmd = "$Cpp->{cppstdin} $Defines $addincludes $Cpp->{cppflags} $Cpp->{cppminus}
< $filename |";
> +    my $cmd = Apache::Build::WIN32 ?
> +        "$Cpp->{cppstdin} $Defines $addincludes $Cpp->{cppflags}  $filename |"
:
> +            "echo '\#include \"$filename\"' | $Cpp->{cppstdin} $Defines $addincludes
$Cpp->{cppflags} $Cpp->{cppminus} |";
>      #my $cmd = "echo '\#include <$filename>' | $Cpp->{cppstdin} $Defines $addincludes
$Cpp->{cppflags} $Cpp->{cppminus} |";

Please don't create any dependencies on modperl modules here. Hopefully one 
day the adjusted C::Scan will be released and this file will be removed.

>      (open($sym, $cmd) or die "Cannot open pipe from `$cmd': $!")
> Index: lib/Apache/ParseSource.pm
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/lib/Apache/ParseSource.pm,v
> retrieving revision 1.55
> diff -u -r1.55 ParseSource.pm
> --- lib/Apache/ParseSource.pm	17 May 2004 23:01:22 -0000	1.55
> +++ lib/Apache/ParseSource.pm	18 Jun 2004 04:32:38 -0000
> @@ -200,7 +200,7 @@
>                                     my $dir = $File::Find::dir;
>                                     push @includes, "$dir/$_";
>                                 },
> -                               follow => 1,
> +                               (Apache::Build::WIN32 ? '' : follow => 1),
>                                }, $dir);
>      }
>      return @includes;

+1

but isn't that a bug in File::Find? It's supposed to be a cross-platform module.

> ================================================================
> 
> (an unrelated problem - on my ActivePerl, $Config{cppstdin}
> is defined to be 'cppstdin', which doesn't exist on my
> system. I had to change it to 'cl -nologo -E' to get it
> to work. But I think this is a Perl configuration issue).
> 
> However, with these changes, build/source_scan dies at a
> certain point:
> 
> ========================================================
> .apache_includes
> D:\unzipped\MODPER~1.0\xs/modperl_xs_sv_convert.h(149) : warning C4005: 'mp_xs_sv2_APR__Table'
: macro redefinition
>         D:\unzipped\MODPER~1.0\xs/modperl_xs_util.h(25) : see previous definition of
'mp_xs_sv2_APR__Table'
> D:\unzipped\MODPER~1.0\xs/modperl_xs_sv_convert.h(321) : warning C4005: 'mp_xs_sv2_r'
: macro redefinition
>         D:\unzipped\MODPER~1.0\xs/modperl_xs_util.h(21) : see previous definition of
'mp_xs_sv2_r'
> .apache_includes
> D:\unzipped\MODPER~1.0\xs/modperl_xs_sv_convert.h(149) : warning C4005: 'mp_xs_sv2_APR__Table'
: macro redefinition
>         D:\unzipped\MODPER~1.0\xs/modperl_xs_util.h(25) : see previous definition of
'mp_xs_sv2_APR__Table'
> D:\unzipped\MODPER~1.0\xs/modperl_xs_sv_convert.h(321) : warning C4005: 'mp_xs_sv2_r'
: macro redefinition
>         D:\unzipped\MODPER~1.0\xs/modperl_xs_util.h(21) : see previous definition of
'mp_xs_sv2_r'
> panic: length mismatch
> 	' void *(__stdcall *apr_thread_start_t)(apr_thread_t*, void*)'
> whited-out as
> 	'void                                                             '
> panic: length mismatch
> 	' ap_filter_t * (_stdcall *modperl_filter_add_t) (const char *, void *,
>                                                        request_rec *,
>                                                        conn_rec *)'
> whited-out as
> 	'ap_filter_t                                                                       
                                                                                         
                                              '
> Expecting parenth after identifier in `EXCEPTION_DISPOSITION __cdecl _except_handler
( struct _EXCEPTION_RECORD *ExceptionRecord, void * EstablisherFrame, struct _CONTEXT *ContextRecord,
void * DispatcherContext )'
> after `EXCEPTION_DISPOSITION __cdecl ' at lib/ModPerl/CScan.pm line 809.
> 	ModPerl::CScan::do_declaration('EXCEPTION_DISPOSITION __cdecl _except_handler (\x{a}
   struct _E...', 'HASH(0x264c82c)', 'HASH(0x1d3b1a0)') called at lib/ModPerl/CScan.pm line
752
> 	ModPerl::CScan::do_declarations('ARRAY(0x1d3b644)', 'HASH(0x264c82c)', 'HASH(0x1d3b1a0)')
called at D:/Perl/site/lib/Data/Flow.pm line 93
> 	Data::Flow::request('Apache::ParseSource::Scan=ARRAY(0x1d39574)', 'parsed_fdecls') called
at D:/Perl/site/lib/Data/Flow.pm line 46
> 	Data::Flow::get('Apache::ParseSource::Scan=ARRAY(0x1d39574)', 'parsed_fdecls') called
at lib/Apache/ParseSource.pm line 65
> 	Apache::ParseSource::Scan::get('Apache::ParseSource::Scan=ARRAY(0x1d39574)', 'parsed_fdecls')
called at lib/Apache/ParseSource.pm line 398
> 	Apache::ParseSource::get_functions('Apache::ParseSource=HASH(0x265ad74)') called at
lib/Apache/ParseSource.pm line 494
> 	Apache::ParseSource::write_functions_pm('Apache::ParseSource=HASH(0x265ad74)') called
at build\source_scan.pl line 18
> =============================================================================

I can't quite help you here Randy, the C::Scan code is huge spaghetti of 
continuous regular expressions. When I fixed it to work on linux, I had to 
inserts some 10,000 debug statements and try to fix it, which I eventually 
succeeded for the Apache 2.0 source code. I have left some of these debug 
statements commented out. I used Carp to get the trace.

> So the problem seem to be the presence of __cdecl in the
> declaration. I'm afraid I couldn't follow the code around
> line 809 of lib/ModPerl/CScan.pm enough to know if __cdecl
> could just be tested for, and thrown away if found, or
> if it would form part of the declaration needed later?

Try to throw it away and see if it causes any harm, i.e. if you get the same 
xs/tables, then probably no harm was done. I could be wrong.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message