WindowsBuildSetup
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
- Start by installing (or upgrading to) the latest Cygwin distribution. Use the default inclusion for all packages except Devel, for which you should select Installed instead of Default.
- 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)
- If you are planning to use the machine to build a packaged distribution of Eigenbase or LucidDB, also select and install the zip package from the Archivers category
- 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.
- 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).
- Move anything in the home directory to the mirror directory (nothing if you're starting from scratch), leaving the original directory empty.
- Delete the home directory (rmdir /home/jvs).
- Create a symbolic link so that the home directory aliases the mirror directory (ln -s /cygdrive/d/home/jvs /home/jvs).
- 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.
- 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.
- 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.
- 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:
- For 32-bit Windows: MSVC 2008 Express
- For 64-bit Windows: Windows SDK
- The native 32-bit Windows version of cmake (you don't need a different version for 64-bit builds)
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 (if you happened to install it) 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 rem use this for 32-bit call D:\msvc2008\VC\bin\vcvars32.bat rem use this for 64-bit call D:\SDK6\Bin\SetEnv.Cmd /x64 /2003 D: chdir D:\cygwin\bin bash --login -i
When you launch a new Cygwin shell, you should see a message as follows (for a 32-bit build env):
Setting environment for using Microsoft Visual Studio 2008 x86 tools. $
Or this for a 64-bit build env:
Setting SDK environment relative to C:\sdk6. Targeting Windows Server 2003 x64 DEBUG
--Jvs 18:57, 17 April 2009 (EDT): There's probably a way to accomplish the same thing without touching cygwin.bat.
For 64-bit, you may also need to change the Cygwin launch icon's Target property to contain this:
C:\WINDOWS\system32\cmd.exe /k D:\cygwin\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.
- When running Fennel tests, Windows may prompt you for help on running .sh files. Simply point it to your cygwin install location's /bin/bash.
- Kevin's notes When we built for 64bit Windows, there were some interesting errors. Here is a catalog and our quick fixes:
- When the build tries to build fennel, cmake will complain about missing environmental variables for Java include directories. These have to be placed manually in fennel's initBuild.sh with the other -D params for cmake. This also means the build release script shouldn't rm fennel.
- Even if you specify the right directories, it doesn't seem to work and the compilation process will fail at around 95% when it tries to include Java's JNI.h. Our solution was to just copy all the .h files in the JDK's Include folder, including the Include/win32, into fennel/farrago, followed by replacing the actual include directives in the relevant C++ files with local includes.