WindowsBuildSetup

From Eigenpedia

Jump to: navigation, search

This page explains the steps necessary for setting up a Windows machine for use in building Eigenbase C++ and Java code. This is required as part of other build instructions:

NOTE: the Eigenbase build depends on Cygwin for shell scripting and other tools such as flex and bison; however, at runtime, no Cygwin/mingw libraries are needed since Microsoft Visual C++ is used for the compiler (not g++).

Contents

General Instructions

  1. Start by installing (or upgrading to) the latest Cygwin distribution. (TODO: specify packages needed so that people don't have to sledgehammer-install everything.)
    • Note that even though we don't use Cygwin g++ for the Fennel build, it is still needed for the build of the Boost bjam executable (but not the Boost library)
  2. Choose a directory which will contain third-party software and the Farrago build environment. For example, I chose my home directory, /home/jvs, which is on my d: drive (referred to in Windows as d:\cygwin\home\jvs). This will be referred to as the "home" directory.
  3. Create a "mirror" directory outside of the cygwin root on the same drive. For me, this was d:\home\jvs (referred to in Cygwin as /cygdrive/d/home/jvs).
  4. Move anything in the home directory to the mirror directory (nothing if you're starting from scratch), leaving the original directory empty.
  5. Delete the home directory (rmdir /home/jvs).
  6. Create a symbolic link so that the home directory aliases the mirror directory (ln -s /cygdrive/d/home/jvs /home/jvs).
  7. Now, if we ignore the drive letter and slash direction, the path to the home directory looks the same regardless of whether we are running a Cygwin program or a native Windows program (including Java applications such as ant). This means environment variables can be defined just once and used by both environments.
  8. Install the native Windows Perforce client programs, NOT the Cygwin Perforce client. If you need to use both, be sure to set your path in such a way that when you are working on Farrago, you use the Windows client programs. The Cygwin Perforce client seems to get confused by the symlinks.
  9. When you create a Perforce client definition, make sure the client root is under the home directory, without a drive letter (e.g. /home/jvs). Set the LineEnd attribute to share to avoid problems with CRLF, and also set your CYGWIN environment variable to contain the binmode attribute.
  10. Sync the code and you should be ready to follow the rest of the build instructions.

Java Instructions

If you will be building Farrago or dependent projects such as LucidDB, you'll need to install the JDK. You'll also need to apply the "mirror" directory technique above so that the JDK installation is accessible from both Cygwin and Windows programs using the same paths.

For example:

  • JAVA_HOME is set to d:\usr\java\j2sdk (the actual installation location)
  • In Cygwin, /usr/java is a real directory, and /usr/java/j2sdk is a symlink for /cygdrive/d/usr/java/j2sdk

Native Build Instructions

If you will be building Fennel or dependent projects such as LucidDB, you'll need to install additional build tools for native C++ code compilation:

Use simple path names for the installation locations (e.g. d:\msvc2008, d:\CMake); avoid spaces in the path names. It's also a good idea to put everything (Cygwin, cmake, MSVC, Java, and perforce.eigenbase.org sandbox) on the same driver letter to avoid any weirdness there.

In addition, a few more steps are required in order to get the environment ready:

  • Uninstall the Cygwin version of cmake so that it doesn't interfere with the native version
  • Uninstall, delete, or rename the Cygwin programs /bin/mt.exe and /bin/link.exe so that they don't interfere with the MSVC programs of the same name.
    • --Jvs 18:55, 17 April 2009 (EDT): Is there a way to set up PATH so that we're guaranteed to pick up the native versions first? Probably, but I haven't fiddled around with it enough.
  • Edit cygwin\cygwin.bat so that it looks as follows (or create a separate fennel.bat and use that for launching your Cygwin shell instead):
@echo off

call D:\msvc2008\VC\bin\vcvars32.bat

D:
chdir D:\cygwin\bin
bash --login -i

When you launch a new Cygwin shell, you should see a message as follows:

Setting environment for using Microsoft Visual Studio 2008 x86 tools.
$

--Jvs 18:57, 17 April 2009 (EDT): There's probably a way to accomplish the same thing without touching cygwin.bat.

Additional Notes

  • Cygwin sets the PWD environment variable with a Unix path, so the Windows Perforce client can't read it, giving it trouble finding your .p4env file. You can work around this by setting environment variable P4CONFIG to have the Windows path to your .p4env file, e.g. export P4CONFIG=$(cygpath -w "/home/jvs/.p4env"). --Jvs 18:15, 17 April 2009 (EDT): I think this is no longer necessary using the mirror directory approach above; I have never needed it.
Personal tools