http://www.perlmonks.org?node_id=11105100


in reply to Re^11: Need help debugging Wx on Strawberry Perl 5.26.1
in thread Need help debugging Wx on Strawberry Perl 5.26.1

This talks about it https://wiki.wxwidgets.org/Compiling_wxWidgets_with_MinGW#Troubleshooting

I imagine making sure Build.bat sets SHELL=cmd.exe AND appropriate %PATH% is better than annoying users :)

  • Comment on Re^12: Need help debugging Wx on Strawberry Perl 5.26.1

Replies are listed 'Best First'.
Re^13: Need help debugging Wx on Strawberry Perl 5.26.1
by Corion (Patriarch) on Aug 27, 2019 at 07:38 UTC

    Thanks for the link, this will certainly help. As this goes into Module::Build territory, and I'm not keen on learning on how to make Module::Build add arbitrary commands to the created Build (well, Build.bat) script, I won't change my patch. Somebody with knowledge of Module::Build is welcome to take my patch and make things work right out of the box.

    The appropriate commands would likely be (ignoring systems where we have command.com):

    set SHELL=cmd.exe

    ... and, after appropriate munging in Perl to remove all offending directories in $ENV{PATH}:

    set PATH=$cleaned_path

    $cleaned_path would likely be something like:

    my $cleaned_path = join ";", grep { ! -f "$_\\sh.exe" && ! -f "$_\\cc1.exe" } split /;/, $ENV{PATH} ;

      This works for me as in it starts building and doesn't die immediately with CreateProcess(NULL, better than renaming sh.exe and make.exe :)

      Alien-wxWidgets-0.69\inc\My\Build\Win32.pm sub build_wxwidgets { my $self = shift; my $old_dir = Cwd::cwd(); my $uni = $self->awx_unicode ? 'UNICODE=1' : 'UNICODE=0'; my $mslu = $self->awx_mslu ? 'MSLU=1' : 'MSLU=0'; my $dbg = $self->awx_debug ? 'BUILD=debug' : 'BUILD=release'; my $opt = join ' ', $uni, $mslu, $dbg, 'SHARED=1', 'SHELL=cmd.exe' +;

      This was a flop , dies with CreateProcess(NULL, probably all that reboot talk ... nonsense :)

      Alien-wxWidgets-0.69\inc\My\Build\Win32.pm sub massage_environment { my( $self ) = shift; if( $self->notes( 'build_wx' ) ) { $ENV{WXWIN} = $ENV{WXDIR} = File::Spec->rel2abs ( $self->notes( 'build_data' )->{data}{directory} ); $ENV{SHELL} = 'cmd.exe' if $Config::Config{sh}=~/cmd/i; my $mingw_gcc = My::Build::Base->awx_path_search( '*-gcc-*.exe +' ); # i686-w64-mingw32-gcc-4.6.3.exe my $basename = File::Basename::basename($mingw_gcc, '.exe' ); $basename = "libexec/gcc/$1/$2" if $basename =~ m{^(.+?)-gcc-( +.+)}is; my $new_path = File::Spec->rel2abs( File::Spec->catfile( File::Basename::dirname($mingw_gcc) , File::Spec->updir, $basename ) ); #~ die "SHELL=$ENV{SHELL}\n$mingw_gcc\n$basename\n$new_path"; $ENV{PATH}.=';'.$new_path; ## didnt work } }