Pike on Windows (VC2015)

[ Start > PikeDevel > Pike on Windows (VC2015) ] [ Edit this Page | Show Page Versions | Show Formatted ]


This build environment uses a Windows virtual machine with a filesystem shared from the build driver system. An example would be a MacOS host running VMWare. 

Prepare the build driver system:

1. create a directory that will contain the files shared between the driver and the build host (for example, /home/myuser/pike_windows).
1. git clone pike repo
1. git checkout -b nt-tools origin/nt-tools
1. copy nt-tools to the shared directory.
1. download and unzip a pike source release tarball in the shared directory (release tarballs avoid the need to precompile cmods, making the build simpler).
1. copy the win32libs directory to the shared directory from another build host
1. Create $HOME/.init_ntrc (note that trailing slashes will cause problems):
{code}
REMOTE_METHOD="sprsh"
NTHOST="192.168.1.102"
NTDRIVE="Z:"
NTPORT=9999
NTMOUNT=/home/myuser/pike_windows
NTLD_LIBRARY_PATH=/home/myuser/pike_windows/win32libs/lib
RNTCL_VC=14
{code}

Create a virtual machine for the windows build host:

1. install windows
1. install pike for windows
1. install vc2015 community edition
1. install git for windows
1. install wix v2 by transferring wix directory from another build system
1. share a directory on the build driver system with the windows host (for example /home/myuser/pike_windows as Z:)
1. run "Visual Studio Command Line"
1. add pike and nt-tools directory to your nt-path
1. add wix2 to path
1. share a folder between the unix "configure" box and the win-nt box.
1. start sprshd on windows box:
{code}
 cd z:/nt-tools/tools 
 pike sprshd  
{code}

At this point, it may be advisable to take a snapshot of the virtual machine so that you can roll back if things go sideways.

__Building Pike__

on build driver box, run nt-tools/init_nt
then, run configure normally:

{code}
CC=rntcl LDFLAGS="-LZ:/win32libs/lib" CPPFLAGS="-IZ:/win32libs/include" CXX=rntcl make
{code}

Getting an error 267 create_process on sprshd can mean that the drive and directory you specify in the configure  - to - build drive mapping isn't right (wrong drive or wrong folder)

When the build completes, you'll need to copy any DLLs for the dependencies you've enabled into the build directory. If you don't, the pike binary won't be able to find them and you'll get errors about modules not loading and such. There's a utility called "Dependency Walker" or "depends.exe" that can help explain what libraries a component is trying to load. 

You should be able to run bin/pike from the build driver host and have the pike binary run on the windows host. If you do this, don't use Control-D to exit hilfe, which will cause the process to hang. Type "exit" instead.

__Building the installer__

Building the Pike MSI installer package requires wix2 installed on the Windows build host. Newer versions of wix are currently incompatible with the installer xml generated by the pike build process. It's almost impossible to find wix2 on the internet, so your best hope is to get a copy from someone else. Ask on the pike devel list and someone should be able to help.

If wix2 is in PATH when you start the build, the necessary tools should automatically be detected and all that is necessary to generate the MSI is to run:

{code}
make wix
{code}

At the end of the process, you should see "Pike.msi" in the build directory.


__Building dependencies__

Some dependencies can be built using rntcl, others may be fetched online, depending on whether they've been compiled with a compatible version of Visual C++. The Shift Media Project provides Visual Studio solutions for a number of common projects. These may be cloned and then built using Visual Studio or msbuild. Note that these projects deposit the build artifacts to a directory called "msvc" on the drive the project is located. You'll need to move the headers and libs to the win32libs folder. Note that some dependencies use the naming format "libwhatever.lib", and in these cases, you will need to remove the leading "lib" in order to conform to the way rntcl and friends expect things to be named.

__Building Nettle using rntcl__

CC=rntcl ./configure --disable-assembler --build=i686-pc-windows_nt

Copy nettle.lib and nettle/*.h to appropriate places in win32libs. 


__Details and Background__

Martin Sternholm was the original "master builder" for Windows. He put together a lengthy and informative document describing the steps involved in preparing a windows build. This document is a must-read for anyone interested in building Pike for Windows themselves.

- http://article.gmane.org/gmane.comp.lang.pike.user/8287

Powered by PikeWiki2

 
gotpike.org | Copyright © 2004 - 2009 | Pike is a trademark of Department of Computer and Information Science, Linköping University