How to install a shared library on Ubuntu Linux?
I'm having trouble shared libraries on my Ubuntu 10.04. I experienced it several times in the last months, read a lot about installing libs but I seem to miss the point.
Starting with the source code directory, I r开发者_Python百科un the following commands:
make
Runs clean, without any errorsudo make install
Seems to be working fine, ends with: cp foo.so.0.1 /usr/local/lib/ rm -f /usr/local/lib/foo.so ln -s /usr/local/lib/foo.so.0.1 /usr/local/lib/foo.sosudo ldconfig
Runs without any output
When writing a makefile, I can not address the lib by its name, but by its path:
Not working:-lfoo
Working: -L/usr/local/lib/foo.so
The problem stays the same, no matter what lib I try to install.
What am I missing here? Or what can I do to find out?
Is /usr/local/lib/
in your library search path? If not you will need to specify both -lfoo
and /usr/local/lib/
in your Makefile, so the linker knows where to look.
Whether or not /usr/local/lib/
is in your library search path is dependent on your distribution.
Remember that the library names should start with lib
and end with .so
. Maybe you are missing the starting lib
精彩评论