clang ++ docker upgrade

docker (204) gcc (gnu), clang (llvm) Compile error / warning comparison (4) R_07_04.c https://qiita.com/kaizen_nagoya/items/73b9f16638273a74d807

When I tried to upgrade clang ++ on docker that I was using in, I got an error.

bin/bash


# apt update; apt -y upgrade
...

# clang++ --version
clang version 7.0.1-8+deb10u2 (tags/RELEASE_701/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
# apt upgrade clang++
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'librust-bindgen+testing-only-libclang-5-dev' for regex 'clang+'
Note, selecting 'librust-clang-sys-0+clang-3-6-dev' for regex 'clang+'
Note, selecting 'librust-clang-sys-0.27.0+gte-clang-6-0-dev' for regex 'clang+'
Note, selecting 'clang-modernize-6.0' for regex 'clang+'
Note, selecting 'clang-tidy-6.0' for regex 'clang+'
Note, selecting 'librust-bindgen-0+testing-only-libclang-5-dev' for regex 'clang+'
Note, selecting 'librust-clang-sys-0.27.0+default-dev' for regex 'clang+'
Note, selecting 'clang' for regex 'clang+'
Note, selecting 'arcanist-clang-format-linter' for regex 'clang+'
Note, selecting 'librust-clang-sys-0.27.0+clang-4-0-dev' for regex 'clang+'
Note, selecting 'librust-bindgen+testing-only-libclang-3-9-dev' for regex 'clang+'
Note, selecting 'librust-clang-sys-0.27+clang-4-0-dev' for regex 'clang+'
Note, selecting 'clang-tools-6.0' for regex 'clang+'
Note, selecting 'librust-clang-sys-dev' for regex 'clang+'

...

clang is already the newest version (1:7.0-47).
clang-7 is already the newest version (1:7.0.1-8+deb10u2).
clang-7 set to manually installed.
libclang-common-7-dev is already the newest version (1:7.0.1-8+deb10u2).
libclang-common-7-dev set to manually installed.
libclang1-7 is already the newest version (1:7.0.1-8+deb10u2).
libclang1-7 set to manually installed.
Calculating upgrade... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python-clang-6.0 : Conflicts: python-clang-x.y
 python-clang-7 : Conflicts: python-clang-x.y
E: Broken packages

# apt remove clang
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  clang
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 23.6 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 28587 files and directories currently installed.)
Removing clang (1:7.0-47) ...

LLVM Debian/Ubuntu nightly packages https://apt.llvm.org

# apt-get install clang-format clang-tidy clang-tools clang clangd libc++-dev libc++1 libc++abi-dev libc++abi1 libclang-dev libclang1 liblldb-dev libllvm-ocaml-dev libomp-dev libomp5 lld lldb llvm-dev llvm-runtime llvm python-clang
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package clangd
# 

I put gcc docker and tried again.

# wget https://apt.llvm.org/llvm.sh
# chmod +x llvm.sh
# sudo ./llvm.sh 10
+ needed_binaries=(lsb_release wget add-apt-repository)
+ missing_binaries=()
+ for binary in "${needed_binaries[@]}"
+ which lsb_release
+ missing_binaries+=($binary)
+ for binary in "${needed_binaries[@]}"
+ which wget
+ for binary in "${needed_binaries[@]}"
+ which add-apt-repository
+ missing_binaries+=($binary)
+ [[ 2 -gt 0 ]]
+ echo 'You are missing some tools this script requires: lsb_release' add-apt-repository
You are missing some tools this script requires: lsb_release add-apt-repository
+ echo '(hint: apt install lsb-release wget software-properties-common)'
(hint: apt install lsb-release wget software-properties-common)
+ exit 4

# apt install lsb-release wget software-properties-common
# sudo ./llvm.sh 10

...

Reading package lists... Done
+ apt-get install -y clang-10 lldb-10 lld-10 clangd-10
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 lldb-10 : Depends: liblldb-10 (>= 1:9~svn298832-1~) but it is not going to be installed
           Depends: python3-lldb-10 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Here now

Installing Clang 10 on Docker container https://baykara.medium.com/installing-clang-10-in-a-docker-container-4c24a4538af2

Clang 10 in a Docker container for C++17 and C++20 development https://solarianprogrammer.com/2017/12/14/clang-in-docker-container-cpp-17-development/

Recommended Posts

clang ++ docker upgrade
docker
Build Clang x VSCode on Docker (1)
docker memo
We introduced clang to docker today. (Solution)
spring × docker
About Docker
Docker Intellij
Docker basics
Docker installation
About Docker
Docker command
Docker memorandum
Understand Docker
Docker memorandum