Project

General

Profile

Preparing a Windows machine for Bilder » History » Version 1

Redmine Admin, 10/30/2015 04:12 PM

1 1 Redmine Admin
2
# Preparing a Windows machine for Bilder (64-bit only)
3
4
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). 
5
6
# Basic Windows Configuration
7
8
_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.
9
10
# Editing your system path on Windows
11
12
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.
13
14
# Ensure that Windows knows its domainname
15
16
* From a command prompt, type the command: 
17
18
~~~~~~
19
ipconfig /all
20
~~~~~~
21
22
Look for value of the "Primary Dns Suffix" field, which should be your domain name (i.e. txcorp.com).
23
24
* If cygwin is already installed,
25
26
~~~~~~
27
ipconfig /all | grep -i "Primary Dns Suffix" | sed -e 's/^.*: //'
28
~~~~~~
29
30
should return the domainname. This only applies if it is part of a Windows Domain.
31
32
* For Windows 7/Windows 2008 machines that are not a member of the Windows Domain, Active Directory, do the following:
33
    1. Right click on My Computer, select properties
34
    2. Click on Advanced system settings
35
    3. Select the computer name tab
36
    4. Click the change button
37
    5. Click the more button
38
    6. Enter the Primary DNS suffix. i.e. txcorp.com 
