{section: Overview} -The instructions on building Condor in releases prior to 7.5.5, see "Building Condor prior to 7.5.5" below. For instructions to build more recent versions, read on. +The instructions on building Condor in releases prior to 7.5.5, see {wiki: BuildingCondorPriorToCmakeOnWindows Building Condor prior to 7.5.5}. -{section: Building Condor with cmake} +For information about the conversion of the build process from project files to cmake see {wiki: BuildModernization} -For now, the instructions for doing this are here: {wiki: BuildModernization} +{section: Prerequisites } -{section: Building Condor prior to 7.5.5} +In order to build Condor on Windows, the following prerequisites are required. They need to be in the PATH before you can build. There is a batch file =msconfig\set_build_env.bat= in the condor sources that will locate the installed prerequisites and set the PATH for you if you don't wish to add them to your global PATH. -<html><h2> Requirements </h2></html> +1: Cmake 2.8.3 or later, the =Cmake\bin= directory should be added your PATH. +*::http://www.cmake.org/cmake/resources/software.html -*: Active-State Perl -*: Microsoft Visual Studio 2008 Edition + SP1 -*: Microsoft Windows Server 2003 SP1 Platform SDK +2: Install Visual Studio. Add it to your PATH. +*::Visual Studio Express (Free to anyone) https://www.microsoft.com/express/Downloads/ +*::Visual Studio 2008. Paid. +*::: UW Madison staff can use MSDNAA: http://msdn04.e-academy.com/wiscmad_cs ; contact the CSL lab for an account if you don't have one. You'll get a .img file of the DVD. You can use 7-zip to extract the contents and install from there instead of burning a DVD or installing DVD emulation software. -*NOTE:* The *Platform SDK's* version is _very_ important. This is the latest version that both supports Windows 2000 and does not play silly tricks with the registry. As for *Microsoft Visual Studio Team System 2008*, only select the x86 compiler (which is the default); otherwise, some of the environment scripts will not be written correctly (on Vista, anyway; I haven't tested this on other platforms). Not sure why this happens exactly; but if you do select the other options, the Microsoft .NET Platform directory is exported incorrectly to the environment (maybe I'll get around to reporting this to them at some point). The problem is that our command-line build depends on a tool shipped with the Microsoft .NET Platform: =msbuild.exe=. It's a glorified version of =make= that uses XML as it's input. What's nice about it is that it will build the project directly, rather than manually exporting =Makefiles= for consumption, as was previously required. +3: [Optional] Start Visual Studio and Open Tools->Options under "Projects and Solutions" click on VC++ Directories and add the following to the *Executable* directories. This is not needed if you use =msconfig\set_build_env.bat= to set the PATH before you build. +*::$(SolutionDir)\msconfig +*::Move $(PATH) to the bottom as sometimes C:\cygwin\bin is in the $(PATH) which can cause issues with condor's bundled binaries. -<html><h2> Installation </h2></html> +3: Install Active Perl. Add it to your PATH. +*::http://www.activestate.com/activeperl/downloads -*: Install all the packages listed above to their default destinations, as some of our scripts are reliant on these locations. We do take great efforts to avoid hard-coded paths; however, some things cannot be fully auto-detected at present (sorry, but that is the state-of-the-art right now). -*: The order in which you install them is also important; for instance, a *Visual Studio Service Pack* should be installed _after_ *Visual Studio* is installed. Also, for proper integration, the *Platform SDKs* should be installed _after_ *Visual Studio* has completed its installation, so that it will integrate gracefully with the software. +4: Install the .NET 2.0 redistributable (Should only be necessary on Windows XP and earlier) +*::https://www.microsoft.com/downloads/en/details.aspx?FamilyID=0856eacb-4362-4b0d-8edd-aab15c5e04f5&displaylang=en -<html><h3> Microsoft Visual Studio Team System 2008 </h3></html> +5: Install the Windows Platform SDK. (may depend on .NET 2.0). Any version of the Platform SDK should be fine. SDK 6.1 and 7.0 are both known to work. +*::http://msdn.microsoft.com/en-us/windows/bb980924 -You can get away with the default installation, but it does have a large disk foot-print. If disk space is at a premium, then the following features can be removed from a *Custom* installation: +1: [Optional but Recommended] Install 7-zip. Add it to your PATH. 7-zip is not needed to build, but it is needed to make the condor .ZIP file. You will not be able to build the PACKAGE target witout 7-zip. +*::http://www.7-zip.org/download.html -*: Visual C# -*: Visual Basic -*: Visual Web Developer -*: Dotfuscator Community Edition -*: Unit Testing Tools -*: Microsoft SQL Server 2005 Express Edition (x86) -*: Crystal Reports Basic for Visual Studio 2008 +1: [Optional] install git and add it to your PATH, git is one way to get the Condor sources. It is not needed if you already have the sources. +*::http://git-scm.com/download -Do, however, make sure to keep the *Redistributable Merge Modules*, as the installer (the MSI) will use these to install the correct runtime libraries in the appropriate location. +6: [Optional] Install WiX 3.0 on your windows machine (Depends on Visual Studio). WiX is not needed to build, but it is needed to create the MSI installer. +*::http://wix.codeplex.com/ -<html><h2> Configuration </h2></html> +{section: Building Condor with cmake on Windows} -<html><h3> Microsoft Windows Server 2003 SP1 Platform SDK </h3></html> +1.) Open a windows commmand prompt -If you are building Condor on an x64 machine then after installing the Platform SDKs, you will either need to move or copy them to +2.) Checkout origin/master from the git repository, or download the Condor Sources http://www.cs.wisc.edu/condor/downloads-v2/download.pl - C:\Program Files +3.) navigate to CONDOR_SRC -Instead of the default =C:\Program Files (x86)= destination. This move is required because the configuration scripts that are shipped with the SDKs, which we depend upon, have the =C:\Program Files= path hard-coded in them, while the installer does not. +4.) add cmake\bin to your PATH if it is not already. One way to do this is to execute =CONDOR_SRC\msconfig\set_build_env.bat=. This will setup PATH, LIB, and INCLUDE environment variables to build Condor. If this batch file cannot find cmake.exe It will report an error. -<html><h3> Visual Studio 2008: Build and Run </h3></html> +5.) [Optional] set the environment variable =CONDOR_BLD_EXTERNAL_STAGE= to the path of the externals cache to use cached externals. Using cached externals can save a lot of time if you plan to build condor repeatedly. +{code} +set CONDOR_BLD_EXTERNAL_STAGE=c:\scratch\condor_externals +{endcode} -Parallel builds should be disabled (*these can actually be used now, Ben Burnett [2009-07-10]*). As much as we would love to support building projects in parallel, the constraints of current code-base will not allow for it. By default, Visual Studio is configured to build _x_ number of projects in parallel, where _x_ is the number of physical CPUs or cores you have on the machine; you will need to disable this feature before being able to successfully build Condor. These changes can be made as follows: +6.) The cmake files support both in-source and out-of-source builds. For in-source builds execute +{code} +cmake -G "Visual Studio 9 2008" . +{endcode} +for out-of-source builds, navigate to the build destination folder and execute cmake; passing it the path to the condor sources. +{code} +set _condor_sources=%CD% +md c:\scratch\condor\build_dest +cd /d c:\scratch\condor\build_dest +cmake CMakeLists.txt -G "Visual Studio 9 2008" %_condor_sources% +{endcode} +running cmake will create Visual Studio project and solution files. +Many options can be passed to cmake, see CondorCmakeBuildOptions for more information. or use the cmake-gui. -1: From the *Tools* menu, select *Options...* -1: In the *Options* dialog, expand *Project and Solutions*, and select *Build and Run* -1: On the right hand side, set the *maximum number of parallel project builds* to *1*. +6.) execute +{code} +devenv condor.sln /Rebuild RelWithDebInfo /project ALL_BUILD +{endcode} +or +{code} +msbuild condor.sln +{endcode} +or +{code} +start condor.sln +{endcode} +This last command will open the condor.sln file in Visual Studio. You can then build interactively. -This setting is stored persistently and not in the user configuration files; therefore, you will only need to be done once per user. +{section: Installing} +There is a cmake file that will copy the build products to a destination, this can be used to overwrite an existing Condor install. On a clean system that does not already have Condor installer, you must use the MSI installer to install Condor. -<html><h4> Some Background </h4></html> +{code} +cmake -DCMAKE_INSTALL_PREFIX:PATH=c:\condor -P cmake_install.cmake +{endcode} -The reason why we don't support building projects in parallel is not because we can't, nor because Visual Studio does not respect inter-project dependencies; in fact, it's quite the opposite: Visual Studio does a great job of observing project dependencies; unfortunately, however, our code currently depends on two pre-compiled headers, which are not fully independent; meaning that one may finish before the other is done and destroy the rest of the build process. Why two, you ask? Well, one is for the C++ code, while the other is for the C code. We could, in theory, support parallel builds, if we went without pre-compiled headers; however, the performance gain from parallelism may not out-way that of the compile-time speed-up that the existing pre-compiled headers already do. The other option would be to force the two projects to build first, before building anything else in parallel--but I'm not sure that this is feasible. Further testing and benchmarking would be required to determine any gains anyway. -<html><h3> Environment </h3></html> +{section: Testing} +The code has been restructured so *all* things test related are bundled under a single target, and all binaries relating to that target set their output to condor_tests. -<html><h3> NMI </h4></html> +Build the *tests* target in the Condor.sln Solution File. Once built you can run all the batch tests as before. -<html><h4> NMI user account </h3></html> +{section: Packaging} -In NMI, the test lab we use here, you will also need to create a user account from which we will derive the slot user profiles from. This is a fairly simple process, but for compleatness, the steps are included. +Execute the do_wix.bat file in etc\WiX -For details on creating the template account Condor, please refer to WindowsUserProfiles. -<html><h4> NMI Cygwin install </h3></html> +{section: Gotchas} +{subsection: SDK corruption of VC setup} +Installation of the new Microsoft SDK (6.1 aka Server 2008) can leave an existing VC 9.0 installation with a corrupted setup bat file. After installing the SDK, check the contents of =C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat= {linebreak}If you see the lines: -*: You must be on the nmi private network to access the nmi cygwin mirror -*: get http://cfengine/mirror/nmi_cygwin/setup.exe -*: next, install from internet, root is C:\cygwin, packages dir is C:\cygwin\packages -*: direct connection, add mirror http://cfengine/mirror/nmi_cygwin -*: ensure view is on "Category", click thing next to All to set to "install" (install ALL packages), click next -*: answer "no" to any "try again?" messages +{code} +@SET FrameworkDir=Framework32 +@SET FrameworkVersion=v2.0.50727 +{endcode} +change them to: +{code} +@SET FrameworkDir=C:\Windows\Microsoft.NET\Framework +@SET FrameworkVersion=v2.0.50727 +@SET Framework35Version=v3.5 +{endcode} -<html><h4> NMI Miscellaneous config </h3></html> +Also, a portion of the PATH variable may have an incorrect entry which can lead to problems in the CMD interpreter. If in the same file you see a PATH entry like: +{code} +%FrameworkDir%\%Framework35Version%\Microsoft .NET Framework 3.5 (Pre-Release Version); +{endcode} +change it to point to the correct version like: +{code} +%FrameworkDir%\%Framework35Version%\Microsoft .NET Framework 3.5 SP1; +{endcode} -*: Right click My computer -> remote -> allow users to connect remotely +{subsection: Environment variable expansion} +The new =SetEnv.cmd= shipped in the 6.1 SDK requires that both command extensions and environment variable expansion be turned on. Either use the "CMD Shell" shortcut installed with the Windows SDK or ensure that CMD is launch with the /V:ON and /E:ON parameters. For example: +{code} +CMD /V:ON /E:ON +{endcode} -<html><h4> Command Prompt </h4></html> +{section: Links} -*: Right-click your *Command Prompt* shortcut, select Properties > Advanced... > Check *Run as administrator* -*: Click *OK* +{link: http://www.cmake.org/cmake/help/documentation.html CMake Official Documentation} -<html><h4> Visual Studio </h4></html> - -*: Right-click your *Visual Studio* shortcut, select Properties > Advanced... > Check *Run as administrator* -*: Click *OK* - -<html><h3> <code>gsoap.mak</code> Eccentricities </h3></html> - -A temporary directory has been hard-coded into =gsoap.mak= (i.e. *C:\Temp*). The presence of this directory is required for Condor to compile. This will be changed for future releases. - -<html><h2> Building </h2></html> - -You can build Condor one of two ways: from the command-line, or from the IDE. Both require that you be in =C:\workspace\source\msbuild= directory. See GitingTheCode for further details on getting the source. - -<html><h3> From the Command-line </h3></html> - -1: Run *make.bat*; -1: Ignore the compiler warnings, they are mostly innocuous and likely to disappear in upcoming releases; -1: If there are any *errors*, please reffer to the *Trouble Shooting* sub-section bellow. - -<html><h3> From the IDE </h3></html> - -1: Run *run_msdev.bat*; -1: Ensure the *Release* "Solution Configuration" is selected (*Debug* is the default); -1: From the *Project* menu, select *Build Solution*; -1: Ignore the compiler warnings, they are mostly innocuous and likely to disappear in subsequent releases; -1: If there are any *errors*, please refer to the *Trouble Shooting* sub-section bellow. - -<html><h2> Customizing the debugger's variable value view </h2></html> - -You can customize how Visual C++ displays classes in the variable view. By default VC++ displays "{...}" and you need to click the small '+' icon to expand the members. You can change this behaviour, and make Visual C++ display whatever data member you want, in whatever order and in whatever format you like. - -You need to locate a file called =AUTOEXP.DAT= in your Visual C++ installation. By default it will be: - -VC++ 6.0: - - C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin\AUTOEXP.DAT - -VC++ 9.0: - - C:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger\autoexp.dat - -After you have made the changes and saved the file, you will need to restart Visual C++ for the changes to take effect. - -<html><h2> Trouble Shooting </h2></html> - -In some rare cases the local computer's environment may interfere with building Condor: most of the time this is due to an incompatibility in SDK versions. By default, newer versions of *Visual Studio* install the, at the time, up-to-date SDKs. This is usually found in the *%ProgramFiles%\Microsoft SDKs* folder. If there is a problem when running the build scripts, this is likely the culprit. It also contains the same configuring scripts that the *Platform SDKs* do; however, they do not support Windows 2000. A sure sign that this is incorrectly configured is easy to diagnose: the scripts have the name, but take different command-line options, so you will see an error after running =set_env.bat=. You can remedy this by renaming *%ProgramFiles%\Microsoft SDKs* to something else while developing or compiling the Condor software. This will not be a problem when Condor drops support for *Windows 2000*. - -Put shortly, if you do not see the following two lines in the build output: - - Setting environment for using Microsoft Visual Studio 2008 x86 tools. - Targeting Windows 2000 and IE 5.0 RETAIL - -Then there is most certainly a problem. - -That said, and paradoxical as it may sound, a build _can_ succeed with this directory intact. It all hinges on the order in which you install the software packages. That's why we stressed the order in which you install the software packages above. If, by chance, it happens to work for you in another order, then consider yourself lucky; having tried several, this seems to be the most dependable procedure. - -<html><h2> Packaging </h2></html> - -If you wish to package up Condor the way we do on our web page (as a self-contained MSI installer file and a ZIP file), then follow these instructions. - -<html><h3> Packaging a build from source code </h3></html> -Starting from the source directory, here is an example of the commands you would enter: -1: mkdir c:\temp\condor-7.5.2 -1: cd msconfig -1: dorelease.bat c:\temp\condor-7.5.2 -1: dopackaging.bat c:\temp\condor-7.5.2 c:\temp -1: After about 15 minutes, =condor-7.5.2-winnt50-x86.msi= and =condor-7.5.2-winnt50-x86.zip= will waiting for you in =c:\temp= - -<html><h3> Packaging a build from NMI </h3></html> -Packaging a build from NMI is very similar to packaging a build from source, except the binaries we want to package will be coming out of tar file from NMI instead of being produced by the dorelease.bat script as shown above. Even though you are not actually building the binaries on the packaging machine, it still needs to be setup as if it were a build machine as documented above (to be certain all the proper tools needed for packaging are installed). -1: Download results.tar from NMI for platform _winnt_ from a given build id. -1: Untar into subdir c:\temp -1: move c:\temp\public c:\temp\condor-v7.5.2 -1: rmdir c:\temp\condor-v7.5.2\testbin -1: rmdir c:\temp\condor-v7.5.2\logs -1: git checkout V7_5_2 _(note: you need to checkout from git the same version of Condor that NMI built, as the packaging scripts and directives themselves are only found in the source code and not in the results.tar file)_ -1: cd CONDOR_SRC\msconfig -1: dopackaging.bat c:\temp\condor-7.5.2 c:\temp -1: After about 15 minutes, =condor-7.5.2-winnt50-x86.msi= and =condor-7.5.2-winnt50-x86.zip= will waiting for you in =c:\temp= +{link: http://www.google.com/codesearch Google Code Search for open source examples}