Failed to install llvm-14-dev package on ubuntu 22.04.1 LTS

Hi,

I am able to install llvm-14/clang-14 packages on my ubuntu host machine (22.04) using “apt-get install” command. but below failure is triggered if
i try to install ‘llvm-14-dev’ package as it’s required by ‘bcc’ source compilation.
{{
$ sudo apt-get install llvm-14-dev

Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
You might want to run ‘apt --fix-broken install’ to correct these.
The following packages have unmet dependencies:
llvm-14-dev : Depends: libffi-dev but it is not going to be installed
Depends: llvm-14-tools (= 1:14.0.0-1ubuntu1) but it is not going to be installed
Depends: libz3-dev but it is not going to be installed
Depends: libxml2-dev but it is not going to be installed
E: Unmet dependencies. Try ‘apt --fix-broken install’ with no packages (or specify a solution).
}}
any input please let me know.

Regards
KOTi

The debug info indicate you to install above dependencies needed by llvm-14.

try apt install libffi-dev ?

Hi Jazzer,

Let me share more information on failure. My actual target is to install ‘llvm-dev’ package.
{{

$ sudo apt install llvm-dev
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
llvm-dev is already the newest version (1:14.0-55~exp2).
You might want to run ‘apt --fix-broken install’ to correct these.
The following packages have unmet dependencies:
llvm-dev : Depends: llvm-14-dev (>= 14~) but it is not going to be installed
}}

Tried to install llvm-14-dev and it is in turn showing below failure.
{{
~$ sudo apt install llvm-14-dev
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
You might want to run ‘apt --fix-broken install’ to correct these.
The following packages have unmet dependencies:
llvm-14-dev : Depends: libffi-dev but it is not going to be installed
Depends: llvm-14-tools (= 1:14.0.0-1ubuntu1) but it is not going to be installed
Depends: libz3-dev but it is not going to be installed
Depends: libxml2-dev but it is not going to be installed
E: Unmet dependencies. Try ‘apt --fix-broken install’ with no packages (or specify a solution).
}}

Regards
koti

Hi,

