Problems when linking shared library
gcc
looks for libhello.so
when linking a new program. libhello.so.0
is used when the dynamic dependencies of an already linked program are searched.
In other terms: gcc -o main main.o -lhello -L.
looks for libhello.so
, and ./main
looks for libhello.so.0
. This allows to have multiple versions of a library available for legacy programs while precisely identifying the library that matches the installed headers.
A symlink libhello.so
-> libhello.so.0.0.0
should do the trick.
libhdfs - cannot open shared library libhdfs.so.0.0.0.0
You can try ldconfig $HADOOP_HDFS_HOME/lib/native
What do the numbers behind a library mean?
What do all these numbers mean?
These are called external library versioning. You can read a detailed explanation here.
RedLevel1 and Cannot open shared object file: No such file or directory
This really shows how much of a rookie I am, but the problem seemed to have resolved after running make clean
and running make
a second time.
shared library--libvw.so.0--is missing
From the messaging back and forth, it looks like you have the library installed in /usr/local/lib. But your application doesn't know to look there for the library.
You can solve this in a few ways.
You can give special flags when you configure/build your project to tell your binary to check in /usr/local/lib. If you know how to set flags on build, you should set
LDFLAGS=-Wl,-rpath,/usr/local/lib
. This would make you rebuild though.The runtime linker looks at an environment variable named
LD_LIBRARY_PATH
to see what directories to check when looking for shared libraries. In this case, if you typeexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
and then run your program, it should work.If you have multiple programs that need the /usr/local/lib directory, and you feel it is safe to include for everyone, you can set the runtime linker to try /usr/local/lib every time. You can drop a file in
/etc/ld.so.conf.d
or edit/etc/ld.so.conf
to add /usr/local/lib. This would affect every executable on your system, so I consider this one pretty advanced.
In short, you need to tell your program how to find the library. The easiest one for now is to set the LD_LIBRARY_PATH
variable with export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
Related Topics
How to Find The Version of a Compiled Kernel Module
Snort Message - Warning: No Preprocessors Configured for Policy 0
On Linux, Is Access() Faster Than Stat()
Apt-Update in Azure Nvidia Gives Publickey Error
The Only Overhead Incurred by Fork Is Page Table Duplication and Process Id Creation
Compare Two Different Urls Using Linux
Error Installing 'Topicmodels' Package, Non Zero Exit Status; Ubuntu
Can an Rpm Spec File "Include" Other Files
Cmake: Don't Set Rpath for a Single Library Used in Link
Emacs/Xterm Color Annoyance on Linux
Ffmpeg Install on Centos 64-Bit 'Install with -Fpic' Error
How Many Objects Are Returned by Aws S3API List-Objects
How to Start a Process in Its Own Process Group
Library Path Order for Alternate Glibc Dynamic Linker (Ld.So)
Replace in a CSV File Value of a Column
Add Timestamp to Cat Output from Shell Script
Is It Secure to Rely on "X-Forwarded-For" to Restrict Access by Ip in Apache While Using Cloudflare