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