This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: CMake fails to find the LLVM package with the LLVMConfig.cmake
- From: Brian Inglis <Brian dot Inglis at SystematicSw dot ab dot ca>
- To: cygwin at cygwin dot com
- Date: Tue, 26 Nov 2019 15:16:58 -0700
- Subject: Re: CMake fails to find the LLVM package with the LLVMConfig.cmake
- References: <CAOME8XTripBup--2v4OtrufAUS21pZySCQiK_3s+1ffvOM110g@mail.gmail.com>
- Reply-to: Brian dot Inglis at SystematicSw dot ab dot ca
On 2019-11-25 20:42, 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?
On my system there are 150 LLVM shared libraries, 145 for the current version 8,
5 for earlier versions:
$ l /bin/cygLLVM*.dll | wc
150 150 4694 4694 42
$ l /bin/cygLLVM*-8.dll | wc
145 145 4584 4584 42
$ l /usr/lib/libLLVM*.dll.a | wc
145 145 5164 5164 46
$ l /bin/cygLLVM*-[!8]*.dll
/bin/cygLLVM-3.5.dll* /bin/cygLLVM-3.8.dll* /bin/cygLLVM-3.9.dll*
/bin/cygLLVM-4.0.dll* /bin/cygLLVM-5.0.dll*
Perhaps cmake needs regenerated or changed for Cygwin so path and/or naming
and/or versioning e.g. /bin/cygLLVMCore-8.dll instead of /usr/lib/libLLVM*.so
and /usr/lib/libLLVM*.dll.a instead of /usr/lib/libLLVM*.la.
You might look at what llvm-config does.
Have you installed/upgraded also libtool and pkgconf?
Have you looked at using libtool and/or pkgconf to handle Cygwin and Linux
dependency differences?
--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada
This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
--
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