This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: CMake fails to find the LLVM package with the LLVMConfig.cmake


On 11/25/2019 10:42 PM, Zhenghui Zhou wrote:
> I'm trying to build a project in cygwin64 under windows 10 which depends the
> LLVM libraries and had been built successfully under some linux
> environment. The problem is that the build scripts of CMake can not find
> the LLVM libraries.
> 
> I have installed LLVM-devel package of cygwin64, and cmake can located the
> LLVMConfig.cmake file in /usr/lib/cmake/llvm directory which is installed
> along with the LLVM packages.
> 
> An example of CMakeList.txt likes:
> 
> cmake_minimum_required(VERSION 3.1)
> project(simple)
> message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
> find_package(LLVM REQUIRED CONFIG)
> message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
> ...
> 
> And the output reports:
> 
> -- Using LLVMConfig.cmake in: /usr/lib/cmake/llvm
> CMake Error at CMakeLists.txt:10 (find_package):
>    Found package configuration file:
> 
>      /usr/lib/cmake/llvm/LLVMConfig.cmake
> 
>    but it set LLVM_FOUND to FALSE so package "LLVM" is considered to be NOT
>    FOUND.  Reason given by package:
> 
>    The following imported targets are referenced, but are missing:
> LLVMSupport
>    LLVMCore LLVMScalarOpts LLVMInstCombine LLVMTransformUtils LLVMAnalysis
>    LLVMipo LLVMMC LLVMPasses LLVMLinker LLVMIRReader LLVMBitReader
>    LLVMMCParser LLVMObject LLVMProfileData LLVMTarget LLVMVectorize
> 
> -- Configuring incomplete, errors occurred!
> 
> After digging for several hours, I think the problem is caused by lacking
> of shared objects of LLVM. There are only static libraries of LLVM under
> Cygwin/Windows.  A submit <https://reviews.llvm.org/D32668> of LLVM tells
> that the shared library targets may only need on most platforms so that the
> static library targets is split into theire own export file and can be
> ignored, The configuration entries in LLVMConfig.cmake are:
> ...
>    include("${LLVM_CMAKE_DIR}/LLVMExports.cmake")
>    include("${LLVM_CMAKE_DIR}/LLVMStaticExports.cmake" OPTIONAL)
> ...
> The static targets export file is set optional at the second line。However,
> configuration under cygwin will fail on the first line.
> 
> So it may be figured that the second line goes in front:
> ...
>    include("${LLVM_CMAKE_DIR}/LLVMStaticExports.cmake" OPTIONAL)
>    include("${LLVM_CMAKE_DIR}/LLVMExports.cmake")
> ...
> Everything works fine now.
> 
> Is there anything I missed or better suggestions?

The same problem was reported in 
https://cygwin.com/ml/cygwin/2019-08/msg00419.html, and the solution you found 
is the same as the one suggested by Yaakov in his reply.

Ken

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]