X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=RRRpVuI7miw+ma0v aBnbpTWnThkVf+BkkvOAzJRD0VHFs53TbEyvTjqqF8orMJ+9N20BQe7gbJVdhnm/ g4dZAHVeR5ZV+dxxYzSQNP89vzeq4fNqlqWI3x1p2dxSuLb5R3aDXYo7ZTdQJMa5 N1upaNTEuFMuPDOheXHXfkGuXpA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=NQ2ZeIgt3X8mBAIsaNsnf7 658F8=; b=TykGg69ZpD3uf96NOuUJq9js8KDGjz8w4umfdyMcvn9LEbHinRL3xI YbUkwsaitSNMBzL9JoNoNB5pmbtfNiAXesIUBl4xyOb5wYeKvoEilxb/Safh7reL TwGAVJcUtfOd985dd3U3KNA0/5Eht84X6/iCbJs6DNKv4Xq5G6D90= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=likes X-HELO: smtp-out-no.shaw.ca Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca Subject: Re: CMake fails to find the LLVM package with the LLVMConfig.cmake To: cygwin AT cygwin DOT com References: From: Brian Inglis Openpgp: preference=signencrypt Message-ID: <72ddbb16-8c2b-11c3-d6b4-852825600a95@SystematicSw.ab.ca> Date: Tue, 26 Nov 2019 15:16:58 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes 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 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