rust-cross/cargo-xwin

clang-cl missing on macOS (Install Apple Command Line Developer tools)

GregoryConrad opened this issue · 2 comments

This is simply a solution on how to fix an error I encountered during a build using a crate that has C/C++ dependencies on macOS.

The Problem

When building a crate with C/C++ dependencies on macOS, you get a system prompt asking you to install the command line tools again, even if you already have them installed. (Installing them again also does not fix the issue.)

@messense Perhaps there could be a more descriptive error message for macOS specifically, although the issue is easy enough to fix on the user's end (see below). Also, thank you for this amazing project (& zigbuild)!

The Fix

From the README:

  1. For C/C++ dependencies, install clang.

Run brew install llvm (you don't need to adjust your path at all, just the brew install is fine), because Apple's llvm/clang does not have clang-cl. Brew's llvm has clang-cl bundled with it and that solves the issue.

@messense if you don't want to take any additional action here, feel free to close the issue. But I'll leave it open for now in case you think there should be a more descriptive error message.

When building a crate with C/C++ dependencies on macOS, you get a system prompt asking you to install the command line tools again, even if you already have them installed. (Installing them again also does not fix the issue.)

Thanks for reporting, I've never encountered that since I already have llvm installed from brew. Added brew install llvm instruction to readme.