LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 21016 - [CMake] llvm_map_components_to_libraries() may cause infinite loop
Summary: [CMake] llvm_map_components_to_libraries() may cause infinite loop
Status: CONFIRMED
Alias: None
Product: Build scripts
Classification: Unclassified
Component: cmake (show other bugs)
Version: trunk
Hardware: All All
: P normal
Assignee: NAKAMURA Takumi
URL:
Keywords:
: 21017 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-09-21 03:45 PDT by Kai Nacke
Modified: 2015-06-26 13:54 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kai Nacke 2014-09-21 03:45:57 PDT
The dependency to library LLVMX86Utils is missing if llvm_map_components_to_libnames is used. See output of:

project(bug)
cmake_minimum_required(VERSION 2.8)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/opt/llvm-trunk/share/llvm/cmake")
include(LLVMConfig)

llvm_map_components_to_libnames(tmplibs X86)

message("Libraries: ${tmplibs}")

Output is:
Libraries: LLVMX86CodeGen;LLVMX86AsmPrinter;LLVMX86AsmParser;LLVMX86Desc;LLVMX86Info;LLVMX86Disassembler

If llvm_map_components_to_libnames(tmplibs X86) is replaced with llvm_map_components_to_libraries(tmplibs X86), then the output is:

Libraries: LLVMX86CodeGen;LLVMX86AsmParser;LLVMX86Disassembler;LLVMAsmPrinter;LLVMSelectionDAG;LLVMX86Desc;LLVMMCParser;LLVMCodeGen;LLVMX86AsmPrinter;LLVMX86Info;LLVMScalarOpts;LLVMX86Utils;LLVMInstCombine;LLVMTransformUtils;LLVMipa;LLVMAnalysis;LLVMTarget;LLVMCore;LLVMMC;LLVMObject;LLVMSupport;dl;pthread

1) Please note the missing LLVMX86Utils
2) Using llvm_map_components_to_libraries this way with LLVM trunk results in an infinte loop
Comment 1 Kai Nacke 2014-09-21 08:49:34 PDT
*** Bug 21017 has been marked as a duplicate of this bug. ***
Comment 2 Kai Nacke 2014-10-12 15:11:49 PDT
AArch64 is also affected.
Comment 3 Kai Nacke 2014-10-12 15:15:17 PDT
@Takumi: I CC you because I think you did most of the work on the cmake scripts.
Comment 4 NAKAMURA Takumi 2014-11-05 00:44:40 PST
1) Please note the missing LLVMX86Utils

It's expected. The name "X86" is expanded to essential components.
Consider the target FOO that doesn't have LLVMFOOUtils.

CMake's target_link_libraries() will work transitively. LLVMX86CodeGen will bring in LLVMX86Utils.


2) Using llvm_map_components_to_libraries this way with LLVM trunk results in an infinte loop

Although it is deprecated, it's a bug. I reproduced infinite loop.
Removing llvm_map_components_to_libraries() would be an option. :)