CMake broken?

Hi all,

CMake seems to have broken in the last few days - or is it just me?

tcare:llvm-release tcare$ make -j4
-- Target triple: x86_64-apple-darwin10.5.0
-- Native target architecture is X86
-- Threads enabled.
-- Building with -fPIC
-- Targeting X86
CMake Error at cmake/modules/LLVMConfig.cmake:90 (message):
  Library LLVMARMAsmParser not found in list of llvm libraries.
Call Stack (most recent call first):
  cmake/modules/LLVMConfig.cmake:27 (explicit_map_components_to_libraries)
  cmake/modules/LLVMConfig.cmake:20 (explicit_llvm_config)
  cmake/modules/AddLLVM.cmake:61 (llvm_config)
  cmake/modules/AddLLVM.cmake:78 (add_llvm_executable)
  tools/llvm-mc/CMakeLists.txt:3 (add_llvm_tool)

Tom

Tom Care <tcare@apple.com> writes:

CMake seems to have broken in the last few days - or is it just me?

tcare:llvm-release tcare$ make -j4
-- Target triple: x86_64-apple-darwin10.5.0
-- Native target architecture is X86
-- Threads enabled.
-- Building with -fPIC
-- Targeting X86
CMake Error at cmake/modules/LLVMConfig.cmake:90 (message):
  Library LLVMARMAsmParser not found in list of llvm libraries.

Probably this is caused by a previous build where you targeted ARM (or
all backends, which includes ARM.) Later, you reconfigured with

-DLLVM_TARGETS_TO_BUILD=X86

but this didn't remove the dependencies on the corresponding libraries
for the other targets.

On this case, the most simple way to resolve the issue is to start from
an empty build directory.

Tom Care <tcare@apple.com> writes:

This was after starting with an empty build directory. It seems to
work if I omit -DLLVM_TARGETS_TO_BUILD=X86, but a few days ago this
was working with just this target.

Yep. I can replicate the problem on Linux with

mkdir foo && cd foo
cmake -DLLVM_TARGETS_TO_BUILD=X86 ../llvm

I'll investigate a bit.

I'm seeing this as well, but for the LLVMAlphaAsmParser:

CMake Error at cmake/modules/LLVMConfig.cmake:90 (message):
  Library LLVMAlphaAsmPrinter not found in list of llvm libraries.
Call Stack (most recent call first):
  cmake/modules/LLVMConfig.cmake:27 (explicit_map_components_to_libraries)
  cmake/modules/LLVMConfig.cmake:20 (explicit_llvm_config)
  cmake/modules/AddLLVM.cmake:61 (llvm_config)
  cmake/modules/AddLLVM.cmake:78 (add_llvm_executable)
  tools/llvm-mc/CMakeLists.txt:3 (add_llvm_tool)

Ted Kremenek <kremenek@apple.com> writes:

I'm seeing this as well, but for the LLVMAlphaAsmParser:

The problem is that LLVMMCDisassembler became dependent on all targets
and there is no provision for the case where the dependencies of a
library lists a target that was not included on the build.

The fix is not hard. I'll see if I have time for that later today.

Same here, but on FreeBSD 8.0

cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_C_COMPILER=/usr/local/bin/clang -D CMAKE_CXX_COMPILER=/usr/local/bin/clang++ -D LLVM_TARGETS_TO_BUILD=X86 ~/contrib/llvm

CMake Error at cmake/modules/LLVMConfig.cmake:90 (message):
   Library LLVMARMAsmParser not found in list of llvm libraries.
Call Stack (most recent call first):
   cmake/modules/LLVMConfig.cmake:27 (explicit_map_components_to_libraries)
   cmake/modules/LLVMConfig.cmake:20 (explicit_llvm_config)
   cmake/modules/AddLLVM.cmake:61 (llvm_config)
   cmake/modules/AddLLVM.cmake:78 (add_llvm_executable)
   tools/llvm-mc/CMakeLists.txt:3 (add_llvm_tool)

Works for target is LLVM_TARGETS_TO_BUILD=all

--Ed.

I've run into issues like this before I think this has something to do with adding all available targets to:

cmake/modules/LLVMLibDeps.cmake

set(MSVC_LIB_DEPS_LLVMMCDisassembler LLVMARMAsmParser LLVMARMCodeGen LLVMARMInfo LLVMAlphaAsmPrinter LLVMAlphaCodeGen LLVMAlphaInfo LLVMBlackfinAsmPrinter LLVMBlackfinCodeGen LLVMBlackfinInfo LLVMCBackend LLVMCBackendInfo LLVMCellSPUAsmPrinter LLVMCellSPUCodeGen LLVMCellSPUInfo LLVMCppBackend LLVMCppBackendInfo LLVMMBlazeAsmPrinter LLVMMBlazeCodeGen LLVMMBlazeInfo LLVMMC LLVMMCParser LLVMMSIL LLVMMSILInfo LLVMMSP430AsmPrinter LLVMMSP430CodeGen LLVMMSP430Info LLVMMipsAsmPrinter LLVMMipsCodeGen LLVMMipsInfo LLVMPIC16 LLVMPIC16AsmPrinter LLVMPIC16Info LLVMPowerPCAsmPrinter LLVMPowerPCCodeGen LLVMPowerPCInfo LLVMSparcAsmPrinter LLVMSparcCodeGen LLVMSparcInfo LLVMSupport LLVMSystem LLVMSystemZAsmPrinter LLVMSystemZCodeGen LLVMSystemZInfo LLVMX86AsmParser LLVMX86CodeGen LLVMX86Disassembler LLVMX86Info LLVMXCore LLVMXCoreAsmPrinter LLVMXCoreInfo)

The CMake build system doesn't seem smart enough to handle selected targets.

-- Ed.

Óscar Fuentes <ofv@wanadoo.es> writes:

I'm seeing this as well, but for the LLVMAlphaAsmParser:

The problem is that LLVMMCDisassembler became dependent on all targets
and there is no provision for the case where the dependencies of a
library lists a target that was not included on the build.

The fix is not hard. I'll see if I have time for that later today.

It should be fixed now.