【问题标题】:libGLEW.so.1.9: cannot open shared object file. no such file or directorylibGLEW.so.1.9:无法打开共享对象文件。没有相应的文件和目录
【发布时间】:2014-03-02 22:10:44
【问题描述】:

我正在尝试运行我制作的使用 glew 的应用程序。 它编译得很好,但是当我尝试运行它时,我收到错误:libGLEW.so.1.9:无法打开共享对象文件。没有相应的文件和目录。我检查了是否有它,它在 usr/lib64 中。 我在互联网上尝试了其他修复,并将 /etc/ld.so.conf 编辑为:

include /etc/ld.so.conf.d/*.conf /usr/lib64/libGLEW.so.1.9(adding this second path)

然后运行 ​​ldconfig,但终端吐出了一大堆乱码。

有人可以帮忙吗? 顺便说一句,对于没有信息的标题感到抱歉。

【问题讨论】:

  • 一般来说,这是您的操作系统发行版应该为您处理的事情(如果您使用它的包管理器进行所有安装)。尽管互联网上有随机页面,但如果您需要手动更改动态链接器的配置或更新其缓存,但您没有手动安装某些东西,那么某些东西就坏了。
  • 另外,这实际上是一个系统管理问题,而不是一个编程问题[因此在超级用户上可能比堆栈溢出更好],尤其不是 bash 问题(ld.so 附带 glibc,不是 bash)。
  • 我不得不手动安装 glew,因为 apt 存储库只有 glew 1.6。我需要 1.9
  • ...希望您不只是“安装”其他人的二进制文件,而是针对您的本地系统实际编译它们?
  • 不,我只是按照glew下载页面告诉我的去做了哈哈

标签: bash glew


【解决方案1】:

你应该阅读man ldconfig

描述

     ldconfig creates the necessary links  and  cache  to  the  most  recent
     shared  libraries  found  in  the  directories specified on the command
     line, in the file /etc/ld.so.conf, and in the trusted directories (/lib
     and  /usr/lib).  The cache is used by the run-time linker, ld.so or ld-
     linux.so.  ldconfig checks the header and filenames of the libraries it
     encounters  when  determining  which  versions  should have their links
     updated.

该文件应该是自动生成的。在 Gentoo 上,它只包含目录。

$ cat /etc/ld.so.conf
# ld.so.conf autogenerated by env-update; make all changes to
# contents of /etc/env.d directory
/lib64
/usr/lib64
/usr/local/lib64
/lib32
/usr/lib32
/usr/local/lib32
/lib
/usr/lib
/usr/local/lib
include ld.so.conf.d/*.conf
/usr/lib32/OpenCL/vendors/nvidia
/usr/lib64/OpenCL/vendors/nvidia
/usr/lib32/opengl/nvidia/lib
/usr/lib64/opengl/nvidia/lib
/usr/lib64/qca2
/usr/lib64/qt4
/usr/lib32/qt4
/usr/lib/qt4
/usr/lib/postgresql
/usr/lib64/postgresql
/usr/lib64/postgresql-9.3/lib64/
/usr/games/lib64
/usr/games/lib32
/usr/games/lib

查看 /etc/env.d ...

$ grep LD /etc/env.d/*
/etc/env.d/00basic:LDPATH='/lib64:/usr/lib64:/usr/local/lib64:/lib32:/usr/lib32:/usr/local/lib32:/lib:/usr/lib:/usr/local/lib'
/etc/env.d/00glibc:LDPATH="include ld.so.conf.d/*.conf"
/etc/env.d/03opencl:LDPATH="/usr/lib32/OpenCL/vendors/nvidia:/usr/lib64/OpenCL/vendors/nvidia"
/etc/env.d/03opengl:LDPATH="/usr/lib32/opengl/nvidia/lib:/usr/lib64/opengl/nvidia/lib"
/etc/env.d/44qca2:LDPATH="/usr/lib64/qca2"
/etc/env.d/44qt4:LDPATH="/usr/lib64/qt4:/usr/lib32/qt4:/usr/lib/qt4"
/etc/env.d/44qt4-emul:LDPATH=/usr/lib32/qt4
/etc/env.d/50postgresql:LDPATH="/usr/lib/postgresql:/usr/lib64/postgresql:/usr/lib64/postgresql-9.3/lib64/"
/etc/env.d/90games:LDPATH="/usr/games/lib64:/usr/games/lib32:/usr/games/lib"

根据我所看到的判断,您应该检查 /etc/ld.so.conf.d/ 中的文件,将其中一个复制到新文件中,例如 glew.conf,然后修改新文件中的路径以指向到lib文件所在的文件夹。

【讨论】:

    【解决方案2】:

    原来这是一个简单的错误。

    而不是添加路径来专门包含

    /usr/lib64/libGLEW.so.1.9
    

    ld.so.config 文件中,我尝试只包含路径

    /usr/lib64/
    

    【讨论】:

    • 你的意思不是要包括最后三个点,对吧?
    猜你喜欢
    • 1970-01-01
    • 2017-08-22
    • 1970-01-01
    • 1970-01-01
    • 2015-04-12
    • 2018-11-26
    • 2019-11-27
    • 2020-02-06
    • 1970-01-01
    相关资源
    最近更新 更多