为什么不能LD找到在/etc/ld.so.conf文件路径库? [英] Why can't ld find library from path in /etc/ld.so.conf?

查看:1563
本文介绍了为什么不能LD找到在/etc/ld.so.conf文件路径库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要添加的/ opt / Vertica的/ lib64目录进入系统库的路径,所以我做以下步骤:结果
(1)添加的/ opt / Vertica的/ lib64目录 /etc/ld.so.conf中,并运行 ldconfig的,结果
(2)检查它:

I want to add the /opt/vertica/lib64 into system library paths, so I do the following steps:
(1) Add the /opt/vertica/lib64 into/etc/ld.so.conf, and run ldconfig,
(2) Check it:

 bash# ldconfig -p | grep vertica
    libverticaodbc.so (libc6,x86-64) => /opt/vertica/lib64/libverticaodbc.so
    ......

但是当我运行 LD -lverticaodbc --verbose 命令:

==================================================
attempt to open /usr/x86_64-redhat-linux/lib64/libverticaodbc.so failed
attempt to open /usr/x86_64-redhat-linux/lib64/libverticaodbc.a failed
attempt to open /usr/local/lib64/libverticaodbc.so failed
attempt to open /usr/local/lib64/libverticaodbc.a failed
attempt to open /lib64/libverticaodbc.so failed
attempt to open /lib64/libverticaodbc.a failed
attempt to open /usr/lib64/libverticaodbc.so failed
attempt to open /usr/lib64/libverticaodbc.a failed
attempt to open /usr/x86_64-redhat-linux/lib/libverticaodbc.so failed
attempt to open /usr/x86_64-redhat-linux/lib/libverticaodbc.a failed
attempt to open /usr/lib64/libverticaodbc.so failed
attempt to open /usr/lib64/libverticaodbc.a failed
attempt to open /usr/local/lib/libverticaodbc.so failed
attempt to open /usr/local/lib/libverticaodbc.a failed
attempt to open /lib/libverticaodbc.so failed
attempt to open /lib/libverticaodbc.a failed
attempt to open /usr/lib/libverticaodbc.so failed
attempt to open /usr/lib/libverticaodbc.a failed
ld: cannot find -lverticaodbc

LD 没有找到 verticaodbc 的/ opt / Vertica的/ lib64的

任何人都可以提供一些线索?非常感谢!

Could anyone give some clues? Thanks very much!

推荐答案

LD 静态的的连接 ld.so 动态连接​​(和 ldconfig的&放大器; LDD 都涉及到动态链接程序)。

ld is the static linker. ld.so is the dynamic linker (and ldconfig & ldd are related to the dynamic linker).

您需要添加 -L /选择/ Vertica的/ lib64目录/ 在你的 LD 参数的链接的时间(你通常应该链接的gcc G ++ )。实事求是地讲,这意味着编辑的基础设施建设-e.g.你的的Makefile - 增加了几十个字符

You need to add -L/opt/vertica/lib64/ to your ld arguments at link time (and you usually should link with gcc or g++). Practically speaking, this means editing your build infrastructure -e.g. your Makefile - to add a few dozen characters.

请参阅 ld.so(8) LDD(1),的 LD(1),的 ldconfig的(8)

阅读也 Drepper的文章:如何写共享库 程序库方法文档&安培; 莱文的书:链接器和加载

Read also Drepper's paper: How To Write Shared Libraries, Program Library HowTo & Levine's book: Linkers and Loaders

这篇关于为什么不能LD找到在/etc/ld.so.conf文件路径库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