我通过将文件添加到/etc/ld.so.conf
,将自定义位置(/opt/lib
(添加到我的库路径中。 我编译了 git2 库并将其安装在那里。
我正在尝试安装需要该库的pygit,但是不断收到错误,说找不到-lgit2
。
我仔细检查了一下,ldconfig 似乎错过了该符号链接。
这是终端上的输出。
/opt/lib$ ls
libgit2.so libgit2.so.0.26.3 libgit2.so.26 pkgconfig
/opt/lib$ sudo ldconfig
/opt/lib$ sudo ldconfig -v | grep libgit
ldconfig: Can't stat /usr/local/lib/i386-linux-gnu: No such file or directory
ldconfig: Can't stat /usr/local/lib/i686-linux-gnu: No such file or directory
ldconfig: Can't stat /lib/i686-linux-gnu: No such file or directory
ldconfig: Can't stat /usr/lib/i686-linux-gnu: No such file or directory
ldconfig: Can't stat /usr/local/lib/x86_64-linux-gnu: No such file or directory
ldconfig: Path `/lib/x86_64-linux-gnu' given more than once
ldconfig: Path `/usr/lib/x86_64-linux-gnu' given more than once
ldconfig: /lib/i386-linux-gnu/ld-2.27.so is the dynamic linker, ignoring
ldconfig: /lib/x86_64-linux-gnu/ld-2.27.so is the dynamic linker, ignoring
libgit2.so.26 -> libgit2.so.0.26.3
ldconfig: /lib32/ld-2.27.so is the dynamic linker, ignoring
我如何让它拿起libgit2.so
?
libgit2.so
是一个链接编辑器(ld(输入文件。 /etc/ld.so.conf
配置运行时动态链接器的路径。 这两者之间的关系是动态链接器使用链接编辑器的输出。 两者都碰巧也参考了LD_LIBRARY_PATH
环境变量。 除此之外,它们是完全独立的程序,具有不同的命令行选项。
所以你需要设置LD_LIBRARY_PATH
(以后可能会混淆,所以这不是一个好主意(,或者更好的是,使用 -L
指定包含libgit2.so
链接编辑器输入文件的目录的路径。