Wx is a pain to install on Windows using ActivePerl 5.10.1 and a MS compiler. This post details one way of installing it.
It crashes Visual Studio 6's compiler, so start by upgrading your compiler:
- Download "Visual C++ 2008 Express edition".
- Install it under C:\Progs (Adjust at will, but I didn't try a path with a space in it)
Now we need the library. If you let Alien::wxWidgets download and build it, it won't patch it to have it embed the manifest files into the DLL files, causing DLL errors and malfunctions when you try to some aspects of Wx. I could patch Alien::wxWidgets to patch wxWidget's makefile, but I decide to just patch wxWidget's makefile. That means the patches Alien::wxWidgets wants to apply [1] [2] won't get applied.
- Download wxWidgets-2.8.10
- Install it in C:\Progs\wxWidgets-2.8.10 (Adjust at will, but I didn't try a path with a space in it)
It might be a good idea to upgrade your Perl tool chain. You want at least:
I had the following installed:
Then, open up a console and execute the following commands in turn. As is, it's not suitable to be copy and pasted in its entirety or put in a batch file.
Note that the process takes a while. The longest step, building "msw", takes an hour or more on my aging machine.
"C:\Progs\Microsoft Visual Studio 9.0\VC\vcvarsall"
C:
cd \Progs\wxWidgets-2.8.10
cd build\msw
nmake -f makefile.vc SHARED=1 BUILD=release
cd ..\..
cd contrib\build\stc
nmake -f makefile.vc SHARED=1 BUILD=release
cd ..\..\..
cd lib\vc_dll
for %q in (*.manifest) do (
mt -nologo -manifest %q -outputresource:%~nq;2
del %q
)
cd ..\..
set WXDIR=C:\Progs\wxWidgets-2.8.10
set WXWIN=C:\Progs\wxWidgets-2.8.10
C:
cd \
md stager
cd stager
lwp-request http://search.cpan.org/CPAN/authors/id/M/MB/MBARBON/Alien-
+wxWidgets-0.47.tar.gz > Alien-wxWidgets-0.47.tar.gz
perl -MArchive::Tar -e"Archive::Tar->new->read($ARGV[0],1,{extract=>1}
+)" Alien-wxWidgets-0.47.tar.gz
cd Alien-wxWidgets-0.47
perl -i.bak -pe"s/config => \{ cc => \$cc, ld => \K(?=\$cc })/\$cc eq
+'cl' ? 'link' : /" lib\Alien\wxWidgets\Utility.pm
perl Makefile.PL INSTALLDIRS=site
-> Should ask "Do you want to fetch and build wxWidgets from source
+s?". Use default "no".
nmake
nmake test
nmake install
cd ..
rd /s/q Alien-wxWidgets-0.47
del Alien-wxWidgets-0.47.tar.gz
lwp-request http://search.cpan.org/CPAN/authors/id/M/MB/MBARBON/Wx-0.9
+4.tar.gz > Wx-0.94.tar.gz
perl -MArchive::Tar -e"Archive::Tar->new->read($ARGV[0],1,{extract=>1}
+)" Wx-0.94.tar.gz
cd Wx-0.94
perl -i.bak -pe"s/^sub \K(?=dynamic_lib \{$)/DELETED_/" build\Wx\build
+\MakeMaker\Win32_MSVC.pm
perl -i.bak -pe"s/new wxCursor\( name, \K(?=type, hsx, hsy \))/(long)/
+" xs\Cursor.xs
perl Makefile.PL INSTALLDIRS=site --extra-cflags="/FIstdlib.h"
nmake
nmake test
nmake install
cd ..
rd /s/q Wx-0.94
del Wx-0.94.tar.gz
cd ..
rd stager
Finally, you may uninstall wxWidgets-2.8.10 since Alien::wxWidgets made a copy of the files Wx needs into Perl's lib. To uninstall wxWidgets-2.8.10,
- Run the uninstaller found via Start | Programs, then
- Delete the directory C:\Progs\wxWidgets-2.8.10
Doing so will free up 500MB.
I recommend that you get Wx::Demo.
"C:\Progs\Microsoft Visual Studio 9.0\VC\vcvarsall"
cpan Wx::Demo
You can launch the demo using
wperl C:\Progs\perl5101\site\bin\wxperl_demo.pl
It warns that it's "skipping module 'Wx::DemoModules::wxHVScrolledWindow'". I think it's a problem with the demo, not a problem with Wx.
Update: Many small tweaks to the text parts. Last one on Dec 22, 2009 at 10:21 EST
Update: Modified the paragraph starting with "Now we need the library". Dec 30, 2009 at 10:06 EST