1

I have installed llvm with brew install llvm and it shows up as installed with brew list.

% brew list
... llvm ...
% brew --prefix
/usr/local
% brew --version
Homebrew 3.3.9
...

The lld binary (with various symbolic aliases) shows up in Cellar. For example, ld.lld is a symbolic link back to lld:

% ls -l /usr/local/Cellar/llvm/13.0.0_2/bin/ld.lld
lrwxr-xr-x  1 chris  admin  3 Sep 24 09:18 /usr/local/Cellar/llvm/13.0.0_2/bin/ld.lld@ -> lld

When I run the ld.lld binary it says:

% /usr/local/Cellar/llvm/13.0.0_2/bin/ld.lld --version
Homebrew LLD 13.0.0 (compatible with GNU linkers)

However, lld or ld.lld isn't being linked into /usr/local/bin or anywhere standard that I could find.

% ls /usr/local/bin/lld
ls: /usr/local/bin/lld: No such file or directory
% ls /usr/local/bin/ld.lld
ls: /usr/local/bin/ld.lld: No such file or directory

I don't want to put a long brittle link to ld.lld in a script. Any idea why it's not getting linked into a standard location?

1 Answer 1

5

You can easily find out an answer to your question with the command brew info llvm, which will show this:

llvm is keg-only, which means it was not symlinked into /usr/local, because macOS already provides this software and installing another version in parallel can cause all kinds of trouble.

If you need to have llvm first in your PATH, run: echo 'export PATH="/usr/local/opt/llvm/bin:$PATH"' >> ~/.zshrc

For compilers to find llvm you may need to set: export LDFLAGS="-L/usr/local/opt/llvm/lib" export CPPFLAGS="-I/usr/local/opt/llvm/include"

Supposing you already use CMake, then to add linking info to your CMakeLists.txt file may be accomplished as described in following:

1 question.

2 CMake documentation.

3 helpful introductory notes.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .