Preparing a Windows machine for Bilder

Anonymous David Alexander John R. Cary Roopa Pundaleeka Scott Kruger Anne Hammond Tim Dave Wade-Stein Chris DeLuca Ted Sume

Bilder On Windows (64-bit only)

  • Windows 7/2008: For 64-bit systems, 64-bit applications are stored in C:\Program Files and 32-bit applications are stored in C:\Program Files (x86). UserAccountControlSettings can be fine-tuned (see Control-Panel, System and Security, Action Center). This requires a reboot to take effect! At least for ATLAS, the UAC Settings must be adjusted to "never notify" (this action is generally recommended while taking all the steps below).

Basic Windows Configuration

Warning: In following the directions below, pre-defined env variables like CL, PETSC_DIR,
PETSC_ARCH, and others will cause problems. For example, one user
had CL=/nologo which prevented the version and other info from being
printed and caused bilder to fail.

Editing your system path on Windows

From the Start menu, right click on My Computer and choose Properties. Choose the Advanced Tab, and click the Environment Variables button towards the bottom of the dialog. In System Variables, highlight Path and click Edit. This is where you make changes to your system path.

Ensure that Windows knows its domainname

  • From a command prompt, type the command:

    ipconfig /all
    
    Look for value of the "Primary Dns Suffix" field, which should be your 
    domain name (i.e. txcorp.com).
    
  • If cygwin is already installed,

    ipconfig /all | grep -i "Primary Dns Suffix" | sed -e 's/^.*: //'
    
    should return the domainname. This only applies if it is part of a 
    Windows Domain.
    
  • For Windows 7/Windows 2008 machines that are not a member of the Windows Domain, Active Directory, do the following!:

    1. Right click on My Computer, select properties
    2. Click on Advanced system settings
    3. Select the computer name tab
    4. Click the change button
    5. Click the more button
    6. Enter the Primary DNS suffix. i.e. txcorp.com

Create initial directories

  • Create the folder C:\bin (if not already present).
  • Add or move C:\bin to the front of your system path.


Tools needed by Bilder

Dependency Walker

Dependency Walker shows the DLL's that an executable depends on. This is used to
find and copy-in DLL's to a final distribution.

Make sure you download and install the correct version of dependencywalker for your machine (x86 for x86 machines, x64 for 64bit machines, etc).

Install Dependency Walker into C:\bin.

Blat

Blat is a sendmail client for Windows.

  • Download Blat from The Blat SourceForge Site and extract all files. As of 07/18/2013, this is version 311.
  • Extract the blat311 folder into C:\bin.
  • Copy the C:\bin\blat311\full\blat.{exe,dll} to C:\bin\blat.{exe,dll}
  • Execute the following command in a cygwin terminal
    blat -install mail.txcorp.com <username>@txcorp.com
    


CMake

CMake is a cross-platform build system.

  • Install CMake (a 32-bit application).
    • Version 2.8.6 is required. Later versions work also.
    • Add the CMake path to the front of the system path.
    • When this step is complete, make sure the newest CMake is the only one in your system path.

CYGWIN

Gotchas (in advance)
  • Do not install Cygwin's MinGW. Those are installed in a separate area to reduce conflicts.
  • Do not install Cygwin's rc, or you may get a weird error (/focmTryCompileExec.exe.embed.manifest.res: No such file or directory) about cl being invalid. This can be seen by the output of 'which rc'.
  • Do not install Cygwin's mt. If 'which mt' returns /bin/mt or /usr/bin/mt, then move this aside too.
  • If 'which link' returns /usr/bin/link, then move this aside (mv /usr/bin/link.exe /usr/bin/linkoff.exe) so that it is not picked up to replace the Visual Studio link. (This is where we could define BILDER_LINK.
  • Make sure that 'which find' returns the cygwin version (/usr/bin/find), not the Windows version.
  • Make sure 'which cmd' returns the Windows version. If not, check that your bash_profile has not made an error in setting your path.
  • If you get an error like "ValueError: Symbol table not found" when building numpy, you are somehow using a 32-bit version of objdump. Disable the 32-bit version.
Updating Cygwin
  • Be sure to select the version of subversion that is compatible with any other sister machines being run through jenkins. They must all use the same version of svn, which must be the same version chosen in Jenkins.
  • If you have moved aside any of the interfering commands (e.g. link, mt, rc) in the past and have recently updated cygwin or Windows, then do the 'which' checks again.
  • Recreate the /etc/passwd and /etc/group file again using the mkpasswd and mkgroup commands described in the Configuring Cygwin section.

  • Install Cygwin from here. There are now separate installers for 64 bit (setup-x86_64.exe ) and 32 bit (setup-x86.exe).

  • Upon running setup-*.exe, select the packages:

    • Base -> util-linux
    • Devel -> bison
    • Devel -> flex
    • Devel -> gcc-g++ and gcc-fortran
    • Devel -> git
    • Devel -> make
    • Devel -> mercurial
    • Devel -> patch
    • Devel -> subversion (If you are using jenkins, you should choose the version of subversion that is consistent with svnkit, which Jenkins uses. That is version 1.7 at the time of this writing, Feb. 26, 2014.)
    • Editors -> vim and emacs (and alternate editors of choice)
    • Math -> bc
    • Net -> openssh
    • Python -> python (see note below)
    • Shells -> mintty
    • Utils -> diffutils
    • Utils -> dos2unix
    • Web -> wget
  • Do NOT install any of the mingw packages. If used, they must be installed separately to overcome path issues. (NumPy will not accept the different, distinguishing name for mingw's gcc).

  • Note: PATH should be set such that the Windows python is found before the cygwin python. We need the cygwin python to build PETSc. Once PETSc is cmaked, this requirement will go away.

  • Note: mkshortcut.exe in cygutils 1.4.10-2 is broken, but as of (July 18, 2013 with cygutils version 1.4.12 this is fixed). If the version of mkshortcut.exe that is installed when you run setup.exe doesn't work (i.e. mkshortcut -h segfaults), then go bach to cygwin setup and update your cygutils.
Setting Cygwin Disk Mounts
  • Create the directory winsame at the top level of both the Cygwin and Windows file systems. You must always work in this directory. This is critical for getting the ATLAS linear algebra libraries to build. Do this via:
    mkdir /cygdrive/c/winsame
    mkdir /winsame
    mount C:/winsame /winsame
    

To make this permanent, put

C:/winsame /winsame ntfs binary 0 0

as one line in /etc/fstab.


On Windows-64, additionally put

C:/Program\040Files\040(x86) /ProgramFilesX86 ntfs binary 0 0

as one line in /etc/fstab. This allows one to construct a valid path with no parentheses as needed for ATLAS.

Configuring Cygwin
  • Use a "Cygwin64 Terminal" from basic cygwin installation above to perform all subsequent bask tasks

  • If bilderizing a domain machine, create an /etc/passwd file with the following command

    mkpasswd -l -d -p /winsame > /etc/passwd
    
  • If bilderizing a non-domain machine, create an /etc/passwd file with the following command

    mkpasswd -l -p /winsame > /etc/passwd
    
  • If bilderizing a domain machine, create an /etc/group file with the following command

    mkgroup -l -d > /etc/group
    
  • If bilderizing a non-domain machine, create an /etc/group file with the following command

    mkgroup -l > /etc/group
    
  • Close the terminal and open a new one. You should see that the 'pwd' command shows that you are in a new home area directory: /winsame/<username>. Copy bash profile files from /home to /winsame and delete the previous home area for each user with the commands:

    cp /home/<username>/.* /winsame/<username>/
    rm -rf /home/<username>
    

HPC Pack

HPC Pack provides an implementation of MPI on Windows.

  • Install the HPC Pack 2008 SDK with SP2 from Microsoft from The MS-HPC Download Site.
    • To get this to work with mingw32, do, e.g.,
      mkdir -p /winsame/contrib-mingw32/microsoft-hpc-mingw/; cp -R /cygdrive/c/Program\ Files/Microsoft\ HPC\ Pack\ 2008\ SDK/* /winsame/contrib-mingw32/microsoft-hpc-mingw and then add #include <basetsd.h> as line 305 in /winsame/contrib-mingw32/microsoft-hpc-mingw/Include/mpi.h. See symscape for other information. Refer to Cygwin section for details on winsame directory.
    • Make sure to add C:\Program Files\Microsoft HPC Pack 2008 SDK\Bin to the system path.

MS now provide the newer MPI only pack, ttp://www.microsoft.com/en-us/download/details.aspx?id=44990
for Windows 7 and 9=8.

JOM

JOM is an nmake substitute that allows the -j flag for faster compilation.

  • Create the folder C:\bin (if not already present).
  • Add C:\bin to your system path (if not already there).
  • Download jom.zip from the Qt Project.
  • Extract the contents of jom.zip
  • Move/copy jom.exe to C:\bin (you then can delete the remainder of the contents or keep for historical reasons).


LaTex

If you will be building documentation, then you will need to

  • Install Doxygen.
  • Install Basic MikTeX from MikTeX. Use the MikTeX Package Manager to install breakurl cmap comment courier eepic epstopdf footnote framed gensymb helvetic lineno mmap mptopdf multirow overpic palatino pdftex pifont revtex4 siunitx subfiles symbol threeparttable titlesec txfonts units wrapfig xcite xypic zapfding
  • In MikTex Settings application (start from StartMenu), under the General tab, choose "Yes" for "Install missing packages on-the-fly". This ensures that builds won't hang waiting for user to dismiss install package dialogs.
  • Install ghostscript.


NSIS

NSIS is a scriptable installer maker.

  • Install NSIS from NSIS Download Site.

    • For building CMake 64bit and if you are building the composers, you will need a generator for installer executables, which is NSIS (Nullsoft Scriptable Install System) a professional open source system to create Windows installers.
    • Version 2.46 is available as of Aug 21, 2011.
  • Install NSIS Access Control Plugin from Access Control Plugin Site.

Copies directories and files into the NSIS installation as follows:

AccessControl.zip\Contrib\AccessControl --> NSIS\Contrib\AccessControl
AccessControl.zip\Docs\AccessControl --> NSIS\Docs\AccessControl
AccessControl.zip\Plugins\AccessControl.dll --> NSIS\Plugins\x86-ansi\AccessControl.dll
AccessControl.zip\Unicode\Plugins\AccessControl.dll --> NSIS\Plugins\x86-unicode\AccessControl.dll


Perl

Perl is needed for Qt


Python

  • For VS12, we use a pre-built version of Python which is automatically installed by bilder (into the contrib dir).
  • For VS9, download and install Python 2.7 from the The Python Download Site. Choose the "Windows X86-64 MSI Installer".
    • Add C:\Python27 to the front of your system path. To be safe, make sure you capitalize the "P" in the path.


Subversion

  • Install the CollabNet Subversion Command-Line Client from The CollabNet Download Site.

  • With this, you will have two versions of svn on your machine. One is in /usr/bin under cygwin, and it is used for direct invocation at the bash command-line. The other is in \Program Files, and it is needed for getting repo versions when Bilder is invoked through Jenkins. You can verify this with:

    $ where svn
    C:\cygwin64\bin\svn.exe
    C:\Program Files\CollabNet\Subversion Client\svn.exe
    $ /bin/svn --version | head -n 1
    svn, version 1.7.14 (r1542130)
    $ /cygdrive/c/Program\ Files/CollabNet/Subversion\ Client/svn --version | head -n 1
    svn, version 1.7.18 (r1615261)
    


Visual Studio

  • We recommend VS12 (Visual Studio 2013), but include instructions for VS10 (Visual Studio 2010) as well.

  • Ensure that Visual Studio is not in the system path. (Bilder adds this as needed.)

Compatibility with Python
  • To ensure that your Python is compatible with your version of Visual Studio (C++), install the version of Visual Studio that Python was built with. For Python 2.{6,7}, this is Visual Studio 9 (2008), although we now have a pre-built version of Python 2.7 that was build with Visual Studio 12 (2013).


Useful Tools

Notepad++

  • (Optional) Notepad++ is a free source code editor that is a great tool for Windows.
  • Download from here.
  • Install and pin to your taskbar.


Libraries

OpenSSL

OpenSSL is needed by libssh.

  • Download from here.
  • Choose the Win64 OpenSSL v1.0.1e on 64bit or the Win32 OpenSSL v1.0.1e on 32bit windows.
  • You may have to install Visual C++ 2008 Redistributables if installer complains.
  • During the installation, select "Copy OpenSSL DLLs to: The OpenSSL binaries (/bin) directory"
  • After the installation on 64bit windows, goto C:\Windows\System32 and prepend libssl32.dll, libeay32.dll, and ssleay32.dll with an "OFF." This and the next step are required such that dependency walker finds the SSL libs in from the OpenSSL distro instead of the ones in C:\Windows\System32 such that they get copied into the distribution upon packaging.
  • Add C:\OpenSSL-Win64 or the directory where you installed OpenSSL to the beginning of the system path. In particular, it needs to be in front of the CollabNet path because there is a libeay32.dll in that distribution. A which for the libeay32.dll should give this installed version. For example:
$ which libeay32.dll
/cygdrive/c/OpenSSL-Win64/bin/libeay32.dll


Qt

Qt is needed for VisIt and other packages. We need to build Qt on windows.

  • Make sure no other Qt is in your system path.
  • Get the Qt Libraries (version 4.8.6) from Qt Libraries Download Link. Download qt-opensource-windows-x86-vs2008-4.8.6.exe. Note: Don't be concerned about the vs2008 in the name as we are going to build Qt using the source code in this download so we don't care what version of Visual Studio it was built with.
  • Run this program, selecting C:\winsame\builds-vsXX\winqt\4.8.6 as your installation directory, where XX is the version of your Visual Studio.
  • Patch Qt by opening a Cygwin window:
cd /winsame/builds-vs12/winqt/4.8.6
patch -p1 --binary < /path/to/bilder/patches/qt-4.8.6.patch


Compiling Qt
  • The copy/paste-able commands below assume VS12, but if you are using a different version of Visual Studio, simply change the "set VER=12" and "export VER=12" at the beginning of each stanza to your version.

In a Visual Studio x64 DOS window:

set VER=12
set SFX=vs%VER%
cd C:\winsame\builds-%SFX%\winqt\4.8.6
configure.exe -prefix C:\winsame\contrib-%SFX%\qt-4.8.6-sersh -debug-and-release -opensource -confirm-license -fast -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-tds -no-libtiff -webkit -declarative

(NOTE: If you are building with Visual Studio 2008, then you'll need to add the following arguments to the above command: -platform win32-msvc2008)

In a bash window launched from the previous DOS window (try 'C:\cygwin64\bin\mintty -', note that the dash is important!), execute the following (changing vsver to your version)

export VER=12
export SFX=vs${VER}
cd /winsame/builds-${SFX}/winqt/4.8.6
mkdir -p /winsame/contrib-${SFX}/qt-4.8.6-sersh
cp -R mkspecs /winsame/contrib-${SFX}/qt-4.8.6-sersh
cd /winsame/contrib-${SFX}
ln -s qt-4.8.6-sersh qt-sersh
mkshortcut.exe -n qt-sersh.lnk qt-4.8.6-sersh

In the Visual Studio x64 DOS window

set VER=12
set SFX=vs%VER%
cd C:\winsame\builds-%SFX%\winqt\4.8.6 
set PATH=%PATH%;C:\winsame\builds-%SFX%\winqt\4.8.6\bin
nmake         # Took 3.5 hours on a 2.3 GHz Core2 Duo with Solid State Drive
nmake install # Took 10 minutes on a 2.3 GHZ Core2 Duo with Solid State Drive
  • If you want to use this qt outside of Bilder, add C:\winsame\contrib-%SFX%\qt-4.8.6-sersh\bin to the system path variable. This may not work if you have more than one Bilder run.

In the bash window, then execute

/path/to//bilder/setinstald.sh -i /winsame/contrib-$SFX qt,sersh


Experimental Tools and Libraries

These tools have not been fully vetted or built, so you need not do these.

MinGW

See [Installing MinGW].


ATLAS

See [Installing ATLAS on Windows].


Cygwin and Paths

(This section assumes that the user is familiar with the relations between Cygwin and Windows paths.)

The path is critical for when there are conflicting executables. There are two particular cases, svn and python, where one has both a Windows version and a Cygwin version, and one must select between them.

Path to Python

In the case of python, one nearly always needs the Windows python. Hence we put C:\Python26 early in the Windows path. Cygwin puts /usr/local/bin:/usr/bin at the very front of the user's path. This would select the Cygwin python, which is not desired. So then Bilder moves /usr/bin to just after Python. Thus, a user who wants /usr/bin/python must refer to it by its full path. For example, in a bash shell, one can run /usr/bin/python interactively, but to run C:\Python26 interactively, one must be in a DOS shell.

A user wanting to have this PATH organization can put the fragment

if [[ `uname` =~ CYGWIN ]]; then
  if echo $PATH | grep -q :/usr/bin:/bin: ; then
    ubp=/usr/bin:/bin
  else
    ubp=/usr/bin
  fi
  mvaft=$ubp
# Move /usr/bin last to find any other python first
  PATH_SAV="$PATH"
  PATH=`echo $PATH | sed -e 's?/usr/bin??'`:/usr/bin
  pythonexec=`which python`
  aftloc=
  if echo $pythonexec | egrep -q "(p|P)ython2(6|7)"; then
    aftloc=`dirname $pythonexec`
  fi
# Do the move if python found in Windows area
  if test -n "$aftloc"; then
    PATH=`echo $PATH_SAV | sed -e "s?:$mvaft:?:?" -e "s?:$aftloc:?:$aftloc:$mvaft:?"`
  else
    PATH="$PATH_SAV"
  fi
fi

into the bash_profile.

Because Bilder is written to work on Linux and OS X, for executables (like sort) that are in both /usr/bin and C:\Windows\system32, Bilder wants the executable in /usr/bin most of the time. Therefore, C:\Windows\system32 should be after C:\Python26 in the Windows path, and then /usr/bin will end up before /cygdrive/c/Windows/system32 in the Cygwin path.

As a result of Bilder's move of /usr/bin to after the Windows Python path, the relative location of any package to Windows Python in the path determines whether its executables take priority over any identically named executables in /usr/bin. A package whose path is put before C:\Python26 takes priority, but the executables of a package whose path is put after C:\Python26 will be superceded by any identically named executables in /usr/bin.

Path to Subversion

The cygwin and Windows versions of svn are incompatible due to line endings, so care must be taken as to which is used at what time.

The path to the Windows Subversion should go after the path to Windows Python. This allows ordinary users to checkout a project using /usr/bin/svn and never worry about the Windows version of svn.

The path to the installed OpenSSL needs to be in front of the path to Subversion because during the copying in of OpenSSL libraries depends needs to find the ones in the OpenSSL installation not the Subversion installation.

Usage under Jenkins

Jenkins uses svnkit, which is compatible with the Windows version of Subversion of the same version number. So for jenkins usage, one must have the same version of svn installed across all slaves, and when Bilder runs under Jenkins, it must be sure to use the Windows version of svn. There are two methods for doing this. First, bilder/jenkins/jenkinsbild defines the environment variables, BILDER_SVN, BILDER_SVNDIR, and BLDR_SVNVERSION, which hold the correct executables to be used by Bilder. However, in the configuration of some packages, notably VisIT in visit.sh, the path is used to find svn, and this gives the wrong executable. For these cases, the path is modified just before configuration.

Summary

  • Bilder moves /usr/bin to just after the Python path and therefore to before
    /cygdrive/c/Windows/system32.
  • Put the Windows Subversion path behind the Python path (and so behind /usr/bin).
    • /usr/bin must be removed from the path when configuring some packages in order to get the correct subversion when building under Jenkins.


Bilder machine files for cygwin

The Bilder machine files for cygwin are cygwin.vs9, cygwin.vs10, cygwin.vs11, cygwin.vs12. These are located in bilder/machines. These are sourced by bilder using the -m option. They augment PATH and set the values of the INCLUDE, LIB, and LIBPATH variables.

In case of problems, one should check that the values of these were set correctly. This is done by starting up the Visual Studio Command Prompt, then starting rxvt as noted above. The values for or additions to these variables should agree with how they are being set or modified by the cygwin machine files.


Signing Installers

  • The Microsoft Signtool comes with Visual Studio, however, one must install a code-signing certificate. This process is site-specific so please see your system administrator.
  • Contrary to what signtool says, the capicom dll must be copied from C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin to C:\Windows\System32 and must be registered by typing the following at a Command Prompt run as Administrator:
cd C:\Windows\System32
REGSVR32 capicom.dll


Notes For Development

[Notes on developing with Visual Studio and bilder]
[Notes on debugging Windows executables]
[Notes on deleting directories and files owned by other users]

Back:

[Preparing a Darwin machine for Bilder]


Related

Wiki: Installing ATLAS on Windows
Wiki: Installing MinGW
Wiki: Notes on debugging Windows executables
Wiki: Notes on deleting directories and files owned by other users
Wiki: Notes on developing with Visual Studio and bilder
Wiki: Preparing a Darwin machine for Bilder
Wiki: Preparing a Linux machine for Bilder
Wiki: Preparing your machine for Bilder

Discussion

  • Ted Sume

    Ted Sume - 2013-12-30

    ..

     
  • Ted Sume

    Ted Sume - 2014-03-12

    .

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks