Project

General

Profile

Actions

Preparing a Windows machine for Bilder » History » Revision 108

« Previous | Revision 108/175 (diff) | Next »
Benjamin Cowan, 06/16/2018 04:02 PM
TortoiseSVN link.


Preparing a Windows machine for Bilder (64-bit only)

For building on Windows 10 in Ubuntu, follow the Linux Bilder setup instructions.

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). Set Control Setting to the lowest setting (never notify) to avoid unwanted dialog boxes. 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.

If your machine is on a Windows Domain (as compared to a WORKGROUP), then ensure that Windows knows its domainname

If your machine is on a Windows Domain, then Bilder can set a common variable that makes sense in that Domain. If you are not on a Windows Domain, then Bilder will still work fine (except for maybe emailing). To ensure Windows knows its domainname to the following.

  • From a command prompt, type the command:
ipconfig /all

Look for the 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.

  • 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.

What is "Required" for Bilder

What is absolutely required for Bilder depends on what you are trying to build. For example, if you are only building user documentation, then you only need

  • Blat (for emailing yourself)
  • Cygwin (for bash shell)
  • CMake from an installer
  • Python from an installer
  • Latex (MikTek below)
  • Visual Studio Express (for nmake)

and then you can add the arguments, -W python,cmake, and your installed Python and CMake will be used if your path is correct.

If you are building through Qt5,

  • 2017-15.4.5 (the particular revision for building QtWebEngine). If not building Qt5, but using it, then at least need VS2015 or VS2017.
  • Windows 10 or Windows 10 SDK

Unfortunately, VS2015 and later have a different way have handling certain functions, as discussed at https://stackoverflow.com/questions/30412951/unresolved-external-symbol-imp-fprintf-and-imp-iob-func-sdl2, and so one has to build many packages, such as OpenSSL.

Below is a list of the Tools and Libraries that are most often needed.

Tools (Required for most common builds within Bilder)

Blat

Blat is a sendmail client for Windows needed to send emails.

  • 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 needed to configure many of necessary packages.

  • Install CMake (a 32-bit application).
    • Version 3.1 or higher is required. Picking a later version is better because it will allow bilder to build future versions of cmake.
    • Add the CMake path to the front of the system path! (Needed to build newer 64 bit versions through Bilder)
    • When this step is complete, make sure the newest CMake is the only one in your system path.

CYGWIN

Cygwin is a Unix shell program for Windows and is needed to run the bash code of Bilder.

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 (4.9.3 does not compile sqlite, so choose 4.9.2)
    • Devel -> git
    • Devel -> make
    • Devel -> mercurial
    • Devel -> patch
    • Devel -> subversion (If this machine will be a Jenkins slave, the version of subversion that is consistent with the Jenkins master's svnkit should be chosen. The latest version supported by svnkit is 1.8.14 at the time, Dec. 31, 2016, of this writing.)
    • Editors -> vim and emacs (and alternate editors of choice)
    • Math -> bc
    • Net -> openssh
    • Net -> curl
    • 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 bash tasks

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

mkpasswd -l -d -p /winsame > /etc/passwd
  • Add a single domain user to an already created /etc/password:
mkpasswd -l -d -u {username} -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/. 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>

Dependency Walker

Dependency Walker shows the DLL's that an executable depends on and is needed to find and copy-in DLLs 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.

JOM

JOM is an nmake wrapper needed to give the -j flag capability of Unix make 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

LaTeX is a typesetting tool needed for building PDF files for user documentation.

MPI

MPI is a message passing interface for parallel code that is needed for some computation engines.

Download Microsoft MPI v8.1.1 from:

https://www.microsoft.com/en-us/download/details.aspx?id=55991

The binaries (e.g., mpiexec) are obtained by installing msmpisetup.exe.

The libraries (msmpi.lib) are obtained by installing msmpisdk.msi.

The installers will put mpiexec in your path and define the environment variables,

MSMPI_INC
MSMPI_BIN
MSMPI_LIB32
MSMPI_LIB64

which are used by CMake, e.g., to find the needed components of MSMPI.

Perl (required to build OpenSSL, therefore CMake)

Perl is a programming language needed by some packages such as Qt

Python

Python is a programming language needed by many packages. Namely, any Python module needs Python to be installed.

  • As of VS12, bilder builds Python from a checkout of a git repo and no longer needs to be installed by hand. No PATH changes are needed either.

RCEDIT

Ruby (required to build Qt5)

Subversion

  • Subversion is a revision control tool needed by bilder, for example, to know when packages are out of date.*

  • Install TortoiseSVN with its command line tools.

  • 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. As of this writing, 1.9 is recommended (1.8 will also work, but lower versions will not).

$ where svn
C:\cygwin64\bin\svn.exe
C:\PROGRAM FILES\TORTOISESVN\bin\svn.exe
$ /usr/bin/svn --version | head -1
svn, version 1.9.7 (r1800392)
$ /cygdrive/c/Program\ Files/TortoiseSVN/bin/svn --version | head -n 1
svn, version 1.9.7 (r1800392)

Visual Studio

Visual Studio contains the Microsoft command-line compiler (cl) used by packages with C/C++ code.

  • Bilder works with VS12 (Visual Studio 2013). Since code is moving to C++11 standards, VS12 is required. We recommend you remove older versions of VS such as VS10 and VS9.

  • Install the latest update for Visual Studio. Open Visual Studio application. Going to Help -> About Microsoft Visual Studio, should show you the update version installed. As of July 2015 it is as Update 5. To update go to Visual Studio Update Download.

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

Compatibility with Python

  • Python is built by Bilder.

Compatibility with CUDA 9.1

Libraries (Required for most builds with Bilder)

OpenSSL

OpenSSL is a security library needed by Python to build the SSL module, by cmake, libssh, and by Qt.
*We no longer install OpenSSL on Windows, as Bilder builds it to be consistent with the compiler in use."

Legacy instructions.

  • Download from http://slproweb.com/products/Win32OpenSSL.html
  • Choose the Win64 OpenSSL v1.0.2n (not Light) on 64bit or the Win32 OpenSSL v1.0.2n on 32bit windows.
  • The 1.1 series DOES NOT WORK with either libssh or Qt.
  • You may have to install Visual C++ Redistributables if the 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", if these files exist. This and the next step are required so that dependency walker finds the SSL libs from the OpenSSL distro instead of the ones in C:\Windows\System32.
  • Add C:\OpenSSL-Win64 (in some cases, we have seen that C:\OpenSSL-Win64\bin should be added instead) 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 and the Intel client path, because both contain libeay32.dll. A which for the libeay32.dll should give this installed version. For example:
which libeay32.dll
/cygdrive/c/OpenSSL-Win64/bin/libeay32.dll
  • If built software has unexplained crashes, recheck the above command results.

Qt

Qt is a cross-platform GUI library needed to build packages that have Qt-based user interfaces.

Either Qt4 or Qt5 (or both) can be added.

Building and Installing Qt4

  • Make sure no other Qt is in your system path.
  • Get the Qt Libraries from http://download.qt.io/official_releases/qt/4.8/4.8.7/. Download qt-opensource-windows-x86-vs2010-4.8.7.exe. (The vs2010 in the name is irrelevant as we will build Qt using the source code in this download.)
  • Run this program, selecting C:\winsame\builds-vsXX\winqt<version> as your installation directory, where XX is the version of your Visual Studio.
  • If 4.8.7, patch Qt by opening a Cygwin window:
cd /winsame/builds-vs12/winqt/4.8.7

To build with VS2017, you may need to patch. For this you will need python with the patch module installed, which you can obtain by running composerall, e.g., with target, python. Then do

python -m patch /path/to/bilder/patches/02-fix_build_with_msvc2015-45e8f4ee.diff

Compiling Qt4

  • The copy/paste-able commands below assume VS12.

In a Visual Studio x64 DOS window:

set VER=12
REM could be 2017
set SUBDIR=qt4
REM or whatever is desired, e.g., qar\qt4 for jenkins
set SFX=vs%VER%
set QTVER=4.8.7
set CONTRIB_DIR=C:\winsame\%SUBDIR%\contrib-%SFX%

Modify the last line as needed, e.g., different drive or subdir.

Set the platform args according to your compiler.

For VS2013 (VS12).

set PLATFORM_ARGS=-platform win32-msvc2013

For VS2015 or VS2017:

set PLATFORM_ARGS=-platform win32-msvc2015

Then

cd C:\winsame\builds-%SFX%\winqt\%QTVER%
configure.exe -prefix %CONTRIB_DIR%\qt-%QTVER%-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 %PLATFORM_ARGS%

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 # or 2017
export SFX=vs${VER}
cd /winsame/builds-${SFX}/winqt/4.8.7
SUBDIR=qt4 # Or whatever desired, e.g., qar/qt4
export CONTRIB_DIR=/winsame/$SUBDIR/contrib-${SFX}
mkdir -p ${CONTRIB_DIR}/qt-4.8.7-sersh
cp -R mkspecs ${CONTRIB_DIR}/qt-4.8.7-sersh
cd ${CONTRIB_DIR}
ln -s qt-4.8.7-sersh qt-sersh
mkshortcut.exe -n qt-sersh.lnk qt-4.8.7-sersh

Back in the Visual Studio x64 DOS window

cd C:\winsame\builds-%SFX%\winqt\4.8.7 
set PATH=%PATH%;C:\winsame\builds-%SFX%\winqt\4.8.7\bin
nmake
REM Took 3.5 hours on a 2.3 GHz Core2 Duo with Solid State Drive
nmake install
REM 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.7-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

env QT_BLDRVERSION=4.8.7 /path/to//bilder/setinstald.sh -i $CONTRIB_DIR qt,sersh

Installing Qt5

These instructions are how to install the pre-built version of Qt 5 (version 5.10.0 ). You can skip creating the Qt account.

Building Qt5

We are not building Qt5 at this time, but some legacy instructions are below.

Compiling Qt5

  • Make sure no other Qt is in your system path.
  • The copy/paste-able commands below assume VS2017.

In a Visual Studio x64 DOS window:

set VER=2017
set SFX=vs%VER%
set QTVER=5.10.0
set CONTRIB_DIR=C:\winsame\contrib-%SFX%
set CONTRIB_DIR

Examine the output of the last command to make sure you have the supra-installation directory correct.

cd C:\winsame\builds-%SFX%\winqt\%QTVER%\%QTVER%\Src
configure.bat -prefix %CONTRIB_DIR%\qt-%QTVER%-sersh -opensource -confirm-license -release -shared -opengl desktop -no-separate-debug-info -developer-build -make-tool jom -make libs -make tools -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-libjpeg -no-qml-debug -no-dbus -no-incredibuild-xge -no-directwrite -nomake examples -nomake tests -skip qtandroidextras -skip qtdoc -skip qtlocation -skip qtscript -skip qtserialbus -skip qtserialport -skip qtsensors -skip qtwayland -skip qtspeech
jom         # Took 45 minutes on a 4-core i7
jom install # Took 8 minutes on a 4-core i7

Check that your installation contains Qt5WebEngine.

Check whether the following changes are needed.

$ diff QtGui QtGui.orig
55c55
< // #include "qopenglextrafunctions.h"
---
> #include "qopenglextrafunctions.h"
$ diff qopengl.h qopengl.h.orig
108c108
< // #  include <QtGui/qopengles2ext.h>
---
> #  include <QtGui/qopengles2ext.h>

The VisIt team also uses the following.

-mp -ltcg

Completing installation

In a bash window:

export VER=2017
export SFX=vs${VER}
export QTVER=5.10.0
export CONTRIB_DIR=/winsame/contrib-%SFX%
echo $CONTRIB_DIR

Check that CONTRIB_DIR has the same value as before in the cmd shell, up to OS differences. Then

env QT_BLDRVERSION=5.10.1 /path/to/bilder/setinstald.sh -i $CONTRIB_DIR qt,sersh
cd $CONTRIB_DIR
ln -s qt-$QTVER-sersh qt-sersh
mkshortcut -n qt-sersh.lnk qt-$QTVER-sersh

Addition Useful Tools

Notepad++

  • (Optional) Notepad++ is a free source code editor that is a great tool for Windows.
  • Download from http://notepad-plus-plus.org/
  • Install and pin to your taskbar.

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 the user is familiar with the relations between Cygwin and Windows paths.)

The path is critical for when there are conflicting executables. This is the case for Subversion and OpenSSL.

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 cygwin's version of svn will be ahead of the Windows Subversion so as to allow 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 file for cygwin and Visual Studio 2013 (VS12) is bilder/machines/cygwin.vs12. It is sourced by bilder using the -m option. It augments PATH and sets 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.

Setup for making Installers

Visual Studios Redistributables

Download vcredist_x64.exe (Visual C++ Redistributable Packages for Visual Studio 2013)

http://www.microsoft.com/en-gb/download/details.aspx?id=40784

Choose only vcredist_x64.exe executable from list. Put executable in C:\bin.

Sign Tools

  • 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

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.
  • Add C:\Program Files (x86)\NSIS\Bin to your system path.

  • 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

Notes For Development

Notes on debugging Windows executables
Notes on deleting directories and files owned by other users

Updated by Benjamin Cowan over 6 years ago · 108 revisions