Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ubuntu 16.04: stdc++ not recognized #20

Open
JeffreyBenjaminBrown opened this issue Nov 3, 2017 · 9 comments
Open

Ubuntu 16.04: stdc++ not recognized #20

JeffreyBenjaminBrown opened this issue Nov 3, 2017 · 9 comments

Comments

@JeffreyBenjaminBrown
Copy link

When I run apt-get install libstdc++6, I am informed that libstdc++6 is already the newest version (7.2.0-1ubuntu1~16.04).

But when I try to install double-conversion (using Stack), I get this error:

    Cabal-simple_mPHDZzAJ_1.24.2.0_ghc-8.0.2: Missing dependency on a foreign
    library:
    * Missing C library: stdc++
@hvr
Copy link
Member

hvr commented Nov 3, 2017

@JeffreyBenjaminBrown the libstdc++6 package only provides the bare library, without the files needed for compile-time linkage;

I'd suggest to apt install g++ as that will iirc result in a minimal C++ devel environment of necessary -dev packages for C++ usage being installed, including the libstdc++-5-dev package, which is the one missing specifically.

@JeffreyBenjaminBrown
Copy link
Author

Thank you, Mr. Riedel!

My system claims to already have the latest versions of both of those:

jeff@jbb-lenovo:~$ sudo apt install g++
[sudo] password for jeff: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
g++ is already the newest version (4:5.3.1-1ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

jeff@jbb-lenovo:~$ sudo apt install libstdc++-5-dev 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libstdc++-5-dev is already the newest version (5.4.1-2ubuntu1~16.04).
libstdc++-5-dev set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

@hvr
Copy link
Member

hvr commented Nov 3, 2017

That's strange; can you create a file hello.cc somewhere with the content below, and then compile&link that via g++ hello.cc -o hello and see if that results in an executable hello?

#include <iostream>

int main(int argc, char *argv[])
{
  std::cout << "Hello" << std::endl;
  return 0;
}

@JeffreyBenjaminBrown
Copy link
Author

Yessir! It seems to work:

jeff@jbb-lenovo:~/code/test-for-double-conversion$ cat hello.cc 
#include <iostream>

int main(int argc, char *argv[])
{
  std::cout << "Hello" << std::endl;
  return 0;
}
jeff@jbb-lenovo:~/code/test-for-double-conversion$ g++ hello.cc -o hello
jeff@jbb-lenovo:~/code/test-for-double-conversion$ ./hello 
Hello
jeff@jbb-lenovo:~/code/test-for-double-conversion$ 

@hvr
Copy link
Member

hvr commented Nov 3, 2017

@JeffreyBenjaminBrown can I ask you try to use Cabal to install double-conversion to see if that would have worked? You can either use Ubuntu's GHC by installing via apt install ghc cabal-install (or by using my Ubuntu PPA (see https://launchpad.net/~hvr/+archive/ubuntu/ghc) if you need a newer GHC than GHC 7.10.3);

and then just try cabal install double-conversion

@JeffreyBenjaminBrown
Copy link
Author

Installing via cabal worked! My global Haskell installation uses GHC 7.10.3. (Alas, the code I hope to use it with is in Stack ..)

@janvogt
Copy link

janvogt commented Mar 15, 2018

I'm hitting the same issue on CentOS 6, did you find a solution?

@JeffreyBenjaminBrown
Copy link
Author

@janvogt Aside from using Cabal? I did not. But I didn't keep looking either; it might be out there.

@gvolpe
Copy link

gvolpe commented Jan 11, 2019

People using Ubuntu or any other Debian-based distro here there are two solutions that worked for me:

  1. Just install g++-7 before running stack build:
apt-get update && apt-get install g++-7 -y
  1. It's a bit longer but it's the first workaround I found and involves the creation of symbolic links:
ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/libstdc++.so
ln -s /usr/bin/g++-5 /usr/bin/g++
export PATH="/usr/lib/gcc/x86_64-linux-gnu/5:$PATH"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants