How can I tell which libstdc++ double-conversion wants?

孤街浪徒 提交于 2019-12-07 23:16:09

问题


Here's the error I see when trying to load a .hs file into ghci.

>Loading package http-enumerator-0.7.1.1 ... linking ... done.
>Loading package double-conversion-0.2.0.1 ... can't load .so/.DLL for: stdc++ ?>>>     (libstdc++.so: cannot open shared object file: No such file or directory)

Further investigation reveals I have multiple stdc++ libraries installed

>locate libstdc++.so
>/usr/lib/libstdc++.so.6
>/usr/lib/libstdc++.so.6.0.14
>/usr/lib/gcc/x86_64-linux-gnu/4.4/libstdc++.so
>/usr/lib32/libstdc++.so.6
>/usr/lib32/libstdc++.so.6.0.14

I thought maybe I could make a symlink to what it wants, but I have no idea which one. I'm using this OS 2.6.35-22-server #33-Ubuntu SMP Sun Sep 19 20:48:58 UTC 2010 x86_64 GNU/Linux

How can I tell exactly what it wants?


回答1:


The ones in /usr/lib symlink to one file:

$ ls -l libstdc++*
lrwxrwxrwx 1 root root      19 2011-09-24 22:14 libstdc++.so.6 -> libstdc++.so.6.0.13
-rw-r--r-- 1 root root 1044112 2010-03-26 20:16 libstdc++.so.6.0.13

Just run:

sudo ln -si /usr/lib/libstdc++.so.6 /usr/lib/libstdc++.so

and it should work.




回答2:


/usr/lib/libstdc++.so.6 should be a symlink to /usr/lib/libstdc++.so.6.0.14. This is probably the version you need.

/usr/lib32/libstdc++.so.6 should be a symlink to /usr/lib32/libstdc++.so.6.0.14, they are for 32-bit programs, you don't normally need them.

/usr/lib/gcc/x86_64-linux-gnu/4.4/libstdc++.so is the problem.

double-conversion-0.2.0.1 probably has got linked against it, and ghci cannot find it. Normally everything should be linked against libstdc++.so.6, not libstdc++.so without a version suffix.

I think one should not have a version-less libstdc++.so at all anywhere in the system. (There's none on my gentoo box for example.) It is dangerous, as different major versions of libstdc++ are usually binary incompatible. Try removing the library you have under /usr/lib/gcc/, then reinstall gcc and see if it gets installed again.

If it does get installed, then a symlink named /usr/lib/libstdc++.so pointing to /usr/lib/libstdc++.so.6 should solve this problem. I'm not sure this would be the right way to solve it in the long run though.

These are things I have found through experiments with my own Linux box. I am not an expert in Ubuntu, it may do things differently from other Linuxes.




回答3:


To work around the issue on 64-bit Fedora 16:

sudo ln -si /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so


来源:https://stackoverflow.com/questions/7761880/how-can-i-tell-which-libstdc-double-conversion-wants

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!