开发者

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:

  1. make

    Runs clean, without any error

  2. sudo 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.so

  3. sudo 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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