我想将/opt/vertica/lib64
添加到系统库路径中,因此我执行以下步骤:
(1)将/opt/vertica/lib64
添加到/etc/ld.so.conf
,然后运行ldconfig
,
(2)检查:
bash# ldconfig -p | grep vertica
libverticaodbc.so (libc6,x86-64) => /opt/vertica/lib64/libverticaodbc.so
......
但是当我跑#34; 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
。
有人能提供一些线索吗?非常感谢!
答案 0 :(得分:1)
ld
是静态 linker。 ld.so
是dynamic linker(ldconfig
& ldd
与动态链接器相关。)
您需要在链接时将-L/opt/vertica/lib64/
添加到ld
个参数中(通常应与gcc
或g++
相关联)。实际上,这意味着编辑您的构建基础架构 - 例如。你的Makefile
- 添加几十个字符。
见ld.so(8),ldd(1),ld(1),ldconfig(8)
另请阅读Drepper's paper: How To Write Shared Libraries,Program Library HowTo& Levine's book: Linkers and Loaders