Why can't I find the library from the path in / etc / ld.so.conf?
I want to add /opt/vertica/lib64
in the paths to the system library, so I do the following steps:
(1) Add /opt/vertica/lib64
in /etc/ld.so.conf
and run ldconfig
,
(2) Check:
bash# ldconfig -p | grep vertica
libverticaodbc.so (libc6,x86-64) => /opt/vertica/lib64/libverticaodbc.so
......
But when I run the command " 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
does not find verticaodbc
from /opt/vertica/lib64
.
Can anyone provide any hints? Many thanks!
source to share
ld
is a static linker . ld.so
- dynamic linker (and ldconfig
and ldd
are associated with dynamic linker).
You need to add -L/opt/vertica/lib64/
to your arguments ld
at link time (and you should usually link to gcc
or g++
). In practice, this means editing the build infrastructure - for example, yours Makefile
- to add a few dozen symbols.
See ld.so (8) , ldd (1) , ld (1) , ldconfig (8)
Also Read The Drepper Document: How to Write Shared Libraries , The HowTo Program Library , and Levin's Book: Linkers and Loaders
source to share