Platforms/Windows

Version 8 (modified by cotto, 11 years ago)

rework instructions on getting the mscv and mingw environments set up

Windows

Developers working on Windows

Christoph Otto Win7/x86 MinGW/GCC 4.4.3, Windows SDK 7.1
François Perrad Win2000-SP4 MinGW/GCC 3.4.2

Development on Windows

What to download and install

Setting up Microsoft Windows SDK

The free download of Microsoft's Windows SDK doesn't require registration and comes with the C compiler tools needed to build Parrot using a Microsoft toolchain. The latest version (7.1 as of this writing) requires the .Net framework 4.0, which may take some time to download and install. Neither the Windows SDK nor the .Net framework 4.0 require a reboot. You'll need to use the correct shell. This is in the Start Menu under All Programs -> Microsoft Windows SDK -> Windows SDK Command Prompt.

Configuring and Building Parrot (MinGW)

If you want to build with the MinGW toolchain, just install Strawberry Perl and let Configure.pl pick up its defaults from that:

git clone git://github.com/parrot/parrot.git parrot-mingw
cd parrot-mingw
perl Configure.pl
gmake
gmake test

Configuring and Building Parrot (Strawberry/msvc)

Strawberry Perl is community-driven full featured Perl for Windows systems. Parrot's Configure.pl determines compiler options from perl executable. Because Strawberry Perl is compiled with gcc, Parrot's Configure.pl will build with Strawberry Perl's toolchain by default. Use the following arguments to Configure.pl in the Windows SDK command prompr and you should be able to build with msvc.

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"

Now you can run nmake. Enjoy your parrot.exe! Let us know if you have any problems.

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:

  • bzip2
  • gzip
  • unzip
  • tar
  • wget

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:

c:\programs\gnuwin32\bin\gzip.exe

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.

Cygwin

Read README_cygwin.pod first.

Install the following cygwin packages:

  • parrot
  • subversion
  • make
  • gcc
  • 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.

Strawberry Perl

As of January 2009, Parrot 0.9.0 and Strawberry Perl 5.10.0.3 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.