From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id aNIJOdg/sV6TbAAA0tVLHw (envelope-from ) for ; Tue, 05 May 2020 10:28:40 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id AIuvGuQ/sV6FKQAAbx9fmQ (envelope-from ) for ; Tue, 05 May 2020 10:28:52 +0000 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 6901394001A for ; Tue, 5 May 2020 10:28:50 +0000 (UTC) Received: from localhost ([::1]:37034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVuok-00021L-Qa for larch@yhetil.org; Tue, 05 May 2020 06:28:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVuhd-0007vm-3R for guix-devel@gnu.org; Tue, 05 May 2020 06:21:29 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:18112) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVuha-00014p-JG for guix-devel@gnu.org; Tue, 05 May 2020 06:21:28 -0400 X-IronPort-AV: E=Sophos;i="5.73,354,1583190000"; d="scan'208";a="448250805" Received: from 91-160-117-201.subs.proxad.net (HELO ribbon) ([91.160.117.201]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 May 2020 12:21:21 +0200 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Efraim Flashner Subject: Re: Packaging =?utf-8?Q?=E2=80=98clang-tools-extra=E2=80=99_=28?= =?utf-8?Q?=E2=80=98clang-tidy=E2=80=99=2C?= etc.) References: <87eesdhup7.fsf@inria.fr> <20200424170736.qvuiz5bzgdp2olrl@hex> <871ro9z8p6.fsf@inria.fr> <20200427085041.GI5243@E5400> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 17 =?utf-8?Q?Flor=C3=A9al?= an 228 de la =?utf-8?Q?R?= =?utf-8?Q?=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 05 May 2020 12:21:21 +0200 In-Reply-To: <20200427085041.GI5243@E5400> (Efraim Flashner's message of "Mon, 27 Apr 2020 11:50:41 +0300") Message-ID: <87v9lalm1q.fsf@inria.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=192.134.164.83; envelope-from=ludovic.courtes@inria.fr; helo=mail2-relais-roc.national.inria.fr X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/05 03:43:53 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -68 X-Spam_score: -6.9 X-Spam_bar: ------ X-Spam_report: (-6.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: guix-devel Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: "Guix-devel" X-Scanner: scn0 X-Spam-Score: 0.49 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-devel-bounces@gnu.org designates 2001:470:142::17 as permitted sender) smtp.mailfrom=guix-devel-bounces@gnu.org X-Scan-Result: default: False [0.49 / 13.00]; GENERIC_REPUTATION(0.00)[-0.49540568269781]; MX_INVALID(1.00)[cached]; DWL_DNSWL_FAIL(0.00)[2001:470:142::17:server fail]; R_SPF_ALLOW(-0.20)[+ip6:2001:470:142::/48:c]; IP_REPUTATION_HAM(0.00)[asn: 22989(0.13), country: US(-0.00), ip: 2001:470:142::17(-0.50)]; TO_DN_ALL(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; MAILLIST(-0.20)[mailman]; FORGED_RECIPIENTS_MAILLIST(0.00)[]; RCVD_IN_DNSWL_FAIL(0.00)[2001:470:142::17:server fail]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:22989, ipnet:2001:470:142::/48, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[larch=yhetil.org]; ARC_NA(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; FROM_NEQ_ENVFROM(0.00)[ludovic.courtes@inria.fr,guix-devel-bounces@gnu.org]; FROM_HAS_DN(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain,text/x-patch]; MIME_TRACE(0.00)[0:+,1:+,2:+]; DMARC_NA(0.00)[inria.fr]; HAS_LIST_UNSUB(-0.01)[]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: QFgqtcLwGUQR --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello! Clang-tools-extra is really meant to built within the Clang tree. Attach is an attempt to build it out-of-tree but so far it fails with undefined references for Clang libraries and the obvious solution of adding =E2=80=98-l=E2=80=99 flags until it=E2=80=99s happy doesn=E2=80=99t = work. In my original attempt, the =E2=80=98clang-tidy=E2=80=99 binary is 40=C2=A0= MiB, and 32=C2=A0MiB are text. This prolly comes from the fact that many Clang libraries (libclang[A-Z]*.a) are statically linked in each of these programs. Ideas welcome! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 33d863ae11..896b7afb47 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -382,6 +382,52 @@ output), and Binutils.") (define-public clang-toolchain-10 (make-clang-toolchain clang-10)) +(define (make-clang-tools-extra clang) + ;; XXX: An attempt to build clang-tools-extra outside the Clang tree. + (package + (inherit clang) + (name "clang-tools-extra") + (source (origin + (method url-fetch) + (uri (llvm-download-uri "clang-tools-extra" + (package-version llvm-10))) + (sha256 + (base32 + "074ija5s2jsdn0k035r2dzmryjmqxdnyg4xwvaqych2bazv8rpxc")) + (patches (search-patches "clang-tools-extra-cmake.patch")))) + (arguments + '(#:build-type "Release" + #:phases (modify-phases %standard-phases + (add-before 'configure 'copy-clang-cmake-module + (lambda* (#:key inputs #:allow-other-keys) + (let ((clang-source (assoc-ref inputs "clang-source"))) + (mkdir "../clang-source") + (with-directory-excursion "../clang-source" + (invoke "tar" "xf" clang-source)) + + ;; 'cmake/modules' is in the search path of the + ;; top-level 'CMakeLists.txt', so copy it there. + (install-file (car (find-files "../clang-source" + "^AddClang\\.cmake$")) + "cmake/modules") + #t))) + (add-before 'build 'augment-header-path + (lambda _ + (let ((context-h (car (find-files "../clang-source" + "^Context\\.h$")))) + (setenv "CPATH" + (string-append (dirname + (canonicalize-path context-h)) + ":" (getenv "CPATH"))) + #t)))))) + (inputs + `(("clang" ,clang) + ("clang-source", (package-source clang)) + ,@(package-inputs clang))))) + +(define-public clang-tools-extra-10 + (make-clang-tools-extra clang-10)) + (define-public llvm-9 (package (inherit llvm-10) diff --git a/gnu/packages/patches/clang-tools-extra-cmake.patch b/gnu/packages/patches/clang-tools-extra-cmake.patch new file mode 100644 index 0000000000..96672bb2dd --- /dev/null +++ b/gnu/packages/patches/clang-tools-extra-cmake.patch @@ -0,0 +1,38 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 57bb970..6e5de7c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,3 +1,33 @@ ++cmake_minimum_required(VERSION 3.4.3) ++ ++project(Clang-Tools-Extra) ++ ++find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_PATH}") ++list(APPEND CMAKE_MODULE_PATH ${LLVM_DIR}) ++ ++# This is the place where we put Clang's 'AddClang.cmake'. ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") ++ ++set(LLVM_TOOLS_BINARY_DIR ${TOOLS_BINARY_DIR} CACHE PATH "Path to llvm/bin") ++set(LLVM_LIBRARY_DIR ${LIBRARY_DIR} CACHE PATH "Path to llvm/lib") ++set(LLVM_MAIN_INCLUDE_DIR ${INCLUDE_DIR} CACHE PATH "Path to llvm/include") ++set(LLVM_BINARY_DIR ${LLVM_OBJ_ROOT} CACHE PATH "Path to LLVM build tree") ++set(LLVM_MAIN_SRC_DIR ${MAIN_SRC_DIR} CACHE PATH "Path to LLVM source tree") ++ ++set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}") ++ ++include(AddClang) ++include(AddLLVM) ++include(TableGen) ++include(HandleLLVMOptions) ++include(VersionFromVCS) ++include(LLVMDistributionSupport) ++ ++# Dummy targets to appease CMake. These are normally found in the ++# Clang tree. ++add_custom_target(clang-resource-headers) ++add_custom_target(ClangSACheckers) ++ + include(CMakeDependentOption) + + add_subdirectory(clang-apply-replacements) --=-=-=--