[Bug 2038340] [NEW] clang packages in 22.04 have the wrong libstdc++-*-dev dependency

Gilles Peskine 2038340 at bugs.launchpad.net
Tue Oct 3 13:29:26 UTC 2023


Public bug reported:

Summary: clang packages depends on the wrong version libstdc++-*-dev, so
C++ compilation with Clang doesn't work without an extra, hard-to-
discover step.

Workaround: apt install libstdc++-12-dev

The clang packages in Ubuntu 22.04 jammy are unusable to compile a C++
program out of the box.

```
$ cat a.cpp
#include <cstddef>
int main() {}
$ g++ a.cpp
$ clang++ a.cpp
a.cpp:1:10: fatal error: 'cstddef' file not found
#include <cstddef>
         ^~~~~~~~~
1 error generated.
$ clang++ --version
Ubuntu clang version 14.0.0-1ubuntu1.1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ ls -lA $(which clang++)
lrwxrwxrwx 1 root root 26 Apr  1  2022 /usr/bin/clang++ -> ../lib/llvm-14/bin/clang++
$ dpkg -s clang-14 | grep -e Version -e Depends
Version: 1:14.0.0-1ubuntu1.1
Depends: libc6 (>= 2.34), libclang-cpp14 (>= 1:14.0.0), libgcc-s1 (>= 3.0), libllvm14, libstdc++6 (>= 11), libstdc++-11-dev, libgcc-11-dev, libobjc-11-dev, libclang-common-14-dev (= 1:14.0.0-1ubuntu1.1), llvm-14-linker-tools (= 1:14.0.0-1ubuntu1.1), libclang1-14 (= 1:14.0.0-1ubuntu1.1), libc6-dev, binutils
```

The problem turns out to be that clang++ 14 wants libstdc++-12-dev, but
declares a dependency on libstdc++-11-dev.

I filed this bug under clang-14 because that's the default clang, but I
think all the other Clang versions in Ubuntu 22.04 are affected.

This has happened before with different versions
(https://bugs.launchpad.net/ubuntu/+source/llvm-
toolchain-10/+bug/1878881).

** Affects: llvm-toolchain-14 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to llvm-toolchain-14 in Ubuntu.
https://bugs.launchpad.net/bugs/2038340

Title:
  clang packages in 22.04 have the wrong libstdc++-*-dev dependency

Status in llvm-toolchain-14 package in Ubuntu:
  New

Bug description:
  Summary: clang packages depends on the wrong version libstdc++-*-dev,
  so C++ compilation with Clang doesn't work without an extra, hard-to-
  discover step.

  Workaround: apt install libstdc++-12-dev

  The clang packages in Ubuntu 22.04 jammy are unusable to compile a C++
  program out of the box.

  ```
  $ cat a.cpp
  #include <cstddef>
  int main() {}
  $ g++ a.cpp
  $ clang++ a.cpp
  a.cpp:1:10: fatal error: 'cstddef' file not found
  #include <cstddef>
           ^~~~~~~~~
  1 error generated.
  $ clang++ --version
  Ubuntu clang version 14.0.0-1ubuntu1.1
  Target: x86_64-pc-linux-gnu
  Thread model: posix
  InstalledDir: /usr/bin
  $ ls -lA $(which clang++)
  lrwxrwxrwx 1 root root 26 Apr  1  2022 /usr/bin/clang++ -> ../lib/llvm-14/bin/clang++
  $ dpkg -s clang-14 | grep -e Version -e Depends
  Version: 1:14.0.0-1ubuntu1.1
  Depends: libc6 (>= 2.34), libclang-cpp14 (>= 1:14.0.0), libgcc-s1 (>= 3.0), libllvm14, libstdc++6 (>= 11), libstdc++-11-dev, libgcc-11-dev, libobjc-11-dev, libclang-common-14-dev (= 1:14.0.0-1ubuntu1.1), llvm-14-linker-tools (= 1:14.0.0-1ubuntu1.1), libclang1-14 (= 1:14.0.0-1ubuntu1.1), libc6-dev, binutils
  ```

  The problem turns out to be that clang++ 14 wants libstdc++-12-dev,
  but declares a dependency on libstdc++-11-dev.

  I filed this bug under clang-14 because that's the default clang, but
  I think all the other Clang versions in Ubuntu 22.04 are affected.

  This has happened before with different versions
  (https://bugs.launchpad.net/ubuntu/+source/llvm-
  toolchain-10/+bug/1878881).

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-14/+bug/2038340/+subscriptions




More information about the foundations-bugs mailing list