Project

General

Profile

Preparing a Mac machine for Bilder » History » Version 88

John Cary, 07/02/2022 12:24 PM

1 2 Redmine Admin
# Preparing a Mac machine for Bilder #
2 1 Redmine Admin
3 70 John Cary
*NOTE: as of Catalina, installing in /opt is no longer an option, so we have moved to /usr/local*
4
5 24 John Cary
__If all you need is python and sphinx__ (e.g., for builds of documentation), then you need only
6
7
* XCode with command line tools
8
* Latex installed as noted below
9
10
and then you can add the arguments,  -W python, and your installed Python and CMake will be used if your path is correct.
11
12
13 2 Redmine Admin
## Bilder on Darwin ##
14 1 Redmine Admin
15 16 John Cary
Darwin comes with bash, so it is Bilder ready for the most part.
16 1 Redmine Admin
17 16 John Cary
### OS X Versions ###
18 1 Redmine Admin
19 16 John Cary
Yosemite's XCode that supports C++ 11 by default.
20 1 Redmine Admin
21 16 John Cary
El Capitan's clang compiler supports OpenMP.
22
23 1 Redmine Admin
## Case insensitive file system ##
24
25
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.
26
27 2 Redmine Admin
## C and C++ compilers and Xcode command line tools ##
28 1 Redmine Admin
29 83 David Alexander
Install Xcode. To obtain version 11.3 (11.x is required for LLVM@12), 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. Also download the Command Line Tools to match the version of Xcode that you are getting. The Xcode.app directory that is unpacked by opening the .xip file should be moved to the /Applications/ folder. The Command Line Tools is a DMG that has a PKG installer, so just run that. One must additionally execute this command before using any command line tools:
30 1 Redmine Admin
31
~~~~~~
32 83 David Alexander
sudo xcodebuild -license
33 1 Redmine Admin
~~~~~~
34
35 83 David Alexander
If you are upgrading from a previous installation you will want/need to run the following command
36 35 John Cary
37
~~~~~~
38 83 David Alexander
sudo xcode-select -s /Applications/Xcode.app
39 1 Redmine Admin
~~~~~~
40
41 83 David Alexander
One can check the version of Xcode from the command-line with
42 69 John Cary
43 83 David Alexander
~~~~~
44
xcodebuild -version
45
/usr/bin/clang --version
46 69 John Cary
~~~~~~
47 65 David Alexander
48 83 David Alexander
The clang should be version 11.0.0 with Xcode 11.3.1.
49 1 Redmine Admin
50
## HomeBrew ##
51 70 John Cary
52 86 Scott Kruger
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 `$HOMEBREWDIR` with $HOMEBREWDIR being either `/usr/local/homebrew` if on Intel Mac, or `/opt/homebrew` if on a Mac M1..  Thus removal of a package a matter removing a directory and then removing broken links in $HOMEBREWDIR.
53 14 John Cary
54 86 Scott Kruger
To install homebrew, go to https://brew.sh  and follow the installation directions.
55 1 Redmine Admin
56 82 John Cary
Get various packages...
57 16 John Cary
58 82 John Cary
~~~~~~
59 86 Scott Kruger
brew install subversion gnupg libpng freetype gd ghostscript ninja wget imagemagick bison flex gperf libcapn
60 16 John Cary
~~~~~~
61 45 Nathan Neri
62
git large file support (for VisIt)
63
64
~~~~~~
65 56 Nathan Neri
brew install git-lfs
66 39 David Alexander
git lfs install --force --skip-smudge
67 1 Redmine Admin
~~~~~~
68 79 John Cary
69 88 John Cary
Fortran comes with the homebrew gcc compiler.  
70
71
~~~~~~
72
brew install gcc
73
~~~~~~
74
75
On M1 it needs to be installed from source.
76 75 Tech-X Corporation
77 81 David Alexander
~~~~~~
78 87 John Cary
brew install --build-from-source gcc
79 1 Redmine Admin
~~~~~~
80 39 David Alexander
81
OPTIONAL:
82
83
If you receive an error regarding ruby version:
84
85
~~~~~~
86
brew install ruby@2.3
87
~~~~~~
88
89
may help.
90 1 Redmine Admin
91
92
## LaTeX ##
93
94 29 John Cary
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:
95
96 1 Redmine Admin
~~~~~~
97 13 Redmine Admin
setenv PATH /usr/texbin:${PATH}  # For tcsh
98 1 Redmine Admin
export PATH=/usr/texbin:${PATH}  # For bash
99
~~~~~~
100 13 Redmine Admin
101
For those who like GUIs, the !TeXworks in /Applications/TeX/TeXworks should work fine.
102
103 32 John Cary
For those with limited space, install BasicTeX from <https://tug.org/mactex/morepackages.html>. Add to your PATH:
104 13 Redmine Admin
105
~~~~~~
106 32 John Cary
    /usr/local/texlive/2017/bin/universal-darwin/