39
40
# Create initial directories
41
42
* Create the folder C:\\bin (if not already present).
43
* Add or move C:\\bin to the front of your system path.
44
45
# Tools needed by Bilder
46
47
## Dependency Walker
48
49
Dependency Walker shows the DLL's that an executable depends on.  This is used to
50
find and copy-in DLL's to a final distribution.
51
52
__Make sure you download and install the correct version of dependencywalker for your machine (x86 for x86 machines, x64 for 64bit machines, etc).__
53
54
Install [Dependency Walker](http://www.dependencywalker.com/) into C:\\bin.
55
56
## Blat
57
58
Blat is a sendmail client for Windows.
59
60
* Download Blat from [The Blat SourceForge](http://sourceforge.net/projects/blat) Site and extract all files. As of 07/18/2013, this is version 311.
61
* Extract the blat311 folder into C:\\bin.
62
* Copy the C:\bin\blat311\full\blat.{exe,dll} to C:\bin\blat.{exe,dll}
63
* Execute the following command in a cygwin terminal
64
65
~~~~~~
66
    blat -install mail.txcorp.com <username>@txcorp.com
67
~~~~~~
68
69
70
## CMake
71
72
CMake is a cross-platform build system.
73
74
* Install [CMake (a 32-bit application)](http://www.cmake.org/files/).
75
** Version 2.8.6 is required.  Later versions work also.
76
** Add the CMake path to the front of the system path! "Needed to build newer 64 bit versions through bilder*
77
** When this step is complete, make sure the newest CMake is the only one in your system path. 
78
79
## CYGWIN
80
81
### Gotchas (in advance)
82
83
* Do not install Cygwin's MinGW. Those are installed in a separate area to reduce conflicts.
84
* 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'.
85
* Do not install Cygwin's mt.  If 'which mt' returns /bin/mt or /usr/bin/mt, then move this aside too.
86
* 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.
87
* Make sure that 'which find' returns the cygwin version (/usr/bin/find), not the Windows version.
88
* Make sure 'which cmd' returns the Windows version. If not, check that your bash_profile has not made an error in setting your path.
89
* 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.
90
91
### Updating Cygwin
92
93
* 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.
94
* 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.
95
* Recreate the /etc/passwd and /etc/group file again using the mkpasswd and mkgroup commands described in the Configuring Cygwin section.
96
* Install Cygwin from [here](http://cygwin.com/install.html). There are now separate installers for 64 bit (setup-x86_64.exe ) and 32 bit (setup-x86.exe).
97
* Upon running setup-*.exe, select the packages:
98
** Base -> util-linux
99
** Devel -> bison
100
** Devel -> flex
101
** Devel -> gcc-g++ and gcc-fortran
102
** Devel -> git
103
** Devel -> make
104
** Devel -> mercurial
105
** Devel -> patch
106
** 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.)
107
** Editors -> vim and emacs (and alternate editors of choice)
108
** Math -> bc
109
** Net -> openssh
110
** Python -> python (see note below)
111
** Shells -> mintty
112
** Utils -> diffutils
113
** Utils -> dos2unix
114
** Web -> wget
115
116
* 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).
117
118
* 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.
119
* 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.
120
121
### Setting Cygwin Disk Mounts
122
123
* 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:
124
125
~~~~~~
126
mkdir /cygdrive/c/winsame
127
mkdir /winsame
128
mount C:/winsame /winsame
129
~~~~~~
130
131
To make this permanent, put
132
133
~~~~~~
134
C:/winsame /winsame ntfs binary 0 0
135
~~~~~~
136
137
as one line in /etc/fstab.
138
139
On Windows-64, additionally put
140
141
~~~~~~
142
C:/Program\040Files\040(x86) /ProgramFilesX86 ntfs binary 0 0
143
~~~~~~
144
145
as one line in /etc/fstab.  This allows one to construct a valid path with no parentheses as needed for ATLAS.
146
147
### Configuring Cygwin
148
149
* Use a "Cygwin64 Terminal" from basic cygwin installation above to perform all subsequent bask tasks
150
151
* If bilderizing a domain machine, create an /etc/passwd file with the following command
152
153
~~~~~~
154
mkpasswd -l -d -p /winsame > /etc/passwd
155
~~~~~~
156
157
* If bilderizing a non-domain machine, create an /etc/passwd file with the following command
158
159
~~~~~~
160
mkpasswd -l -p /winsame > /etc/passwd
161
~~~~~~
162
163
* If bilderizing a domain machine, create an /etc/group file with the following command
164
165
~~~~~~
166
mkgroup -l -d > /etc/group
167
~~~~~~
168
169
* If bilderizing a non-domain machine, create an /etc/group file with the following command
170
171
~~~~~~
172
mkgroup -l > /etc/group
173
~~~~~~
174
175
* 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:
176
177
~~~~~~
178
cp /home/<username>/.* /winsame/<username>/
179
rm -rf /home/<username>
180
~~~~~~
181
182
## MPI
183
184
Download the Microsoft MPI (at v6 as of July 2015) from
185
186
http://www.microsoft.com/en-us/download/details.aspx?id=47259
187
188
This installer will put mpiexec in your path, but you will need to restart any cygwin shells and the Jenkins slave to make this active.
189
190
## JOM
191
192
JOM is an nmake substitute that allows the -j flag for faster compilation.
193
194
* Create the folder C:\bin (if not already present).
195
* Add C:\bin to your system path (if not already there).
196
* Download jom.zip from [the Qt Project](qt-project.org/wiki/jom).
197
* Extract the contents of jom.zip
198
* Move/copy jom.exe to C:\bin (you then can delete the remainder of the contents or keep for historical reasons). 
199
200
## LaTex
201
202
If you will be building documentation, then you will need to
203
204
* Install [Doxygen](http://www.stack.nl/~dimitri/doxygen/download.html).
205
* Install Basic MikTeX from [MikTeX](http://miktex.org/). 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
206
* 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.
207
* Install [ghostscript](http://sourceforge.net/projects/ghostscript/files/GPL%20Ghostscript/9.04/). 
208
209
## NSIS
210
211
NSIS is a scriptable installer maker.
212
213
* Install NSIS from [NSIS Download Site](http://nsis.sourceforge.net/Download).
214
    * 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.
215
    * Version 2.46 is available as of Aug 21, 2011. 
216
217
* Install NSIS Access Control Plugin from [Access Control Plugin Site](http://nsis.sourceforge.net/AccessControl_plug-in).
218
219
Copies directories and files into the NSIS installation as follows:
220
221
~~~~~~
222
AccessControl.zip\Contrib\AccessControl --> NSIS\Contrib\AccessControl
223
AccessControl.zip\Docs\AccessControl --> NSIS\Docs\AccessControl
224
AccessControl.zip\Plugins\AccessControl.dll --> NSIS\Plugins\x86-ansi\AccessControl.dll
225
AccessControl.zip\Unicode\Plugins\AccessControl.dll --> NSIS\Plugins\x86-unicode\AccessControl.dll
226
~~~~~~
227
228
229
## Perl
230
231
Perl is needed for Qt
232
233
* Download and install [ActiveState Perl](http://www.activestate.com/activeperl/downloads)
234
235
## Python
236
237
* 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.
238
239
## Subversion
240
241
* Install the CollabNet Subversion Command-Line Client from [The CollabNet Download Site](http://www.open.collab.net/downloads/subversion/).
242
243
* 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:
244
245
~~~~~~
246
$ where svn
247
  C:\cygwin64\bin\svn.exe
248
  C:\Program Files\CollabNet\Subversion Client\svn.exe
249
$ /bin/svn --version | head -n 1
250
  svn, version 1.7.14 (r1542130)
251
$ /cygdrive/c/Program\ Files/CollabNet/Subversion\ Client/svn --version | head -n 1
252
  svn, version 1.7.18 (r1615261)
253
~~~~~~
254
255
## Visual Studio
256
257
* 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.
258
259
    * VS12: Visual Studio 2013 Community Edition from Microsoft "VS12 Download Site":https://www.visualstudio.com/en-US/products/visual-studio-community-vs
260
261
* 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 Stuido Update 5 Download":http://www.microsoft.com/en-us/download/details.aspx?id=48129
262
263
* Ensure that Visual Studio is not in the system path. (Bilder adds this as needed.)
264
265
# Useful Tools
266
267
## Notepad++
268
269
* (Optional) Notepad++ is a free source code editor that is a great tool for Windows.
270
* Download from http://notepad-plus-plus.org/
271
* Install and pin to your taskbar.
272
273
# Libraries
274
275
## OpenSSL
276
277
OpenSSL is needed by libssh.
278
279
* Download from http://slproweb.com/products/Win32OpenSSL.html
280
* Choose the Win64 OpenSSL v1.0.1e on 64bit or the Win32 OpenSSL v1.0.1e on 32bit windows.
281
* You may have to install Visual C++ 2008 Redistributables if installer complains.
282
* During the installation, select "Copy OpenSSL DLLs to: The OpenSSL binaries (/bin) directory"
283
* 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.
284
* 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:
285
286
~~~~~~
287
which libeay32.dll
288
/cygdrive/c/OpenSSL-Win64/bin/libeay32.dll
289
~~~~~~
290
291
## Qt
292
293
Qt is needed for VisIt and other packages. We need to build Qt on windows.
294
295
* Make sure no other Qt is in your system path.
296
* Get the Qt Libraries (version 4.8.6) from [Qt Libraries Download Link](http://download.qt-project.org/official_releases/qt/4.8/4.8.6/). 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.
297
* 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.
298
* Patch Qt by opening a Cygwin window:
299
300
~~~~~~
301
cd /winsame/builds-vs12/winqt/4.8.6
302
patch -p1 --binary < /path/to/bilder/patches/qt-4.8.6.patch
303
~~~~~~
304
305
### Compiling Qt
306
307
* The copy/paste-able commands below assume VS12.
308
309
In a Visual Studio x64 DOS window:
310
311
~~~~~~
312
set VER=12
313
set SFX=vs%VER%
314
cd C:\winsame\builds-%SFX%\winqt\4.8.6
315
configure.exe -prefix C:\winsame\contrib-%SFX%\qt-4.8.6-sersh -debug-and-release -opensource \
316
-confirm-license -fast -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc -no-sql-psql \
317
-no-sql-sqlite -no-sql-sqlite2 -no-sql-tds -no-libtiff -webkit -declarative
318
~~~~~~
319
320
(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)
321
322
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)
323
324
~~~~~~
325
export VER=12
326
export SFX=vs${VER}
327
cd /winsame/builds-${SFX}/winqt/4.8.6
328
mkdir -p /winsame/contrib-${SFX}/qt-4.8.6-sersh
329
cp -R mkspecs /winsame/contrib-${SFX}/qt-4.8.6-sersh
330
cd /winsame/contrib-${SFX}
331
ln -s qt-4.8.6-sersh qt-sersh
332
mkshortcut.exe -n qt-sersh.lnk qt-4.8.6-sersh
333
~~~~~~
334
335
In the Visual Studio x64 DOS window
336
337
~~~~~~
338
set VER=12
339
set SFX=vs%VER%
340
cd C:\winsame\builds-%SFX%\winqt\4.8.6 
341
set PATH=%PATH%;C:\winsame\builds-%SFX%\winqt\4.8.6\bin
342
nmake         # Took 3.5 hours on a 2.3 GHz Core2 Duo with Solid State Drive
343
nmake install # Took 10 minutes on a 2.3 GHZ Core2 Duo with Solid State Drive
344
~~~~~~
345
346
* 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.
347
348
In the bash window, then execute
349
350
~~~~~~
351
/path/to//bilder/setinstald.sh -i /winsame/contrib-$SFX qt,sersh
352
~~~~~~
353
354
# Experimental Tools and Libraries
355
356
These tools have not been fully vetted or built, so you need not do these.
357
358
## MinGW
359
360
See [[Installing MinGW]].
361
362
## ATLAS
363
364
See [[Installing ATLAS on Windows]].
365
366
# Cygwin and Paths
367
368
(This section assumes that the user is familiar with the relations between Cygwin and Windows paths.)
369
370
The path is critical for when there are conflicting executables. This is the case for Subversion and OpenSSL.
371
372
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.
373
374
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.
375
376
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.
377
378
## Usage under Jenkins
379
380
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.
381
382
383
## Summary
384
385
* Bilder moves `/usr/bin` to just after the Python path and therefore to before
386
  `/cygdrive/c/Windows/system32`.
387
* Put the Windows Subversion path behind the Python path (and so behind `/usr/bin`).
388
    - `/usr/bin` must be removed from the path when configuring some packages in order to get the correct subversion when building under Jenkins.
389
390
# Bilder machine files for cygwin
391
392
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.
393
394
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.
395
396
# Setup for making Installers
397
398
## Visual Studios Redistributables
399
400
Download vcredist_x64.exe (Visual C++ Redistributable Packages for Visual Studio 2013)
401
402
http://www.microsoft.com/en-gb/download/details.aspx?id=40784
403
404
Choose only vcredist_x64.exe executable from list. Put executable in C:\bin
405
406
## Sign Tools
407
408
* 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.
409
* 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: 
410
411
~~~~~~
412
cd C:\Windows\System32
413
REGSVR32 capicom.dll
414
~~~~~~
415
416
# Notes For Development
417
418
[[Notes on developing with Visual Studio and bilder]]
419
[[Notes on debugging Windows executables]]
420
[[Notes on deleting directories and files owned by other users]]