Issues compiling 15.0.7

I’m trying to compile LLVM 15.0.7 from src, but I’m stuck. It seems I got this problem, and the solution at the end doesn’t work (the cmake folder is already in the right location, from what I understand).

I followed the guidelines in Building LLVM with CMake, but I’m stuck already at the first CMake.

The error:

CMake Error at cmake/modules/CMakeLists.txt:1 (include):
  include could not find requested file:

    ExtendPath

CMake Error at cmake/modules/CMakeLists.txt:3 (include):
  include could not find requested file:

    FindPrefixFromConfig

CMake Error at cmake/modules/CMakeLists.txt:116 (find_prefix_from_config):
  Unknown CMake command "find_prefix_from_config".

I’m on macOS Big Sur (11.7.4) (Intel Mac).

The actual command line is:

cmake -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DLLVM_TARGETS_TO_BUILD="X86;AArch64" -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_ENABLE_FFI=OFF -DLLVM_ENABLE_ZLIB=OFF -DLLVM_BUILD_DOCS=OFF -DLLVM_INCLUDE_DOCS=OFF -DLLVM_BINARY_DIR=/opt/llvm -DBUILD_SHARED_LIBS=OFF -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_INCLUDE_TESTS=OFF -DLLVM_ENABLE_Z3_SOLVER=OFF -DLLVM_ENABLE_LIBXML2=OFF /var/cache/omnibus/src/llvm-15.0.7.src

Note: I edited the config-ix.cmake file to skip the libedit search, because I had this issue:

    CMake Error at CMakeLists.txt:327 (include):
  include could not find requested file:

    GNUInstallPackageDir

CMake Warning at cmake/config-ix.cmake:223 (find_package):
  By not providing "FindLibEdit.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "LibEdit", but
  CMake did not find one.

  Could not find a package configuration file provided by "LibEdit" with any
  of the following names:

    LibEditConfig.cmake
    libedit-config.cmake

Any help is appreciated. Thanks a lot!

To someone having this issue: I misunderstood the necessary steps:

  • Download cmake-15.0.7.tar.xz from the llvm15.0.7 release page.
  • Extract the context of the ./Modules subfolder into the ./cmake/modules folder of the llvm sources.
  • When executing the cmake command, pass the -DLLVM_INCLUDE_BENCHMARKS=OFF if you don’t have the benchmarks folder.