107 1 Redmine Admin
~~~~~~
108 32 John Cary
109 29 John Cary
and then install the packages noted at
110 32 John Cary
111 1 Redmine Admin
[[LaTeX packages needed by Bilder]]
112
113 32 John Cary
You may need to use sudo.
114
115 1 Redmine Admin
~~~~~~
116 29 John Cary
sudo tlmgr update --self
117 32 John Cary
sudo tlmgr install <needed packages>
118
~~~~~~
119 1 Redmine Admin
120
and then used the autoupdate feature to get any additionally needed packages.  This minimal installation is 230 M instead of the usual 2GB.
121
122
123
## Disable spindump ##
124
125
for faster compilations via
126
127
~~~~~~
128 58 John Cary
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.spindump.plist
129
~~~~~~
130 67 David Alexander
131 58 John Cary
## LLVM-Clang ##
132
133
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.
134
135
We use homebrew to install this with
136 61 John Cary
137 71 David Alexander
~~~~~~
138 83 David Alexander
brew install llvm@12
139 1 Redmine Admin
~~~~~~
140 78 John Cary
141 85 David Alexander
As of Feb 2022, the default llvm version is 13 and that would be probably fine, however 12 is tested and is known to be ok. Ensure that there is a link at /usr/local/homebrew/opt/llvm that points to the installation so bilder can properly find it. If not then do something like the following (this example is for version 12):
142
143
~~~~~~
144
cd /usr/local/homebrew/opt
145
ln -s ../Cellar/llvm\@12/12.0.1_1 llvm
146
~~~~~~
147
148 78 John Cary
149 1 Redmine Admin
ALTERNATIVE
150 78 John Cary
151 1 Redmine Admin
If brew does not work (e.g., it is not available for M1), then you can download a release from https://github.com/llvm/llvm-project/releases.
152
153 48 Nathan Neri
To configure and build:
154 49 Nathan Neri
155 80 John Cary
~~~~~~
156
llvmver=12.0.0 # Correct as needed.
157
tar xf llvmorg-$llvmver.tar.gz
158 1 Redmine Admin
cd llvm-project-llvmorg-$llvmver
159
mkdir build
160 80 John Cary
cd build
161 77 John Cary
cmake ../llvm -DLLVM_ENABLE_PROJECTS="clang;openmp;libcxx;libcxxabi" -DLLVM_ENABLE_RTTI:BOOL=ON -DLLVM_ENABLE_EH:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH="/usr/local/opt/llvm-$llvmver/install" -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_NAME_DIR=/usr/local/opt/llvm-$llvmver/install/lib
162 54 David Alexander
make # Add appropriate -j argument for the machine to build faster
163
          # with -j 8 on qamojavellvm the build and installation took a little under an hour
164 48 Nathan Neri
make install
165
~~~~~~
166
167 43 Tech-X Corporation
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:
168 44 Tech-X Corporation
169 78 John Cary
~~~~~~
170 48 Nathan Neri
cd /usr/local/opt
171 44 Tech-X Corporation
sudo ln -s llvm-<Version>/install llvmclang
172 43 Tech-X Corporation
~~~~~~
173 11 Redmine Admin
174
## Java ##
175
176
You will need to install java by invoking the executable in any way such as...
177
178
~~~~~~
179 1 Redmine Admin
java -version
180
~~~~~~
181 74 Tech-X Corporation
182
Follow the instructions in the dialog that takes you to the Oracle website and choose the latest version to download.  (As of March 2021 this is 16.)
183
184
Chose the macOS installer from
185 1 Redmine Admin
https://www.oracle.com/java/technologies/javase-jdk16-downloads.html
186
187 2 Redmine Admin
## HostName ##
188 1 Redmine Admin
189 31 John Cary
For bilder to properly send emails the fully qualified hostname must set on the machine. To check this try...
190 29 John Cary
191 1 Redmine Admin
~~~~~~
192
hostname -f
193
~~~~~~
194
195
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.
196
197
~~~~~~
198
sudo scutil --set ComputerName "machinename"
199
sudo scutil --set LocalHostName "machinename"
200
sudo scutil --set HostName "machinename.domainname.com"
201
dscacheutil -flushcache
202
~~~~~~
203
204
Restart your Mac after this.
205
206
## Power Saving Modes ##
207
208
For build machines that are not personal machines, disabling certain options will help in connectivity and responsiveness:
209
210
~~~~~~
211
Under Spotlight
212
 - disabled the main HD. (multiple mdworkers taking up a lot of cpu.)
