Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

This question already has an answer here:

How should I correctly install clang's c++ library (with STL) on my lubuntu machine? I want to use clang and its c++ library because it offers better support for the upcoming c++14 standard.

When trying to install libc++:

sudo apt-get install libc++

I get:

<!-- Fairly large amount of installed/up-to-date packages which I removed from the post-->
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:
 libcgi-application-plugin-captcha-perl : Depends: libdata-random-perl but it is not going to be installed
 libcloog-isl-dev : Conflicts: libcloog-ppl-dev but 0.16.1-5 is to be installed
 libclutter-gst-2.0-doc : Conflicts: libclutter-gst-doc but 1.6.0-2build1 is to be installed
 libcuda1-304 : Conflicts: libcuda-5.0-1
 libcuda1-304-updates : Conflicts: libcuda-5.0-1
 libcuda1-331 : Breaks: libcuda-5.0-1
                Breaks: libcuda-5.5-1
 libcuda1-331-updates : Breaks: libcuda-5.0-1
                        Breaks: libcuda-5.5-1
 libcunit1-ncurses : Conflicts: libcunit1 but 2.1-2.dfsg-1 is to be installed
 libcunit1-ncurses-dev : Conflicts: libcunit1-dev but 2.1-2.dfsg-1 is to be installed
 libcurl4-gnutls-dev : Conflicts: libcurl4-nss-dev but 7.35.0-1ubuntu2 is to be installed
                       Conflicts: libcurl4-openssl-dev but 7.35.0-1ubuntu2 is to be installed
 libcurl4-nss-dev : Conflicts: libcurl4-gnutls-dev but 7.35.0-1ubuntu2 is to be installed
                    Conflicts: libcurl4-openssl-dev but 7.35.0-1ubuntu2 is to be installed
 libcurl4-openssl-dev : Conflicts: libcurl4-gnutls-dev but 7.35.0-1ubuntu2 is to be installed
                        Conflicts: libcurl4-nss-dev but 7.35.0-1ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.

I am running lubuntu 14.04 on a Samsung Series 9 Ultrabook. I don't understand the conflicts, especially the ones related to CUDA, which is supposed to be only for systems with an NVidia GPU.

Please let me know what other information I need to provide.


After some trying around, I installed the libc++-dev package:

sudo apt-get install libc++-dev

This installed the header files which clang now finds and uses. This doesn't answer the original question of why apt-get attempted to install libc++ which apparently doesn't exist and why it got into conflicts (whith CUDA of all things!).

share|improve this question

marked as duplicate by i08in, Warren Hill, Eric Carvalho, psusi, Sneetsher May 26 '14 at 14:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

3 Answers 3

up vote 4 down vote accepted

There is no package called libc++. It is libc++1.

So run the command as :

sudo apt-get install libc++1 multiarch-support libc6 libc++-dev libc++-helpers libc++-test libc++abi-dev libc++abi-test libc++abi1
share|improve this answer

The package libc++ doesn't exist. Most likely, apt-get is treating "libc++" as a regex and installing anything that matches that regex. Hence, you get the long list of packages to install.

The package you're (probably) looking for is libc++1.

share|improve this answer
It is strange that apt-get should do that. This link suggests that such a package exists. I downloaded the package from this link, unzipped it, built it and installed it to a directory <dir>. I can use clang++ -stdlib=libc++ -std=c++1y -I <dir>/include/c++/v1/ to build a simple "Hello world" program. Without the -I [...], it complains about not being able to find <iostream>. Without -stdlib=libc++ it uses the gcc <iostream>. This is all after I installed libc++1 as you suggested. – Victor Savu May 24 '14 at 18:23
That's the name of the source package, not the binary package that apt-get (by default) installs. Also, you can get the source package through apt-get by running either apt-get source libc++ or apt-get libc++1 (source packages should be recognized here). – saiarcot895 May 24 '14 at 18:26
sudo apt-get install libc++1 will install it in system-wide directories, but you shouldn't have to have a manual -I for the libc++. I'll try to look into this. – saiarcot895 May 24 '14 at 18:35
As I wrote in another comment below, libc++1 didn't seem to install any headers. I looked for iostream on my file system and I could only find the gcc ones (from 4.8 and 4.9). Are the STL header files in another castle? Sorry, I am not much of an expert so I am trying to provide whatever information I imagine could help. Speaking of which, this might be important: I am using the following ppa: trusty main I would expect that is where apt-get found the libc++1 which it installed. – Victor Savu May 24 '14 at 18:46
Yes, the package was libc++-dev. It now seems a bit obvious :) – Victor Savu May 24 '14 at 18:55

Firstly type 'sudo apt-get -f install'. This will try to fix broken dependencies. If this ends up 'and x not upgraded', then type the following afterwards: 'sudo apt-get dist-upgrade'. This last command might install some new packages, so be careful.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.