delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/11/25/22:44:07

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:mime-version:from:date:message-id:subject:to
:content-type:content-transfer-encoding; q=dns; s=default; b=rhe
zRc21Do+b8ClM88SqqGJTCZ9Vg20yieC+/hcevc916Ym3WAe7OP1vU3H7X+mwe7n
Ew/KAsK0OadqRPcONTCS6v+AhuBXn+/qppEAOKgi+pEVbdFgacc0PePykYThO4sI
iHYLr86bEOC/iRu3+Y+NP5yNedLQiSGQgaHGjNNc=
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:mime-version:from:date:message-id:subject:to
:content-type:content-transfer-encoding; s=default; bh=Yd1Ynmtez
2tVUy1Y62xb/37QGrg=; b=jWgyRsThVmd9rnFOI16YvJI30Jl/2COX3zOqBtoUt
9kR/iIPOC8ZVzUWqWPm9mHVkqm8HFJVFo9Z8nBp8eeGu7m1/mdSR+4NAMGUwG+WV
fF2cfvuZ8CMnxhdSTcDlgTkqfIyWUqcal3aswwAahjmAjfOSv+B9ClNImKekmkpl
sw=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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=-0.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=likes, HX-Received:a6b, cygwin64, H*c:alternative
X-HELO: mail-io1-f48.google.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=b9zYmYbWgeFRtQXDy25bF2rhMaQYSCL2Gxj7zIDY198=; b=VuZmStYblgsi+VwlOfZPmNVlFttkXiOMt8mbMtC+dQbxatZoLplCQ8qRlAiKO252hc +OOtrcGVQaic6asECFAfK17vrnvT1N7T4me6U36mIJq15/Qb7cQeRKJ+22YESmfdtShs HoT0nNFy0u9I4VRzVybnRFrspg1IbzWZ8ajffjPpK/BaYjoogrtdB97I5UcpKUTTN3dO tULwrtkQ1+kTit5YipMMqhyfjWqEXK21HaB9Fr5uzU4CJVHr8sOulNXSwTFgQIVc1oS0 Thl6v5aMcFp0raE8wpczPhuLMq4bo5YhgpltQzN6wCcWIQusEWkewN2daI0RYzXq0E0v tOvg==
MIME-Version: 1.0
From: Zhenghui Zhou <zhouzhenghui AT gmail DOT com>
Date: Tue, 26 Nov 2019 11:42:59 +0800
Message-ID: <CAOME8XTripBup--2v4OtrufAUS21pZySCQiK_3s+1ffvOM110g@mail.gmail.com>
Subject: CMake fails to find the LLVM package with the LLVMConfig.cmake
To: cygwin <cygwin AT cygwin DOT com>
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id xAQ3hnRc002451

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?

--
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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019