spack / spack

A flexible package manager that supports multiple versions, configurations, platforms, and compilers.
https://spack.io
Other
4.26k stars 2.26k forks source link

macOS: Fail Fast without Xcode + Command Line Tools #7151

Open citibeth opened 6 years ago

citibeth commented 6 years ago

When building on Mac (using default compilers), it is necessary to have Xcode and Command Line tools installed. Apple unfortunately doesn't make this easy. If you installed Xcode but not CLT, things will go ahead just fine, but some stuff won't work.

During setup (creating of compilers.yaml), Spack should check that Xcode and Command Line Tools are installed; and if not, complain with an error, telling the user how to install the required stuff. This will be the right thing to do on 99% of Macs. For the remaining 1%, maybe there should be an override to ignore the error, or have the user create compilers.yaml manually.

adamjstewart commented 6 years ago

I added some Xcode auto-detection stuff in lib/spack/spack/compilers/clang.py with warning messages if the full Xcode suite is not installed. Perhaps this can be expanded on.

goxberry commented 6 years ago

Given the cross-platform nature of spack, the CLT seems like the more important piece.

The more I look into it, it seems as though there's an XCode equivalent for everything that the CLT installs -- the latest example I've run into is OpenGL/GLU:

XCode: -framework OpenGL CLT: -I/usr/X11R6/include -L/usr/X11R6/lib -lGL -lGLU

Of these, the CLT behave more *nix-like, and are probably easier to work with, but there may be the odd package that requires xcodebuild, for whatever reason (e.g., Apple's open source libraries sometimes only have XCode build system files, like https://github.com/opensource-apple/dtrace).

citibeth commented 6 years ago

All I know is... everyone says you have to have CLT for builds to work. For example, I installed a binary-download of gfortran. It didn't work without CLT installed (and that was a common complaint outside of Spack as well). Once I installed CLT, the problems went away.

Without going too deep, my conclusion is that CLT is required for most anything one would want to build with Spack.

mathstuf commented 6 years ago

@goxberry You can use -framework with the CLT as well. Nothing special there (it's just the defaults that tend to be used by Xcode versus autoconf and CMake).

goxberry commented 6 years ago

Agreed; I used to do that, but it’s better avoided in spack when possible to reduce the number of conditionals in packages.

On Mon, Feb 5, 2018 at 12:52 Ben Boeckel notifications@github.com wrote:

@goxberry https://github.com/goxberry You can use -framework with the CLT as well. Nothing special there (it's just the defaults that tend to be used by Xcode versus autoconf and CMake).

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/spack/spack/issues/7151#issuecomment-363217475, or mute the thread https://github.com/notifications/unsubscribe-auth/AATnxxmHQghy-Z2dqqiMqxgj_xUymq9fks5tR2n6gaJpZM4R0fm3 .

-- Geoffrey Oxberry, Ph.D., E.I.T. goxberry@gmail.com