213
~~~~~~
214
215
~~~~~~
216
Under Energy Saver
217
 - Computer sleep: Set to never
218
 - Unchecked Put hard disks to sleep when possible
219
 - Unchecked Wake for network access
220
~~~~~~
221
222
&nbsp;
223
&nbsp;
224
&nbsp;
225
&nbsp;
226
&nbsp;
227
&nbsp;
228
&nbsp;
229
&nbsp;
230 29 John Cary
&nbsp;
231
&nbsp;
232
233
---
234 31 John Cary
235 1 Redmine Admin
---
236 31 John Cary
237
## X11 ##
238
239
X11 should not be needed, but if it is needed:
240
241
Install [XQuartz X11](http://xquartz.macosforge.org/landing/).
242
243
Create a symbolic link so that the X11 headers can be found by the compiler:
244
245
~~~~~~
246 1 Redmine Admin
sudo ln -s /opt/X11/include/X11 /usr/local/include/X11
247 31 John Cary
~~~~~~
248
249
# DEPRECATED INSTRUCTIONS #
250
251
252
## Other gfortran options (besides HomeBrew) ##
253
254
### Option 2: HPC ###
255
256
Install gfortran from [SourceForge HPC](http://hpc.sourceforge.net).  (Do not also install the other gcc compilers.)
257
258
As of March 29, 2015, the version is 4.9.0.
259
260
Install via
261
262
~~~~~~
263
$ tar xzf gfortran-4.9-bin.tar.gz -C /
264
~~~~~~
265
266
### Option 3: GNU ###
267
268
Install gfortran using the installer from <http://gcc.gnu.org/wiki/GFortranBinaries>.
269
270
As of March 29, 2015, the version is 4.9.0.
271 30 John Cary
272
The binaries will end up being installed in /usr/local/bin
273
274
275 11 Redmine Admin
## Git ##
276 1 Redmine Admin
277 10 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.
278
279
280 11 Redmine Admin
### Macports ### 
281
282
This provides wget, freetype, and other utilities. Get macports from <http://www.macports.org/install.php> and install.
283 10 Redmine Admin
284 29 John Cary
Note: Before proceeding with the installation of various macports packages noted below on Lion machines with Xcode 4.3, one needs to run
285 10 Redmine Admin
286
~~~~~~
287
sudo xcode-select -switch /Applications/Xcode.app
288 11 Redmine Admin
~~~~~~
289
290 1 Redmine Admin
Otherwise, there will be an error installing zlib during the wget installation below.
291
292 29 John Cary
After the macports installation, do
293
294
~~~~~~
295 1 Redmine Admin
sudo port install wget
296
sudo port install ImageMagick +no_x11
297
sudo port install f2c
298
~~~~~~
299
300 11 Redmine Admin
301 1 Redmine Admin
### XCode ###
302
### Lion ###
303
304 2 Redmine Admin
On Lion, the command line compilers are not installed automatically. After installing Xcode, navigate to the 
305 1 Redmine Admin
Preferences->Download dialog 
306
and install the Command Line Tools. The dialog is.. 
307
308
!screenShotCommandLineTools.png!
309 11 Redmine Admin
310 29 John Cary
or from the command line do
311
312 1 Redmine Admin
~~~~~~
313
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
314
xcodebuild
315
      (hit agree)
316
~~~~~~
317
318
You may subsequently need to build your first package with sudo in order to accept the Xcode licenses.
319
320
### Mountain Lion ### 
321
322
Same as Mavericks?
323 2 Redmine Admin
324 29 John Cary
### Mavericks ###
325 1 Redmine Admin
326
~~~~~~
327
sudo xcode-select --install
328
~~~~~~
329
330
331
## Java ##
332
333
(The below does not apply to yosemite.)
334
335 29 John Cary
The cmake build may fail due to missing java headers linked to in /System/Library/Frameworks/JavaVM.framework/Headers. To fix:
336
337 1 Redmine Admin
~~~~~~
338
cd /System/Library/Frameworks/JavaVM.framework/Headers
339
sudo mv jni.h jni.h.missing
340
~~~~~~