Seems some issue with ‘apt’ utility as i noticed same issue as mentioned in previous comment when i tried to uninstall llvm/clang/lld packages.
{{
~$ sudo apt-get remove llvm
[sudo] password for koti:
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
You might want to run ‘apt --fix-broken install’ to correct these.
The following packages have unmet dependencies:
llvm-dev : Depends: llvm-14-dev (>= 14~) but it is not going to be installed
Depends: llvm but it is not going to be installed
E: Unmet dependencies. Try ‘apt --fix-broken install’ with no packages (or specify a solution).

$ sudo apt-get remove clang
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Package ‘clang’ is not installed, so not removed
You might want to run ‘apt --fix-broken install’ to correct these.
The following packages have unmet dependencies:
llvm-dev : Depends: llvm-14-dev (>= 14~) but it is not going to be installed
E: Unmet dependencies. Try ‘apt --fix-broken install’ with no packages (or specify a solution).

~$ sudo apt-get remove lld
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
You might want to run ‘apt --fix-broken install’ to correct these.
The following packages have unmet dependencies:
llvm-dev : Depends: llvm-14-dev (>= 14~) but it is not going to be installed
E: Unmet dependencies. Try ‘apt --fix-broken install’ with no packages (or specify a solution).
~$

Seems LLVM-14, Unable to correct problems, you have held broken packages - on Ubuntu-18 - #3 by sylvestre link provides some information about distro source link . i followed it but still seen issue in uninstallation / installation of llvm-14-dev package etc?
any input please let me know.

Regards
Koti

Hi,

with below command , i noticed llvm/clang packages are installed but llvm-dev package is removed by default as part of installation of llvm/clang package.
{{
~$ sudo apt-get remove
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
You might want to run ‘apt --fix-broken install’ to correct these.
The following packages have unmet dependencies:
llvm-dev : Depends: llvm-14-dev (>= 14~) but it is not installed
E: Unmet dependencies. Try ‘apt --fix-broken install’ with no packages (or specify a solution).
koti@koti-OptiPlex-5090:~$ sudo apt --fix-broken install
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Correcting dependencies… Done
The following packages were automatically installed and are no longer required:
cups-server-common evince-common hplip-data libcupsimage2 libhpmud0 libimagequant0 libraqm0 libsane-hpaio
printer-driver-postscript-hp python3-olefile python3-pil python3-renderpm python3-reportlab python3-reportlab-accel ssl-cert
Use ‘sudo apt autoremove’ to remove them.
The following additional packages will be installed:
clang-14 clang-format-14 libclang-14-dev libclang-common-14-dev libclang-cpp14 libclang-cpp14-dev libclang1-14 libllvm14 lld-14
llvm-14 llvm-14-linker-tools llvm-14-runtime
Suggested packages:
clang-14-doc wasi-libc llvm-14-doc
Recommended packages:
llvm-14-dev libclang-rt-14-dev
The following packages will be REMOVED:
** llvm-dev**
The following packages will be upgraded:
clang-14 clang-format-14 libclang-14-dev libclang-common-14-dev libclang-cpp14 libclang-cpp14-dev libclang1-14 libllvm14 lld-14
llvm-14 llvm-14-linker-tools llvm-14-runtime
12 upgraded, 0 newly installed, 1 to remove and 18 not upgraded.
1 not fully installed or removed.
Need to get 85.5 MB of archives.
After this operation, 56.2 MB disk space will be freed.
Do you want to continue? [Y/n] Y
Get:1 Index of /jammy/ llvm-toolchain-jammy-14/main amd64 libclang-cpp14-dev amd64 1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127 [58.3 kB]
Get:2 Index of /jammy/ llvm-toolchain-jammy-14/main amd64 lld-14 amd64 1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127 [1,303 kB]
Get:3 Index of /jammy/ llvm-toolchain-jammy-14/main amd64 libclang-14-dev amd64 1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127 [25.3 MB]
Get:4 Index of /jammy/ llvm-toolchain-jammy-14/main amd64 clang-14 amd64 1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127 [135 kB]
Get:5 Index of /jammy/ llvm-toolchain-jammy-14/main amd64 libclang1-14 amd64 1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127 [6,872 kB]
Get:6 Index of /jammy/ llvm-toolchain-jammy-14/main amd64 libclang-common-14-dev all 1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127 [907 kB]
Get:7 Index of /jammy/ llvm-toolchain-jammy-14/main amd64 clang-format-14 amd64 1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127 [105 kB]
Get:8 Index of /jammy/ llvm-toolchain-jammy-14/main amd64 libclang-cpp14 amd64 1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127 [12.1 MB]
Get:9 Index of /jammy/ llvm-toolchain-jammy-14/main amd64 libllvm14 amd64 1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127 [24.0 MB]
Get:10 Index of /jammy/ llvm-toolchain-jammy-14/main amd64 llvm-14 amd64 1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127 [12.8 MB]
Get:11 Index of /jammy/ llvm-toolchain-jammy-14/main amd64 llvm-14-runtime amd64 1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127 [539 kB]
Get:12 Index of /jammy/ llvm-toolchain-jammy-14/main amd64 llvm-14-linker-tools amd64 1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127 [1,408 kB]
Fetched 85.5 MB in 14s (6,240 kB/s)
dpkg: warning: files list file for package ‘rsync’ missing; assuming package has no files currently installed
(Reading database … 253599 files and directories currently installed.)
Removing llvm-dev (1:14.0-55~exp2) …
dpkg: warning: files list file for package ‘rsync’ missing; assuming package has no files currently installed
(Reading database … 253589 files and directories currently installed.)
Preparing to unpack …/00-libclang-cpp14-dev_1%3a14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127_amd64.deb …
Unpacking libclang-cpp14-dev (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) over (1:14.0.0-1ubuntu1) …
Preparing to unpack …/01-lld-14_1%3a14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127_amd64.deb …
Unpacking lld-14 (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) over (1:14.0.0-1ubuntu1) …
Preparing to unpack …/02-libclang-14-dev_1%3a14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127_amd64.deb …
Unpacking libclang-14-dev (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) over (1:14.0.0-1ubuntu1) …
Preparing to unpack …/03-clang-14_1%3a14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127_amd64.deb …
Unpacking clang-14 (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) over (1:14.0.0-1ubuntu1) …
Preparing to unpack …/04-libclang1-14_1%3a14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127_amd64.deb …
Unpacking libclang1-14 (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) over (1:14.0.0-1ubuntu1) …
Preparing to unpack …/05-libclang-common-14-dev_1%3a14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127_all.deb …
Unpacking libclang-common-14-dev (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) over (1:14.0.0-1ubuntu1) …
Preparing to unpack …/06-clang-format-14_1%3a14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127_amd64.deb …
Unpacking clang-format-14 (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) over (1:14.0.0-1ubuntu1) …
Preparing to unpack …/07-libclang-cpp14_1%3a14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127_amd64.deb …
Unpacking libclang-cpp14 (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) over (1:14.0.0-1ubuntu1) …
Preparing to unpack …/08-libllvm14_1%3a14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127_amd64.deb …
Unpacking libllvm14:amd64 (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) over (1:14.0.0-1ubuntu1) …
Preparing to unpack …/09-llvm-14_1%3a14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127_amd64.deb …
Unpacking llvm-14 (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) over (1:14.0.0-1ubuntu1) …
Preparing to unpack …/10-llvm-14-runtime_1%3a14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127_amd64.deb …
Unpacking llvm-14-runtime (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) over (1:14.0.0-1ubuntu1) …
Preparing to unpack …/11-llvm-14-linker-tools_1%3a14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127_amd64.deb …
Unpacking llvm-14-linker-tools (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) over (1:14.0.0-1ubuntu1) …
Setting up libllvm14:amd64 (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) …
Setting up llvm-14-linker-tools (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) …
Setting up libclang1-14 (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) …
Setting up llvm-14-runtime (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) …
Setting up libclang-common-14-dev (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) …
Setting up libclang-cpp14 (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) …
Setting up lld-14 (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) …
Setting up libclang-14-dev (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) …
Setting up clang-format-14 (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) …
Setting up libclang-cpp14-dev (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) …
Setting up llvm-14 (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) …
Setting up clang-14 (1:14.0.6~++20230131082223+f28c006a5895-1~exp1~20230131082249.127) …
Processing triggers for man-db (2.10.2-1) …
Processing triggers for libc-bin (2.35-0ubuntu3.1) …
}}

So triggered llvm-dev package installation and it fails with below error.
{{
~$ sudo apt-get install llvm-14-dev
Reading package lists… Done
Building dependency tree… Done
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:
libxml2-dev : Depends: libxml2 (= 2.9.13+dfsg-1build1) but 2.9.13+dfsg-1ubuntu0.1 is to be installed
E: Unable to correct problems, you have held broken packages.

}}
~$ sudo apt-get install libxml2
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
libxml2 is already the newest version (2.9.13+dfsg-1ubuntu0.1).
The following packages were automatically installed and are no longer required:
cups-server-common evince-common hplip-data libcupsimage2 libhpmud0 libimagequant0 libraqm0 libsane-hpaio
printer-driver-postscript-hp python3-olefile python3-pil python3-renderpm python3-reportlab python3-reportlab-accel ssl-cert
Use ‘sudo apt autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 18 not upgraded.
}}
{{
~$ sudo apt-get install libxml2-dev
Reading package lists… Done
Building dependency tree… Done
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:
libxml2-dev : Depends: libxml2 (= 2.9.13+dfsg-1build1) but 2.9.13+dfsg-1ubuntu0.1 is to be installed
E: Unable to correct problems, you have held broken packages.
}}
libxml2-dev package installation is broken and please let me know if you have input on it.?
Regards
Koti