9

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.


EDIT:

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!).

  • 1
    This is not a duplicate, by the way. It has nothing to do with unmet dependencies. It basically tries to install libc*. – isanae Mar 08 '17 at 19:08

3 Answers3

16

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
2

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.

Gx1sptDTDa
  • 1,673
  • 1
  • 15
  • 23
1

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.

saiarcot895
  • 10,757
  • 2
  • 36
  • 39
  • 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 . 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 . Without -stdlib=libc++ it uses the gcc . 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: http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu 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
  • Does it work now with the -stdlib=libc++ flag? (You'll still probably need that flag, since Ubuntu uses GCC by default, and probably has Clang using the GCC standard library.) – saiarcot895 May 24 '14 at 18:56
  • Yes, it works with -stdlib=libc++. I kind of figured out that would be necessary because otherwise it went straight for the gcc version. Thank you for the help! I edited the question. I cannot yet answer myself and accept the answer. – Victor Savu May 24 '14 at 19:01