Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 56

Nathan Neri, 04/03/2019 01:46 PM

1 2 Redmine Admin
# Preparing a Mac machine for Bilder #
2 1 Redmine Admin
3 24 John Cary
__If all you need is python and sphinx__ (e.g., for builds of documentation), then you need only
4
5
* XCode with command line tools
6
* Latex installed as noted below
7
8
and then you can add the arguments,  -W python, and your installed Python and CMake will be used if your path is correct.
9
10
11 2 Redmine Admin
## Bilder on Darwin ##
12 1 Redmine Admin
13 16 John Cary
Darwin comes with bash, so it is Bilder ready for the most part.
14 1 Redmine Admin
15 16 John Cary
### OS X Versions ###
16 1 Redmine Admin
17 16 John Cary
Yosemite's XCode that supports C++ 11 by default.
18 1 Redmine Admin
19 16 John Cary
El Capitan's clang compiler supports OpenMP.
20
21 1 Redmine Admin
## Case insensitive file system ##
22
23
We have noted and filed bugs for CMake errors on OS X when using the case-sensitive file system. To fix we use the case-insensitive file system. There may be problems with various packages and the case-insensitive file system.
24
25 2 Redmine Admin
## C and C++ compilers and Xcode command line tools ##
26 1 Redmine Admin
27
Install Xcode. To obtain version 6, visit https://developer.apple.com/xcode/download, then at the bottom third of the page, click on the "Additional Tools" link . Sign in with your Apple ID.  
28
29
~~~~~~
30 31 John Cary
sudo xcode-select --install
31 1 Redmine Admin
~~~~~~
32
33 35 John Cary
With mojave, one must additionally
34
35
~~~~~~
36
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
37
~~~~~~
38
39
But https://apple.stackexchange.com/questions/337940/why-is-usr-include-missing-i-have-xcode-and-command-line-tools-installed-moja says it is better to use `xcrun --show-sdk-path` to figure this out.
40
41 1 Redmine Admin
## HomeBrew ##
42
43
One must select a non-OSX package manager for some additional packages. The candidates are HomeBrew, MacPorts, and Fink, with the HomeBrew being our recommendation at this time, as it is active, and it has the philosophy of not building extraneous stuff that is already present on OSX, which MacPorts tends to do, thus using up more disk space.  HomeBrew also installs packages in their own subdirs with links to other places in /opt, thus making removal a matter removing a directory and then removing broken links in /opt/homebrew.
44
45 14 John Cary
HomeBrew requires that one not have root privileges.  So we make the directory into which we can write:
46 1 Redmine Admin
47
~~~~~~
48 29 John Cary
sudo -s
49
mkdir -p /opt/homebrew
50
chgrp -R admin /opt
51
chmod -R 775 /opt
52
chmod -R 2775 /opt/homebrew
53
exit
54 14 John Cary
~~~~~~
55
56
and then we work as nonroot:
57
58
~~~~~~
59 29 John Cary
cd /opt
60
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew
61 39 David Alexander
~~~~~~
62
63
~~~~~~
64 29 John Cary
chmod -R a+rX /opt/homebrew
65 14 John Cary
find /opt/homebrew -type l -exec chmod -h a+r '{}' \;
66 1 Redmine Admin
~~~~~~
67
68 39 David Alexander
These last too lines can be reused at anytime there is a permissions problem.
69 1 Redmine Admin
70 39 David Alexander
As root again execute these lines to pick up some paths in the defaults paths:
71
72 1 Redmine Admin
~~~~~~
73 29 John Cary
sudo -s
74
echo "/opt/homebrew/bin" > /etc/paths.d/homebrew
75
echo "/opt/homebrew/share/man" > /etc/manpaths.d/homebrew
76
chmod a+r /etc/paths.d/homebrew /etc/manpaths.d/homebrew
77
exit
78 1 Redmine Admin
~~~~~~
79
80
Get the required packages...
81
82
~~~~~~
83 29 John Cary
brew install gnupg libpng freetype gd ghostscript
84 1 Redmine Admin
~~~~~~
85
86 16 John Cary
Nice to have:
87 1 Redmine Admin
88 16 John Cary
~~~~~~
89 29 John Cary
brew install imagemagick
90 16 John Cary
~~~~~~
91
92 45 Nathan Neri
git large file support (for VisIt)
93
94
~~~~~~
95
brew install git-lfs
96 56 Nathan Neri
git lfs install --force --skip-smudge
97 45 Nathan Neri
~~~~~~
98
99 25 David Howdle
For Qt5:
100
101
~~~~~~
102
brew install bison flex gperf libcapn
103 1 Redmine Admin
~~~~~~
104 25 David Howdle
105 39 David Alexander
To get fortran, which comes with the gcc compiler:
106 1 Redmine Admin
107
~~~~~~
108 39 David Alexander
brew install gcc@6
109 1 Redmine Admin
~~~~~~
110
111 39 David Alexander
With versions older than gcc 6.5 (released Nov 2018) possibly needed for OSs older than Mojave, gfortran is not installed with gcc and you need to add the following argument "--with-fortran" to the above brew install command.
112 1 Redmine Admin
113 39 David Alexander
OPTIONAL:
114
115
If you receive an error regarding ruby version:
116
117
~~~~~~
118
brew install ruby@2.3
119
~~~~~~
120
121
may help.
122
123 1 Redmine Admin
124
## LaTeX ##
125
126
Those with sufficient hard drive space (3.4GB after install) may wish to download the full MacTeX package from <http://www.tug.org/mactex/downloading.html>. After installing, one can see the 'README ME FIRST.pdf' in /Applications/Tex. You will likely need to add /usr/texbin to your path:
127 29 John Cary
128
~~~~~~
129 1 Redmine Admin
setenv PATH /usr/texbin:${PATH}  # For tcsh
130 13 Redmine Admin
export PATH=/usr/texbin:${PATH}  # For bash
131 1 Redmine Admin
~~~~~~
132
133 13 Redmine Admin
For those who like GUIs, the !TeXworks in /Applications/TeX/TeXworks should work fine.
134
135
For those with limited space, install BasicTeX from <https://tug.org/mactex/morepackages.html>. Add to your PATH:
136 32 John Cary
137 13 Redmine Admin
~~~~~~
138
    /usr/local/texlive/2017/bin/universal-darwin/
139 32 John Cary
~~~~~~
140 1 Redmine Admin
141 32 John Cary
and then install the packages noted at
142 29 John Cary
143 32 John Cary
[[LaTeX packages needed by Bilder]]
144 1 Redmine Admin
145
You may need to use sudo.
146 32 John Cary
147
~~~~~~
148 1 Redmine Admin
sudo tlmgr update --self
149 29 John Cary
sudo tlmgr install <needed packages>
150 32 John Cary
~~~~~~
151
152 1 Redmine Admin
and then used the autoupdate feature to get any additionally needed packages.  This minimal installation is 230 M instead of the usual 2GB.
153
154
155
## Disable spindump ##
156
157
for faster compilations via
158
159 29 John Cary
~~~~~~
160 11 Redmine Admin
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.spindump.plist
161 34 John Cary
~~~~~~
162
163
## LLVM-Clang ##
164
165 52 Nathan Neri
LLVM-Clang (aka LlvmClang) is different from AppleClang.  It has support for target attributes and openmp, and provides a build chain for high-performance computing.  Check out the llvm-project of your chosen version (Currently we are using the llvmorg-8.0.0 tag):
166 1 Redmine Admin
167 48 Nathan Neri
~~~~~~
168
cd /opt
169 54 David Alexander
git clone -b <Branch> https://github.com/llvm/llvm-project.git llvm-<Version>
170 53 David Alexander
# You can see the branches you can clone at https://github.com/llvm/llvm-project
171 54 David Alexander
# e.g.  git clone -b llvmorg-8.0.0 https://github.com/llvm/llvm-project.git llvm-8.0.0
172 48 Nathan Neri
~~~~~~
173 1 Redmine Admin
174 48 Nathan Neri
To configure and build:
175 49 Nathan Neri
176 48 Nathan Neri
~~~~~~
177
cd /opt/llvm-<Version>
178 1 Redmine Admin
mkdir build
179
cd build
180 55 David Alexander
cmake ../llvm -DLLVM_ENABLE_PROJECTS="clang;openmp;libcxx;libcxxabi" -DLLVM_ENABLE_RTTI:BOOL=ON -DLLVM_ENABLE_EH:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH="/opt/llvm-<Version>/install" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release
181 54 David Alexander
make # Add appropriate -j argument for the machine to build faster
182
          # with -j 8 on qamojavellvm the build and installation took a little under an hour
183 48 Nathan Neri
make install
184
~~~~~~
185 1 Redmine Admin
186 48 Nathan Neri
Bilder will look in /opt/llvmclang/bin for llvm binaries (as well as $LLVM_DIR/bin, and your installation dir/bin, in case you need to keep multiple versions for different builds), so we set a link to the installation directory in the chosen version of llvm:
187 43 Tech-X Corporation
188 44 Tech-X Corporation
~~~~~~
189 43 Tech-X Corporation
cd /opt
190 48 Nathan Neri
sudo ln -s llvm-<Version>/install llvmclang
191 44 Tech-X Corporation
~~~~~~
192 43 Tech-X Corporation
193 11 Redmine Admin
## Java ##
194
195
You will need to install java by invoking the executable in any way such as...
196
197
~~~~~~
198
java -version
199 1 Redmine Admin
~~~~~~
200
201
Follow the instructions in the dialog that takes you to the Oracle website and choose the latest version to download.  (as of Nov 2015 this is 1.8)
202
203
## HostName ##
204 2 Redmine Admin
205 1 Redmine Admin
For bilder to properly send emails the fully qualified hostname must set on the machine. To check this try...
206 31 John Cary
207 29 John Cary
~~~~~~
208 1 Redmine Admin
hostname -f
209
~~~~~~
210
211
this should return machinename.domainname.com rather than just machinename.  If it does not, then set the hostname of the machine by typing the following commands.
212
213
~~~~~~
214
sudo scutil --set ComputerName "machinename"
215
sudo scutil --set LocalHostName "machinename"
216
sudo scutil --set HostName "machinename.domainname.com"
217
dscacheutil -flushcache
218
~~~~~~
219
220
Restart your Mac after this.
221
222
## Power Saving Modes ##
223
224
For build machines that are not personal machines, disabling certain options will help in connectivity and responsiveness:
225
226
~~~~~~
227
Under Spotlight
228
 - disabled the main HD. (multiple mdworkers taking up a lot of cpu.)
229
~~~~~~
230
231
~~~~~~
232
Under Energy Saver
233
 - Computer sleep: Set to never
234
 - Unchecked Put hard disks to sleep when possible
235
 - Unchecked Wake for network access
236
~~~~~~
237
238
&nbsp;
239
&nbsp;
240
&nbsp;
241
&nbsp;
242
&nbsp;
243
&nbsp;
244
&nbsp;
245
&nbsp;
246
&nbsp;
247 29 John Cary
&nbsp;
248
249
---
250
251 31 John Cary
---
252 1 Redmine Admin
253 31 John Cary
## X11 ##
254
255
X11 should not be needed, but if it is needed:
256
257
Install [XQuartz X11](http://xquartz.macosforge.org/landing/).
258
259
Create a symbolic link so that the X11 headers can be found by the compiler:
260
261
~~~~~~
262
sudo ln -s /opt/X11/include/X11 /usr/local/include/X11
263 1 Redmine Admin
~~~~~~
264 31 John Cary
265
# DEPRECATED INSTRUCTIONS #
266
267
268
## Other gfortran options (besides HomeBrew) ##
269
270
### Option 2: HPC ###
271
272
Install gfortran from [SourceForge HPC](http://hpc.sourceforge.net).  (Do not also install the other gcc compilers.)
273
274
As of March 29, 2015, the version is 4.9.0.
275
276
Install via
277
278
~~~~~~
279
$ tar xzf gfortran-4.9-bin.tar.gz -C /
280
~~~~~~
281
282
### Option 3: GNU ###
283
284
Install gfortran using the installer from <http://gcc.gnu.org/wiki/GFortranBinaries>.
285
286
As of March 29, 2015, the version is 4.9.0.
287
288 30 John Cary
The binaries will end up being installed in /usr/local/bin
289
290
291
## Git ##
292 11 Redmine Admin
293 1 Redmine Admin
If any repository package requires Git protocol, then for Lion and earlier you may need Git from <http://git-scm.com/download/mac> and add /usr/local/git/bin to your path.
294 10 Redmine Admin
295
296
### Macports ### 
297 11 Redmine Admin
298
This provides wget, freetype, and other utilities. Get macports from <http://www.macports.org/install.php> and install.
299
300 10 Redmine Admin
Note: Before proceeding with the installation of various macports packages noted below on Lion machines with Xcode 4.3, one needs to run
301 29 John Cary
302 10 Redmine Admin
~~~~~~
303
sudo xcode-select -switch /Applications/Xcode.app
304
~~~~~~
305 11 Redmine Admin
306
Otherwise, there will be an error installing zlib during the wget installation below.
307 1 Redmine Admin
308
After the macports installation, do
309 29 John Cary
310
~~~~~~
311
sudo port install wget
312 1 Redmine Admin
sudo port install ImageMagick +no_x11
313
sudo port install f2c
314
~~~~~~
315
316
317 11 Redmine Admin
### XCode ###
318 1 Redmine Admin
### Lion ###
319
320
On Lion, the command line compilers are not installed automatically. After installing Xcode, navigate to the 
321 2 Redmine Admin
Preferences->Download dialog 
322 1 Redmine Admin
and install the Command Line Tools. The dialog is.. 
323
324
!screenShotCommandLineTools.png!
325
326 11 Redmine Admin
or from the command line do
327 29 John Cary
328
~~~~~~
329 1 Redmine Admin
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
330
xcodebuild
331
      (hit agree)
332
~~~~~~
333
334
You may subsequently need to build your first package with sudo in order to accept the Xcode licenses.
335
336
### Mountain Lion ### 
337
338
Same as Mavericks?
339
340 2 Redmine Admin
### Mavericks ###
341 29 John Cary
342 1 Redmine Admin
~~~~~~
343
sudo xcode-select --install
344
~~~~~~
345
346
347
## Java ##
348
349
(The below does not apply to yosemite.)
350
351
The cmake build may fail due to missing java headers linked to in /System/Library/Frameworks/JavaVM.framework/Headers. To fix:
352 29 John Cary
353
~~~~~~
354 1 Redmine Admin
cd /System/Library/Frameworks/JavaVM.framework/Headers
355
sudo mv jni.h jni.h.missing
356
~~~~~~