Preparing a Mac machine for Bilder » History » Version 66
John Cary, 11/27/2019 02:29 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 | 64 | Nathan Neri | Install Xcode. To obtain version 10.3 (10.x is required for c++17), 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 | 1 | Redmine Admin | |
29 | ~~~~~~ |
||
30 | 31 | John Cary | sudo xcode-select --install |
31 | 1 | Redmine Admin | ~~~~~~ |
32 | |||
33 | 63 | David Alexander | With mojave, one must additionally open the XCode app and install the command line tools or execute this command: |
34 | 35 | John Cary | |
35 | ~~~~~~ |
||
36 | sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target / |
||
37 | ~~~~~~ |
||
38 | |||
39 | 65 | David Alexander | or use the graphical interface with |
40 | |||
41 | ~~~~~~ |
||
42 | 66 | John Cary | open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg |
43 | 65 | David Alexander | ~~~~~~ |
44 | |||
45 | The exact name of the pkg might be different in the future. This page 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 find the default SDK path and then one can find the exact package name. |
||
46 | 35 | John Cary | |
47 | 1 | Redmine Admin | ## HomeBrew ## |
48 | |||
49 | 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. |
||
50 | |||
51 | 14 | John Cary | HomeBrew requires that one not have root privileges. So we make the directory into which we can write: |
52 | 1 | Redmine Admin | |
53 | ~~~~~~ |
||
54 | 29 | John Cary | sudo -s |
55 | mkdir -p /opt/homebrew |
||
56 | chgrp -R admin /opt |
||
57 | chmod -R 775 /opt |
||
58 | chmod -R 2775 /opt/homebrew |
||
59 | exit |
||
60 | 14 | John Cary | ~~~~~~ |
61 | |||
62 | and then we work as nonroot: |
||
63 | |||
64 | ~~~~~~ |
||
65 | 29 | John Cary | cd /opt |
66 | 57 | John Cary | # curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew |
67 | git clone https://github.com/Homebrew/brew.git homebrew |
||
68 | 39 | David Alexander | ~~~~~~ |
69 | |||
70 | ~~~~~~ |
||
71 | 29 | John Cary | chmod -R a+rX /opt/homebrew |
72 | 14 | John Cary | find /opt/homebrew -type l -exec chmod -h a+r '{}' \; |
73 | 1 | Redmine Admin | ~~~~~~ |
74 | |||
75 | 39 | David Alexander | These last too lines can be reused at anytime there is a permissions problem. |
76 | 1 | Redmine Admin | |
77 | 39 | David Alexander | As root again execute these lines to pick up some paths in the defaults paths: |
78 | |||
79 | 1 | Redmine Admin | ~~~~~~ |
80 | 29 | John Cary | sudo -s |
81 | echo "/opt/homebrew/bin" > /etc/paths.d/homebrew |
||
82 | echo "/opt/homebrew/share/man" > /etc/manpaths.d/homebrew |
||
83 | chmod a+r /etc/paths.d/homebrew /etc/manpaths.d/homebrew |
||
84 | exit |
||
85 | 1 | Redmine Admin | ~~~~~~ |
86 | |||
87 | Get the required packages... |
||
88 | |||
89 | ~~~~~~ |
||
90 | 29 | John Cary | brew install gnupg libpng freetype gd ghostscript |
91 | 1 | Redmine Admin | ~~~~~~ |
92 | |||
93 | 16 | John Cary | Nice to have: |
94 | 1 | Redmine Admin | |
95 | 16 | John Cary | ~~~~~~ |
96 | 29 | John Cary | brew install imagemagick |
97 | 16 | John Cary | ~~~~~~ |
98 | |||
99 | 45 | Nathan Neri | git large file support (for VisIt) |
100 | |||
101 | ~~~~~~ |
||
102 | brew install git-lfs |
||
103 | 56 | Nathan Neri | git lfs install --force --skip-smudge |
104 | 45 | Nathan Neri | ~~~~~~ |
105 | |||
106 | 25 | David Howdle | For Qt5: |
107 | |||
108 | ~~~~~~ |
||
109 | brew install bison flex gperf libcapn |
||
110 | 1 | Redmine Admin | ~~~~~~ |
111 | 25 | David Howdle | |
112 | 39 | David Alexander | To get fortran, which comes with the gcc compiler: |
113 | 1 | Redmine Admin | |
114 | ~~~~~~ |
||
115 | 62 | John Cary | brew install gcc@8 |
116 | 1 | Redmine Admin | ~~~~~~ |
117 | |||
118 | 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. |
119 | 1 | Redmine Admin | |
120 | 39 | David Alexander | OPTIONAL: |
121 | |||
122 | If you receive an error regarding ruby version: |
||
123 | |||
124 | ~~~~~~ |
||
125 | brew install ruby@2.3 |
||
126 | ~~~~~~ |
||
127 | |||
128 | may help. |
||
129 | |||
130 | 1 | Redmine Admin | |
131 | ## LaTeX ## |
||
132 | |||
133 | 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: |
||
134 | 29 | John Cary | |
135 | ~~~~~~ |
||
136 | 1 | Redmine Admin | setenv PATH /usr/texbin:${PATH} # For tcsh |
137 | 13 | Redmine Admin | export PATH=/usr/texbin:${PATH} # For bash |
138 | 1 | Redmine Admin | ~~~~~~ |
139 | |||
140 | 13 | Redmine Admin | For those who like GUIs, the !TeXworks in /Applications/TeX/TeXworks should work fine. |
141 | |||
142 | For those with limited space, install BasicTeX from <https://tug.org/mactex/morepackages.html>. Add to your PATH: |
||
143 | 32 | John Cary | |
144 | 13 | Redmine Admin | ~~~~~~ |
145 | /usr/local/texlive/2017/bin/universal-darwin/ |
||
146 | 32 | John Cary | ~~~~~~ |
147 | 1 | Redmine Admin | |
148 | 32 | John Cary | and then install the packages noted at |
149 | 29 | John Cary | |
150 | 32 | John Cary | [[LaTeX packages needed by Bilder]] |
151 | 1 | Redmine Admin | |
152 | You may need to use sudo. |
||
153 | 32 | John Cary | |
154 | ~~~~~~ |
||
155 | 1 | Redmine Admin | sudo tlmgr update --self |
156 | 29 | John Cary | sudo tlmgr install <needed packages> |
157 | 32 | John Cary | ~~~~~~ |
158 | |||
159 | 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. |
160 | |||
161 | |||
162 | ## Disable spindump ## |
||
163 | |||
164 | for faster compilations via |
||
165 | |||
166 | 29 | John Cary | ~~~~~~ |
167 | 11 | Redmine Admin | sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.spindump.plist |
168 | 34 | John Cary | ~~~~~~ |
169 | |||
170 | ## LLVM-Clang ## |
||
171 | |||
172 | 58 | John Cary | 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. |
173 | |||
174 | We use homebrew to install this with |
||
175 | |||
176 | ~~~~~~ |
||
177 | brew install llvm |
||
178 | ~~~~~~ |
||
179 | |||
180 | Then link it into place using |
||
181 | |||
182 | ~~~~~~ |
||
183 | cd /opt |
||
184 | 61 | John Cary | rm -f llvmclang |
185 | 60 | John Cary | ln -s /opt/homebrew/Cellar/llvm/8.0.1 llvmclang |
186 | 58 | John Cary | ~~~~~~ |
187 | |||
188 | NOT RECOMMENDED |
||
189 | |||
190 | You can also build from the llvm repo, but we have not worked out the configuration args. |
||
191 | 1 | Redmine Admin | |
192 | 48 | Nathan Neri | ~~~~~~ |
193 | cd /opt |
||
194 | 54 | David Alexander | git clone -b <Branch> https://github.com/llvm/llvm-project.git llvm-<Version> |
195 | 53 | David Alexander | # You can see the branches you can clone at https://github.com/llvm/llvm-project |
196 | 54 | David Alexander | # e.g. git clone -b llvmorg-8.0.0 https://github.com/llvm/llvm-project.git llvm-8.0.0 |
197 | 48 | Nathan Neri | ~~~~~~ |
198 | 1 | Redmine Admin | |
199 | 48 | Nathan Neri | To configure and build: |
200 | 49 | Nathan Neri | |
201 | 48 | Nathan Neri | ~~~~~~ |
202 | cd /opt/llvm-<Version> |
||
203 | 1 | Redmine Admin | mkdir build |
204 | cd build |
||
205 | 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 |
206 | 54 | David Alexander | make # Add appropriate -j argument for the machine to build faster |
207 | # with -j 8 on qamojavellvm the build and installation took a little under an hour |
||
208 | 48 | Nathan Neri | make install |
209 | ~~~~~~ |
||
210 | 1 | Redmine Admin | |
211 | 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: |
212 | 43 | Tech-X Corporation | |
213 | 44 | Tech-X Corporation | ~~~~~~ |
214 | 43 | Tech-X Corporation | cd /opt |
215 | 48 | Nathan Neri | sudo ln -s llvm-<Version>/install llvmclang |
216 | 44 | Tech-X Corporation | ~~~~~~ |
217 | 43 | Tech-X Corporation | |
218 | 11 | Redmine Admin | ## Java ## |
219 | |||
220 | You will need to install java by invoking the executable in any way such as... |
||
221 | |||
222 | ~~~~~~ |
||
223 | java -version |
||
224 | 1 | Redmine Admin | ~~~~~~ |
225 | |||
226 | 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) |
||
227 | |||
228 | ## HostName ## |
||
229 | 2 | Redmine Admin | |
230 | 1 | Redmine Admin | For bilder to properly send emails the fully qualified hostname must set on the machine. To check this try... |
231 | 31 | John Cary | |
232 | 29 | John Cary | ~~~~~~ |
233 | 1 | Redmine Admin | hostname -f |
234 | ~~~~~~ |
||
235 | |||
236 | 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. |
||
237 | |||
238 | ~~~~~~ |
||
239 | sudo scutil --set ComputerName "machinename" |
||
240 | sudo scutil --set LocalHostName "machinename" |
||
241 | sudo scutil --set HostName "machinename.domainname.com" |
||
242 | dscacheutil -flushcache |
||
243 | ~~~~~~ |
||
244 | |||
245 | Restart your Mac after this. |
||
246 | |||
247 | ## Power Saving Modes ## |
||
248 | |||
249 | For build machines that are not personal machines, disabling certain options will help in connectivity and responsiveness: |
||
250 | |||
251 | ~~~~~~ |
||
252 | Under Spotlight |
||
253 | - disabled the main HD. (multiple mdworkers taking up a lot of cpu.) |
||
254 | ~~~~~~ |
||
255 | |||
256 | ~~~~~~ |
||
257 | Under Energy Saver |
||
258 | - Computer sleep: Set to never |
||
259 | - Unchecked Put hard disks to sleep when possible |
||
260 | - Unchecked Wake for network access |
||
261 | ~~~~~~ |
||
262 | |||
263 | |
||
264 | |
||
265 | |
||
266 | |
||
267 | |
||
268 | |
||
269 | |
||
270 | |
||
271 | |
||
272 | 29 | John Cary | |
273 | |||
274 | --- |
||
275 | |||
276 | 31 | John Cary | --- |
277 | 1 | Redmine Admin | |
278 | 31 | John Cary | ## X11 ## |
279 | |||
280 | X11 should not be needed, but if it is needed: |
||
281 | |||
282 | Install [XQuartz X11](http://xquartz.macosforge.org/landing/). |
||
283 | |||
284 | Create a symbolic link so that the X11 headers can be found by the compiler: |
||
285 | |||
286 | ~~~~~~ |
||
287 | sudo ln -s /opt/X11/include/X11 /usr/local/include/X11 |
||
288 | 1 | Redmine Admin | ~~~~~~ |
289 | 31 | John Cary | |
290 | # DEPRECATED INSTRUCTIONS # |
||
291 | |||
292 | |||
293 | ## Other gfortran options (besides HomeBrew) ## |
||
294 | |||
295 | ### Option 2: HPC ### |
||
296 | |||
297 | Install gfortran from [SourceForge HPC](http://hpc.sourceforge.net). (Do not also install the other gcc compilers.) |
||
298 | |||
299 | As of March 29, 2015, the version is 4.9.0. |
||
300 | |||
301 | Install via |
||
302 | |||
303 | ~~~~~~ |
||
304 | $ tar xzf gfortran-4.9-bin.tar.gz -C / |
||
305 | ~~~~~~ |
||
306 | |||
307 | ### Option 3: GNU ### |
||
308 | |||
309 | Install gfortran using the installer from <http://gcc.gnu.org/wiki/GFortranBinaries>. |
||
310 | |||
311 | As of March 29, 2015, the version is 4.9.0. |
||
312 | |||
313 | 30 | John Cary | The binaries will end up being installed in /usr/local/bin |
314 | |||
315 | |||
316 | ## Git ## |
||
317 | 11 | Redmine Admin | |
318 | 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. |
319 | 10 | Redmine Admin | |
320 | |||
321 | ### Macports ### |
||
322 | 11 | Redmine Admin | |
323 | This provides wget, freetype, and other utilities. Get macports from <http://www.macports.org/install.php> and install. |
||
324 | |||
325 | 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 |
326 | 29 | John Cary | |
327 | 10 | Redmine Admin | ~~~~~~ |
328 | sudo xcode-select -switch /Applications/Xcode.app |
||
329 | ~~~~~~ |
||
330 | 11 | Redmine Admin | |
331 | Otherwise, there will be an error installing zlib during the wget installation below. |
||
332 | 1 | Redmine Admin | |
333 | After the macports installation, do |
||
334 | 29 | John Cary | |
335 | ~~~~~~ |
||
336 | sudo port install wget |
||
337 | 1 | Redmine Admin | sudo port install ImageMagick +no_x11 |
338 | sudo port install f2c |
||
339 | ~~~~~~ |
||
340 | |||
341 | |||
342 | 11 | Redmine Admin | ### XCode ### |
343 | 1 | Redmine Admin | ### Lion ### |
344 | |||
345 | On Lion, the command line compilers are not installed automatically. After installing Xcode, navigate to the |
||
346 | 2 | Redmine Admin | Preferences->Download dialog |
347 | 1 | Redmine Admin | and install the Command Line Tools. The dialog is.. |
348 | |||
349 | !screenShotCommandLineTools.png! |
||
350 | |||
351 | 11 | Redmine Admin | or from the command line do |
352 | 29 | John Cary | |
353 | ~~~~~~ |
||
354 | 1 | Redmine Admin | sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/ |
355 | xcodebuild |
||
356 | (hit agree) |
||
357 | ~~~~~~ |
||
358 | |||
359 | You may subsequently need to build your first package with sudo in order to accept the Xcode licenses. |
||
360 | |||
361 | ### Mountain Lion ### |
||
362 | |||
363 | Same as Mavericks? |
||
364 | |||
365 | 2 | Redmine Admin | ### Mavericks ### |
366 | 29 | John Cary | |
367 | 1 | Redmine Admin | ~~~~~~ |
368 | sudo xcode-select --install |
||
369 | ~~~~~~ |
||
370 | |||
371 | |||
372 | ## Java ## |
||
373 | |||
374 | (The below does not apply to yosemite.) |
||
375 | |||
376 | The cmake build may fail due to missing java headers linked to in /System/Library/Frameworks/JavaVM.framework/Headers. To fix: |
||
377 | 29 | John Cary | |
378 | ~~~~~~ |
||
379 | 1 | Redmine Admin | cd /System/Library/Frameworks/JavaVM.framework/Headers |
380 | sudo mv jni.h jni.h.missing |
||
381 | ~~~~~~ |