Building lld

I tried to build lld by following these steps: https://lld.llvm.org/getting_started.html

But after ‘make install’ I can’t find lld anywhere and ‘make check-lld’ results in this message:

make: *** No rule to make target ‘check-lld’. Stop.

Any idea?

lld is installed as ld.lld, so please look for ld.lld.

I tried deleting my build directory and restarting from scratch

$ cd llvm-project
$ mkdir build && cd build
$ cmake -G "Unix Makefiles" -DLLVM_ENABLE_PROJECTS=lld ../llvm
$ make

I got this error:

make[2]: *** No rule to make target ‘llvm/cmake/modules/GenerateVersionFromVCS.cmake’, needed by ‘tools/lld/Common/VCSVersion.inc’. Stop.

CMakeFiles/Makefile2:57166: recipe for target ‘tools/lld/Common/CMakeFiles/lldCommon.dir/all’ failed

make[1]: *** [tools/lld/Common/CMakeFiles/lldCommon.dir/all] Error 2

Makefile:151: recipe for target ‘all’ failed

Any idea?

Hmm … does the file llvm-project/llvm/cmake/modules/GenerateVersionFromVCS.cmake exist? Can you git pull, and does git status show any changes?

Judging by this path:

needed by ‘tools/lld/Common/VCSVersion.inc’

It looks to me like this is not a monorepo layout (if it were, lld would not appear in the tools directory). Therefore the LLVM_ENABLE_PROJECTS=lld is not even doing anything.

I don’t know how to build without a monorepo these days, and I also don’t know what the most recent guidance setting up a monorepo is, but maybe someone else can chime in.

The way I’m having it set up, inside my llvm-project directory, there are 3 sub-directories at the same level: llvm, build and lld

What URL did you clone from?

Did you follow the instruction on https://lld.llvm.org/getting_started.html? I mean is this what you typed in?

$ git clone https://github.com/llvm/llvm-project.git

$ cd llvm-project
$ mkdir build && cd build
$ cmake -G “Unix Makefiles” -DLLVM_ENABLE_PROJECTS=lld …/llvm
$ make