Debian Bug report logs - #862328
clang-4.0: ClangConfig.cmake is broken by Debian packaging

version graph

Package: clang-4.0; Maintainer for clang-4.0 is (unknown);

Reported by: Sylvain Joubert <joubert.sy@gmail.com>

Date: Thu, 11 May 2017 11:30:01 UTC

Severity: important

Found in version llvm-toolchain-4.0/1:4.0.1~+rc1-1

Fixed in version 1:5.0.2-2

Done: Sylvestre Ledru <sylvestre@debian.org>

Bug is archived. No further changes may be made.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, LLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>:
Bug#862328; Package clang-4.0. (Thu, 11 May 2017 11:30:04 GMT) (full text, mbox, link).


Acknowledgement sent to Sylvain Joubert <joubert.sy@gmail.com>:
New Bug report received and forwarded. Copy sent to LLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>. (Thu, 11 May 2017 11:30:04 GMT) (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Sylvain Joubert <joubert.sy@gmail.com>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: clang-4.0: ClangConfig.cmake is broken by Debian packaging
Date: Thu, 11 May 2017 13:26:12 +0200
Package: clang-4.0
Version: 1:4.0.1~+rc1-1
Severity: important

Dear Maintainer,

In the same way as #819072 and preceding issues for LLVMConfig, the Clang CMake
files are not usable with the current packaging in Debian.
While LLVMConfig.cmake can be found without issue, this is not the case for
ClangConfig.cmake

Considering the following CMake script:

cmake_minimum_required(VERSION 3.2)
project(clangconfig)
find_package(Clang REQUIRED)

one gets:

CMake Error at CMakeLists.txt:3 (find_package):
  By not providing "FindClang.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Clang", but
  CMake did not find one.

  Could not find a package configuration file provided by "Clang" with any of
  the following names:

    ClangConfig.cmake
    clang-config.cmake

  Add the installation prefix of "Clang" to CMAKE_PREFIX_PATH or set
  "Clang_DIR" to a directory containing one of the above files.  If "Clang"
  provides a separate development package or SDK, be sure it has been
  installed.

Additionnally, when explicitly providing Clang_DIR with
/usr/share/llvm-4.0/cmake, one gets:

CMake Error at /usr/share/llvm-4.0/cmake/ClangConfig.cmake:17 (include):
  include could not find load file:

    /usr/lib/cmake/clang/ClangTargets.cmake
Call Stack (most recent call first):
  CMakeLists.txt:3 (find_package)

I'm guessing some paths needs to be updated in order to handle the Debian
repackaging.

Sylvain



-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (990, 'testing'), (800, 'stable-updates'), (800, 'stable'), (700, 'unstable'), (90, 'experimental')
Architecture: amd64
 (x86_64)

Kernel: Linux 4.9.0-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages clang-4.0 depends on:
ii  binutils                 2.28-4
ii  libc6                    2.24-10
ii  libc6-dev                2.24-10
ii  libclang-common-4.0-dev  1:4.0.1~+rc1-1
ii  libclang1-4.0            1:4.0.1~+rc1-1
ii  libgcc-6-dev             6.3.0-16
ii  libgcc1                  1:6.3.0-16
ii  libjsoncpp1              1.7.4-3
ii  libllvm4.0               1:4.0.1~+rc1-1
ii  libobjc-6-dev            6.3.0-16
ii  libstdc++-6-dev          6.3.0-16
ii  libstdc++6               6.3.0-16

Versions of packages clang-4.0 recommends:
ii  llvm-4.0-dev  1:4.0.1~+rc1-1
ii  python        2.7.13-2

Versions of packages clang-4.0 suggests:
pn  clang-4.0-doc  <none>
pn  gnustep        <none>
pn  gnustep-devel  <none>

-- no debconf information



Information forwarded to debian-bugs-dist@lists.debian.org, LLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>:
Bug#862328; Package clang-4.0. (Thu, 11 May 2017 16:21:03 GMT) (full text, mbox, link).


Acknowledgement sent to Sylvestre Ledru <sylvestre@debian.org>:
Extra info received and forwarded to list. Copy sent to LLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>. (Thu, 11 May 2017 16:21:03 GMT) (full text, mbox, link).


Message #10 received at 862328@bugs.debian.org (full text, mbox, reply):

From: Sylvestre Ledru <sylvestre@debian.org>
To: Sylvain Joubert <joubert.sy@gmail.com>, 862328@bugs.debian.org
Subject: Re: Bug#862328: clang-4.0: ClangConfig.cmake is broken by Debian packaging
Date: Thu, 11 May 2017 18:16:16 +0200
Hello



Le 11/05/2017 à 13:26, Sylvain Joubert a écrit :
> Package: clang-4.0
> Version: 1:4.0.1~+rc1-1
> Severity: important
>
> Dear Maintainer,
>
> In the same way as #819072 and preceding issues for LLVMConfig, the Clang CMake
> files are not usable with the current packaging in Debian.
> While LLVMConfig.cmake can be found without issue, this is not the case for
> ClangConfig.cmake
>
Would you mind providing a patch for this?

Thanks
S




Information forwarded to debian-bugs-dist@lists.debian.org, LLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>:
Bug#862328; Package clang-4.0. (Fri, 12 May 2017 12:03:06 GMT) (full text, mbox, link).


Acknowledgement sent to Sylvain Joubert <joubert.sy@gmail.com>:
Extra info received and forwarded to list. Copy sent to LLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>. (Fri, 12 May 2017 12:03:06 GMT) (full text, mbox, link).


Message #15 received at 862328@bugs.debian.org (full text, mbox, reply):

From: Sylvain Joubert <joubert.sy@gmail.com>
To: Debian Bug Tracking System <862328@bugs.debian.org>
Subject: Re: clang-4.0: ClangConfig.cmake is broken by Debian packaging
Date: Fri, 12 May 2017 13:58:47 +0200
[Message part 1 (text/plain, inline)]
Package: clang-4.0
Version: 1:4.0.1~+rc1-1
Followup-For: Bug #862328

Hi,

After some digging, here is what I've come up with:

1- Dependencies

I think that ClangConfig.cmake (and the symlinks,... described above) and its
two sibling files should be provided by libclang-x.y-dev not by clang-x.y.
Most of the targets provided by this CMake file are installed with
libclang-x.y-dev so that makes much more sense (and LLVMConfig.cmake is
provided by llvm-x.y-dev)
However, some target artifacts are provided by other packages as well:
- clang (executable) by clang-x.y
- clang-format (executable) by clang-format-x.y

If these artifacts are not installed during configure, CMake will error-
complain about that.
I'm not really sure what's the best approach here but, as is, the package
providing ClangConfig.cmake must depends on clang-x.y and clang-format-x.y in
order to work.

2- Fixing find_package(Clang)

Install ClangConfig.cmake and siblings in /usr/lib/llvm-x.y/lib/cmake/clang
(instead of /usr/share/llvm-x.y/cmake)
Add a symlink /usr/share/clang-x.y/cmake -> /usr/lib/llvm-x.y/lib/cmake/clang

This matches what's done for LLVMConfig.cmake
This way find_package(Clang) can automatically find the config files.
To be consistent with LLVMConfig.cmake the symlink can instead be put in
/usr/lib/clang-x.y/cmake

3- Fixing CLANG_INSTALL_PREFIX

Apply the attached patch (fix-cmake-clang-confix.patch based on the 5.0
snapshot) to ClangConfig.cmake in the clang sources to fix the prefix location

With that ClangConfig.cmake and siblings can correctly compute the path of the
target artifacts

4- Fixing clang executable name

The targets files expect the clang executable to be named and located in
/usr/lib/llvm-x.y/bin/clang-x.y but the rules file (line 374) strips its
version suffixes.

I'm not sure why this was done but I guess we can either:
- not rename the executable (and fix /usr/bin/clang-x.y symlink and maybe
others)
- fix the ClangTargets-*.cmake file post generation to strip the version suffix


With these changes, one should be able to use the provided ClangConfig.cmake
and its targets.
I'm not really able to test that much more, nor provide a full patch for the
packaging repo but I can test any .deb that would have such fixes (including
the 5.0 snapshots).

Regards,
Sylvain



-- System Information:
Debian Release: 9.0
  APT prefers testing
  APT policy: (990, 'testing'), (800, 'stable-updates'), (800, 'stable'), (700, 'unstable'), (90, 'experimental')
Architecture: amd64
 (x86_64)

Kernel: Linux 4.9.0-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages clang-4.0 depends on:
ii  binutils                 2.28-4
ii  libc6                    2.24-10
ii  libc6-dev                2.24-10
ii  libclang-common-4.0-dev  1:4.0.1~+rc1-1
ii  libclang1-4.0            1:4.0.1~+rc1-1
ii  libgcc-6-dev             6.3.0-16
ii  libgcc1                  1:6.3.0-16
ii  libjsoncpp1              1.7.4-3
ii  libllvm4.0               1:4.0.1~+rc1-1
ii  libobjc-6-dev            6.3.0-16
ii  libstdc++-6-dev          6.3.0-16
ii  libstdc++6               6.3.0-16

Versions of packages clang-4.0 recommends:
ii  llvm-4.0-dev  1:4.0.1~+rc1-1
ii  python        2.7.13-2

Versions of packages clang-4.0 suggests:
pn  clang-4.0-doc  <none>
pn  gnustep        <none>
pn  gnustep-devel  <none>

-- no debconf information
[fix-cmake-clang-config.patch (text/plain, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, LLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>:
Bug#862328; Package clang-4.0. (Tue, 19 Sep 2017 18:57:05 GMT) (full text, mbox, link).


Acknowledgement sent to Mario Lang <mlang@blind.guru>:
Extra info received and forwarded to list. Copy sent to LLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>. (Tue, 19 Sep 2017 18:57:05 GMT) (full text, mbox, link).


Message #20 received at 862328@bugs.debian.org (full text, mbox, reply):

From: Mario Lang <mlang@blind.guru>
To: 862328@bugs.debian.org
Subject: ping
Date: Tue, 19 Sep 2017 20:45:35 +0200
Hi.

I've just been bitten by the same problem.  It appears to still be an
issue even with libclang-5.0-dev.  find_package(Clang) doesn't work,
also if Clang_DIR is provided.

-- 
CYa,
  ⡍⠁⠗⠊⠕



Information forwarded to debian-bugs-dist@lists.debian.org, LLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>:
Bug#862328; Package clang-4.0. (Sat, 11 Nov 2017 21:27:03 GMT) (full text, mbox, link).


Acknowledgement sent to Kim Gräsman <kim.grasman@gmail.com>:
Extra info received and forwarded to list. Copy sent to LLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>. (Sat, 11 Nov 2017 21:27:03 GMT) (full text, mbox, link).


Message #25 received at 862328@bugs.debian.org (full text, mbox, reply):

From: Kim Gräsman <kim.grasman@gmail.com>
To: 862328@bugs.debian.org
Subject: Ping
Date: Sat, 11 Nov 2017 22:22:31 +0100
Hello,

I've been banging my head against this for a while, too.

From what I can tell, Sylvain's original report is correct, there's no
way to use the Clang CMake modules in this packaging.

CMake can be convinced to find Clang with:

    find_package(Clang REQUIRED CONFIG NAMES llvm Clang)

but even then it will fail with

     CMake Error at /usr/share/llvm-3.9/cmake/ClangConfig.cmake:16 (include):
      include could not find load file:

        /usr/lib/cmake/clang/ClangTargets.cmake
    Call Stack (most recent call first):
      CMakeLists.txt:34 (find_package)

The failing module, ClangConfig.cmake, does:

    ...
    set(CLANG_CMAKE_DIR "${CLANG_INSTALL_PREFIX}/lib/cmake/clang")

    # Provide all our library targets to users.
    include("${CLANG_CMAKE_DIR}/ClangTargets.cmake")
    ...

This can never match ClangTargets.cmake's true location, which is just
next to ClangConfig.cmake, in /usr/share/llvm-3.9/cmake.

I haven't had a chance to investigate Sylvain's patch, or understand
what the root cause of the problem is (Clang or packaging), but I'll
try to dig deeper.

Cheers,
- Kim



Information forwarded to debian-bugs-dist@lists.debian.org, LLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>:
Bug#862328; Package clang-4.0. (Sun, 12 Nov 2017 08:21:06 GMT) (full text, mbox, link).


Acknowledgement sent to Sylvestre Ledru <s@mozilla.com>:
Extra info received and forwarded to list. Copy sent to LLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>. (Sun, 12 Nov 2017 08:21:06 GMT) (full text, mbox, link).


Message #30 received at 862328@bugs.debian.org (full text, mbox, reply):

From: Sylvestre Ledru <s@mozilla.com>
To: Kim Gräsman <kim.grasman@gmail.com>, 862328@bugs.debian.org
Subject: Re: Bug#862328: Ping
Date: Sun, 12 Nov 2017 09:18:11 +0100
Hello,


On 11/11/2017 22:22, Kim Gräsman wrote:
> Hello,
>
> I've been banging my head against this for a while, too.
>
> From what I can tell, Sylvain's original report is correct, there's no
> way to use the Clang CMake modules in this packaging.
>
I don't have time to work on that unfortunately for now. Any help would
be much appreciated!

Cheers,
S




Information forwarded to debian-bugs-dist@lists.debian.org, LLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>:
Bug#862328; Package clang-4.0. (Sun, 13 May 2018 10:15:06 GMT) (full text, mbox, link).


Acknowledgement sent to Kim Gräsman <kim.grasman@gmail.com>:
Extra info received and forwarded to list. Copy sent to LLVM Packaging Team <pkg-llvm-team@lists.alioth.debian.org>. (Sun, 13 May 2018 10:15:06 GMT) (full text, mbox, link).


Message #35 received at 862328@bugs.debian.org (full text, mbox, reply):

From: Kim Gräsman <kim.grasman@gmail.com>
To: 862328@bugs.debian.org
Subject: Bug scope shrinking
Date: Sun, 13 May 2018 12:13:42 +0200
Hi all,

I think the most critical problem reported by Sylvain up-thread is
mostly solved, and I can't quite judge the severity of the rest:

> 1- Dependencies
>
> I think that ClangConfig.cmake (and the symlinks,... described above) and its
> two sibling files should be provided by libclang-x.y-dev not by clang-x.y.

This would be nice; I'm currently installing the Clang compiler just
to get at the CMake files required to build it. That seems backwards.
I haven't really gotten my head around the dependency cross-wiring
described by Sylvain, but maybe that needs to be solved first.

> 2- Fixing find_package(Clang)

This appears to be solved in the packaging as part of the fix for #890514. Yay!

> 3- Fixing CLANG_INSTALL_PREFIX
>
> Apply the attached patch (fix-cmake-clang-confix.patch based on the 5.0
> snapshot) to ClangConfig.cmake in the clang sources to fix the prefix location

As far as I can tell, this is also solved now --
CLANG_INSTALL_PREFIX=/usr/lib/llvm-7 on my system.

> 4- Fixing clang executable name
>
> The targets files expect the clang executable to be named and located in
> /usr/lib/llvm-x.y/bin/clang-x.y but the rules file (line 374) strips its
> version suffixes.

I don't know the status/relevance of this.

Maybe there should be new, distinct bugs for these problems?

- Kim



Marked as fixed in versions 1:5.0.2-2. Request was from Sylvestre Ledru <sylvestre@debian.org> to control@bugs.debian.org. (Sun, 13 May 2018 10:33:08 GMT) (full text, mbox, link).


Reply sent to Sylvestre Ledru <sylvestre@debian.org>:
You have taken responsibility. (Sun, 13 May 2018 10:33:11 GMT) (full text, mbox, link).


Notification sent to Sylvain Joubert <joubert.sy@gmail.com>:
Bug acknowledged by developer. (Sun, 13 May 2018 10:33:11 GMT) (full text, mbox, link).


Message #42 received at 862328-done@bugs.debian.org (full text, mbox, reply):

From: Sylvestre Ledru <sylvestre@debian.org>
To: 862328-done@bugs.debian.org, Control bugs server <control@bugs.debian.org>
Subject: Fixed in 5.0
Date: Sun, 13 May 2018 12:32:27 +0200
fixed 862328 1:5.0.2-2
thanks





Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Mon, 05 Nov 2018 07:27:48 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Tue Dec 17 21:49:27 2024; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.