The error usually happened after you installed a package from third-party repository, such as an Ubuntu PPA. Then, you removed that PPA. But, the packages you're going to install require another version of the package that you installed from that PPA.
The point is to find out which package
or which PPA
cause the conflict. Then, install the correct version of that package (using Synaptic Package Manager for example), or add back the PPA and purge it which will downgrade all installed packages to stock versions:
sudo apt install ppa-purge && sudo ppa-purge ppa:maintainer-id/ppa-name
In the case, I'll try the command mentioned in the output first: sudo apt --fix-broken install
, or use sudo aptitude install build-essential git cmake flex bison ...
to see if it could help.
Or, use apt command to try installing every packages in the output that you provided:
sudo apt install libjsoncpp25
sudo apt install cmake-data
sudo apt install libsdl2-2.0-0
...
...
Until it tells me something like:Depends: key-package (=x.x.x) but anther version (x.x.x) is already installed.
And, finally switch the key-package version either via command below or by Synaptic package manager.:
sudo apt install key-package=x.x.x
git
andbuild-essential
were already installed. Stop trying to install them. Enjoy your success and move on. – user535733 Oct 04 '22 at 14:05