0
$\begingroup$

I'm trying to build HSL's MA57 library, and to do so, it requires METIS. I've downloaded the .tar files to my Downloads folder, but where do I actually "build" the libraries (and subsequently store the compiled files) on a Mac? Is there a best practices location, like usr/local?

$\endgroup$
  • 1
    $\begingroup$ I would highly recommend using homebrew on the mac to build if you can for any standard science libraries and following their directory conventions as they seem to work well and are largely recognized. I was not aware of the distinction that @rchilton1980 mentioned which is interesting. $\endgroup$ – Kyle Mandli Jan 23 '18 at 14:58
  • $\begingroup$ Thanks -- this project using homebrew seems to install them to usr/local $\endgroup$ – jjjjjj Jan 23 '18 at 16:16
1
$\begingroup$

I don't think there's any one right answer here. I tend to put non-system libraries in /opt, then add link directives for them manually to the Makefiles etc of whatever apps are looking for them (eg, add -L/opt/path/to/metis and -lmetis to the Makefile of MA57). It's a compromise between putting it somewhere easy to find, but trying to be hygienic and keep your installs out of the system packages. This is probably a little old school, so ymmv.

See also, https://unix.stackexchange.com/questions/11544/what-is-the-difference-between-opt-and-usr-local

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks, and to better understand nomenclature, does opt mean "optional"? I couldn't find additional detail under man hier but am getting that vibe from this Q $\endgroup$ – jjjjjj Jan 23 '18 at 3:10
  • 1
    $\begingroup$ That's what I have always taken it to mean, but I actually don't know for certain. $\endgroup$ – rchilton1980 Jan 23 '18 at 3:13
  • $\begingroup$ Last question: what's the -l mean in your path -l/opt/path...? $\endgroup$ – jjjjjj Jan 23 '18 at 3:14
  • 1
    $\begingroup$ It's not a path, that's a .. link directive? Essentially a compiler (linker) flag, directing gcc or clang to add /that/path/there to the search. Similar effect as appending to LD_LIBRARY_PATH, but perhaps a little less permanent. There is a similar one for include searches, `-I'. $\endgroup$ – rchilton1980 Jan 23 '18 at 3:17
  • 1
    $\begingroup$ Practice makes perfect. Unfortunately, I find this is the sort of thing you tinker with maddeningly until it works, then promptly forget everything for next time. I even messed it up in my answer .. adding linker paths uses the -L flag, while linking itself uses -l. See gcc.gnu.org/onlinedocs/gcc/Link-Options.html $\endgroup$ – rchilton1980 Jan 23 '18 at 3:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.