|Version 5 (modified by nwellnhof, 6 years ago)|
Developers working on Windows
|François Perrad||Win2000-SP4||MinGW/GCC 3.4.2|
|Ronald Blaschke||Windows XP, Windows XP x64||Visual C++ 9.0|
|Paul Cochrane||Windows XP||Visual C++ 2005 Express Edition|
Development on Windows
What to download and install
- Strawberry Perl
- Scroll down to Windows section, and get the command-line binaries (probably easiest to grab the "Friendly Installer Program" versions)
- Microsoft Visual Studio 2008 Express Edition for C++
- Microsoft Visual C++ 2010 Express
Setting up Microsoft Visual Studio 2008
Now you will need to register the software, otherwise you can only use it for 30 days. To register, start up the Visual C++ Express program directly from the Start Menu. Go to the Help menu and select "Register Product". Then click on the "Register now" link in the window which appears. You'll need to get a Hotmail email account so that you can log in and eventually get the registration number. Once you've done that, sign in and you should be presented with a web form to fill out. Fill this information out and you should then be given a registration key. Copy and paste this key into the relevant field in Visual C++ Express. You can now close the program; you'll be developing Parrot from within the command line interface anyway :-)
Setting up Microsoft Visual C++ 2010 Express
Microsoft Visual C++ 2010 Express doesn't require a registration. It only forces you to download and install a bunch of other stuff related to Windows development.
Open up the Visual Studio 2008 Command Prompt, go to the directory where you would like to check Parrot out and then enter the command:
svn co https://svn.perl.org/parrot/trunk parrot_msvc
I usually check out Parrot to the parrot_msvc directory because I also have a directory for the Cygwin version of Parrot. If you're not going to be building Parrot with Cygwin you can just use parrot instead of parrot_msvc. You should get a prompt asking you to accept the certificate from svn.perl.org. Accept this and then you should see Subversion checking out your brand new working copy of Parrot.
Actually, it seems this step is no longer necessary, so you might not need to worry anymore with the current version of Visual Studio. When using MSVC 2010 it should be enough to run "C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat".
Download the Parrot setup script for Windows parrot_setup.bat (attached to this page), and put it into your newly checked out working copy. This file sets up the relevant paths etc for the Visual Studio Command Prompt to see all its own information and so you can just call nmake (Microsoft's version of make) and cl (the Visual Studio C/C++ compiler) from the command line. This file was developed on a German version of Windows so you'll probably need to change Programme to Programs to get the paths correct. Run the .bat file like so:
Your environment should now be set up so you can develop Parrot.
Configuring and building Parrot
You should now be able to run these steps:
perl Configure.pl nmake nmake test
Interestingly enough, this will build parrot with MingW (this is because Strawberry Perl is built with gcc, I think...). If you wish to build Parrot with Visual C++ (after all, you went to all the trouble of installing the program, didn't you?) then you'll need to run these steps: (for some reason this isn't working atm... Parrot's Configure.pl is finding too many of the Strawberry Perl default settings, and so one can't yet build Parrot with this setup yet).
perl Configure.pl --cc=cl --link=link --ld=link nmake nmake test
How to compile Parrot VM using Strawberry Perl and Microsoft Visual Studio 2010
Strawberry Perl is community-driven full featured Perl for Windows systems. Parrot's Configure.pl determins compiler options from Perl executable. Unfortunately, Strawberry Perl has been compiled with gcc, so Configure.pl will try to use gcc's options on VS compiler and linker, which will result in nothing - you won't be able to compile/test Parrot. In oreder to fix that you have to set up compiler's options manually.
First of all, open Visual Studio Command Prompt (Windows->Microsoft Visual Studio 2010->Visual Studio Tools), then navigate to directory, where you have Parrot's sources.
I use the following options:
perl Configure.pl --without-icu --cc=cl --link=link --ld=link \ --ccflags="-nologo -GF -W4 -MD -Zi -DNDEBUG -DWIN32 -D_CONSOLE \ -DNO_STRICT -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC" \ --linkflags="-nologo -nodefaultlib -debug" --verbose
This should create a Makefile for bare minimum Parrot install.
Now you can run nmake. Enjoy your parrot.exe.
Setting up the cpan shell
The great thing about Strawberry Perl is that it's just like using Perl in almost every other Perl environment, so if you go from Solaris to Linux, and with Strawberry Perl, even to Windows, the way you interact with Perl will be exactly the same. Therefore, to install new modules from CPAN, you need to set up the cpan shell. But first, you'll need to install some helper programs for the cpan shell. There is an awesome site hosting many of the standard GNU utilities bundled for use on Windows systems at http://sourceforge.net/projects/gnuwin32. You will need to download and install the following programs:
After you have done this, add C:\programs\gnuwin32\bin to your Windows PATH environment variable.
Then run cpan from within your Visual Studio Command Prompt and you should then be asked for lots of configuration information. If the cpan shell doesn't find some of your programs, just enter the full path to it when prompted to do so. For instance, when asked for your gzip program location, enter:
Also note that when you are asked if the CPAN mirror sites should be downloaded anew, then enter y (i.e. yes) rather than the default option of no (sometimes the previous setup of the cpan shell hasn't got the list properly, and you won't be able to enter a relevant continent, country, and CPAN mirror location, which means you can't actually use CPAN which would be bad).
Running the smoke tests
In order to run tests such as make smoke and make languages-smoke (both really important and helpful things you can do to contribute to Parrot, even if you don't have lots of time to hack the source) you will need to install the Test::TAP::HTMLMatrix module. To do this, you can use the cpan shell from within your Visual Studio Command Prompt. Once at the prompt, enter cpan to go to the cpan shell, then you just need to do:
cpan> install Test::TAP::HTMLMatrix
To install the module so that you can run the smoke tests.
Read README_cygwin.pod first.
Install the following cygwin packages:
- perl (v5.10)
and optionally: libgmp-devel libgdbm-devel m4 ctags readline gettext gettext-devel icu libicu-devel pcre pcre-devel libaio-devel
Then install the following CPAN modules:
- Test::Base for some APL language tests
- Test::TAP::HTMLMatrix if you want to run the language smoke tests (make languages-smoke)
As of Nov 2008, these instructions work for a fresh cygwin install using perl 5.10.5 You may need to force install Test::TAP::HTMLMatrix from within cpan depends on (but does not 'use') Test::Harness::Straps, which may have problems installing under cygwin perl 5.10.5 cpan -- you may need to tweak around a /usr/share/man/man3 error to make things work.
Finally, make sure <YOUR_PARROT_SRC_DIR>/blib/lib is in your PATH (this may or may not be explicitly necessary by the time you read this) so miniparrot.exe can find libparrot.dll. There is a patch available.
The NCI postgresql test will fail because of the wrong pg.dll name. Everything else should pass.
As of January 2009, Parrot 0.9.0 and Strawberry Perl 184.108.40.206 play well together, but some workarounds are needed. The Makefile built by Configure.pl needs two changes, and some files need to be copied from the Strawberry Perl c directories into the Parrot build directory. The below assumes that you let Strawberry Perl install in its choice of directory.
After you have generated Makefile by using "perl Configure.pl", but before the first attempt at "ming32-make", edit the Makefile file and change the existing empty make lines to:
LINKFLAGS = -L=C:\strawberry\c\lib -L=C:\strawberry\c\lib\gcc\mingw32\3.4.5 LDFLAGS = -Wl,-L=C:\strawberry\c\lib -Wl,-L=C:\strawberry\c\lib\gcc\mingw32\3.4.5
This allows various build steps to find libraries they would otherwise miss. However, updating this doesn't cure all the missed files. To do that you need to copy selected files from Strawberry Perl's C / mingw32 directories to the Parrot build directory, like so:
copy C:\strawberry\c\bin\ld.exe copy C:\strawberry\c\bin\gcc.exe copy C:\strawberry\c\libexec\gcc\mingw32\3.4.5\cc1.exe copy C:\strawberry\c\libexec\gcc\mingw32\3.4.5\cc1plus.exe copy C:\strawberry\c\lib\dllcrt1.o copy C:\strawberry\c\lib\dllcrt2.o copy C:\strawberry\c\lib\gcc\mingw32\3.4.5\crtbegin.o copy C:\strawberry\c\lib\gcc\mingw32\3.4.5\crtend.o copy C:\strawberry\c\lib\crt1.o copy C:\strawberry\c\lib\crt2.o
This allows libraries and parrot.exe to build when you finally run "ming32-make". But not everything builds...
It falls apart at the step of trying to build pbc_to_exe.exe because that step builds its own gcc execution command line parameters and assumes all C include files will be in ./include under the build directory.