简体   繁体   中英

cannot compile after installing new g++

I have installed the latest version of g++. I downloaded an rpm from here and I installed it on my Ubuntu machine (version is Precise 12.04 LTS) using the following commands

rpm -i gcc-c++-5.2.1-0.20150811.6.mga6.x86_64.rpm
sudo alien -i gcc-c++-5.2.1-0.20150811.6.mga6.x86_64.rpm

I can see that the the new version of the compiler has been installed in

/usr/bin/g++-5.2.1

but when I try to compile a file I receive the following error

/usr/lib/gcc/x86_64-mageia-linux-gnu/5.2.1/cc1plus: 
error while loading shared libraries: libisl.so.13: 
cannot open shared object file: No such file or directory

Do I have to install further rpm or further files? I've searched on my pc and I really don't have that shared library.

Well, unfortunately you have done something very bad . You have mixed packages from different Linux distros, which means that you might have already broken your system. I don't know how to uninstall the rpm package correctly you've installed. Actually, I don't know how you installed rpm on your Ubuntu. And if you have rpm package manager, I don't know why you need to use alien which essentially converts rpm to deb which is unnecessary if you have rpm package manager. So, undoing things you have done might be hard. If I were you, I'd do rpm -e <package-name> to uninstall the package, and note that alien has no such uninstalling option. If you're lucky enough to rescue your system from garbage, then I'd go search for a PPA (personal package archive) which contains g++5.2 . Since PPA's are native to deb package manager, which is the package manager of Ubuntu, you can usually use them with no harm, they will automatically install needed dependencies.

But unfortunately, I couldn't find a PPA containing the latest version of g++. So, you have to settle with 5.1.

Here are the instructions:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-5 g++-5

If you want a Linux Distro with rolling edge releases, you might want to look at Arch Linux, which provides g++5.2 by default. You might want to install it on a virtual machine.

Or you may want to install g++ from source. Google for it!

Following advice by user 'jnbrq' about using PPA in ubuntu I did the following

Installed synaptic to remove the RPM package converted by ALien

 sudo apt-get install synaptic

Then added the right PPP that allows to install latest version of g++

 sudo add-apt-repository ppa:ubuntu-toolchain-r/test
 sudo apt-get update

Then synaptic again to search for g++-5.1 and install latest version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM