llvm-hs/homebrew-llvm

llvm-8 fails to build on Mojave

FranklinChen opened this issue · 12 comments

I am running macOS Mojave 10.14.4 and Xcode Version 10.2.1 (10E1001).

brew install llvm-8
==> Installing llvm-8 from llvm-hs/llvm
==> Downloading http://releases.llvm.org/8.0.0/llvm-8.0.0.src.tar.xz
Already downloaded: /Users/chen/Library/Caches/Homebrew/downloads/ce9a28830d981a8d69a2497789d73dc876aa63218086804d3435f2ef54e37a24--llvm-8.0.0.src.tar.xz
==> Downloading http://releases.llvm.org/8.0.0/cfe-8.0.0.src.tar.xz
Already downloaded: /Users/chen/Library/Caches/Homebrew/downloads/abc19e0d895d1933d01ecded22ba3029f807711bccc860a83b5a48752698f2a4--cfe-8.0.0.src.tar.xz
==> Downloading http://releases.llvm.org/8.0.0/libcxx-8.0.0.src.tar.xz
Already downloaded: /Users/chen/Library/Caches/Homebrew/downloads/f95ddd38e8d37fb9496c4a49225bd4b5875378965233127dc19cdee6c4a037e9--libcxx-8.0.0.src.tar.xz
==> Downloading http://releases.llvm.org/8.0.0/lld-8.0.0.src.tar.xz
Already downloaded: /Users/chen/Library/Caches/Homebrew/downloads/15c586d35bf68419d527d887a6752ca12ef9f28200520f3572f40800dd442177--lld-8.0.0.src.tar.xz
==> Downloading http://releases.llvm.org/8.0.0/polly-8.0.0.src.tar.xz
Already downloaded: /Users/chen/Library/Caches/Homebrew/downloads/9a02a4a6f2d3ec3746ad18d88ea2ce494ef6b584bc1ef2ef48015b3fe9317968--polly-8.0.0.src.tar.xz
==> Downloading http://releases.llvm.org/8.0.0/clang-tools-extra-8.0.0.src.tar.x
Already downloaded: /Users/chen/Library/Caches/Homebrew/downloads/efd12162cf0860ee0c3a5b0aef718292633060e253a4f6498e595480fafcb8d1--clang-tools-extra-8.0.0.src.tar.xz
==> Downloading http://releases.llvm.org/8.0.0/openmp-8.0.0.src.tar.xz
Already downloaded: /Users/chen/Library/Caches/Homebrew/downloads/87d7a1022e731ba88a47bed3faa79c5a11ca559e9d3e577970a6ed58e442ef17--openmp-8.0.0.src.tar.xz
==> Downloading http://releases.llvm.org/8.0.0/libunwind-8.0.0.src.tar.xz
Already downloaded: /Users/chen/Library/Caches/Homebrew/downloads/a8ab1750be81b56c665395ae4c57406e6efae08e1efe682d52f25ae5c8cfa866--libunwind-8.0.0.src.tar.xz
==> Downloading http://releases.llvm.org/8.0.0/compiler-rt-8.0.0.src.tar.xz
Already downloaded: /Users/chen/Library/Caches/Homebrew/downloads/39e498202c060f1ff0774ff09f524b4acdde76353955eacb3d238ce2f7fb5bbd--compiler-rt-8.0.0.src.tar.xz
==> cmake -G Unix Makefiles .. -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAG
Last 15 lines from /Users/chen/Library/Logs/Homebrew/llvm-8/01.cmake:
  command.


CMake Warning at tools/xcode-toolchain/CMakeLists.txt:60 (message):
  Failed to detect the version of an installed copy of Xcode, falling back to
  highest supported version.  Set XCODE_VERSION to override.


CMake Error at tools/xcode-toolchain/CMakeLists.txt:80 (message):
  Could not identify toolchain dir


-- Configuring incomplete, errors occurred!
See also "/tmp/llvm-8-20190424-3986-w703j9/llvm-8.0.0.src/build/CMakeFiles/CMakeOutput.log".
See also "/tmp/llvm-8-20190424-3986-w703j9/llvm-8.0.0.src/build/CMakeFiles/CMakeError.log".

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
  https://github.com/llvm-hs/homebrew-llvm/issues

Failed to detect the version of an installed copy of Xcode

well, do you have Xcode installed?

Try xcode-select -h and make sure that is set up correctly.

I am running macOS Mojave 10.14.4 and Xcode Version 10.2.1 (10E1001).

$ xcode-select -h
Usage: xcode-select [options]

Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example,
xcodebuild) as well as the BSD development commands (such as cc and make).

Options:
  -h, --help                  print this help message and exit
  -p, --print-path            print the path of the active developer directory
  -s <path>, --switch <path>  set the path for the active developer directory
  --install                   open a dialog for installation of the command line developer tools
  -v, --version               print the xcode-select version
  -r, --reset                 reset to the default command line tools path

Yes, I saw that. But, did you read the error message, and then the output from xcode-select? I am asking you to check that your Xcode is configured properly.

I am running macOS Mojave 10.14.4 and Xcode Version 10.2.1 (10E1001).

$ xcode-select -h
Usage: xcode-select [options]

Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example,
xcodebuild) as well as the BSD development commands (such as cc and make).

Options:
  -h, --help                  print this help message and exit
  -p, --print-path            print the path of the active developer directory
  -s <path>, --switch <path>  set the path for the active developer directory
  --install                   open a dialog for installation of the command line developer tools
  -v, --version               print the xcode-select version
  -r, --reset                 reset to the default command line tools path

I don't know what else you want besides xcode-select -h which I sent you twice. Here's more xcode-select output:

$ xcode-select --version
xcode-select version 2354.
$ xcode-select --print-path
/Library/Developer/CommandLineTools

I don't know what else you want

I want you to actually read the messages you are pasting here, and to think about what they are trying to tell you.

$ xcode-select --print-path
/Library/Developer/CommandLineTools

Finally. Now, does this match what you expect?

Here is what I get:

$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

In summary, you do not have Xcode installed. Install Xcode and try again.

To clarify, you have the Xcode command line tools package installed, a kind of minimal compiler setup. For most things that is all you need, but here you do need to install the full Xcode application, available from the Mac App Store.

I don't understand why you are telling me I don't have Xcode installed, when I launched it before opening this issue specifically so that I could give as much info as I could:

I am running macOS Mojave 10.14.4 and Xcode Version 10.2.1 (10E1001).

image

I just went to Xcode's Preferences/Locations and saw that Command Line Tools was blank and I clicked it and it filled in "Xcode 10.2.1 (10E1001)". I don't understand why Xcode's installation path got messed up after my latest update (on April 18, 2019), but at least now I know to fix it in the future if it happens again.

I also found that I could have done this with the command line using sudo xcode-select -s /Applications/Xcode.app/Contents/Developer without having to launch the Xcode app and go to Preferences. Next time I get an error message from something that says I don't have Xcode installed, I'll just run this command to fix the path. Maybe the CMake error message could have offered this suggestion.

I have no idea why this happened for you either, I have basically the same setup. I don't think I even opened Xcode after installing it and it was set up correctly for me (I only use the command line tools).

I apologise for being particularly harsh on you in this discussion, that was unnecessary...