Quantcast
Viewing all articles
Browse latest Browse all 22155

How to deploy a shared library?

I would like to "quickly" deploy a shared library on my Ubuntu. It is for a short term project so I don't want to use auto-tools here, but do everything manually.

So I built my library with this:

%.o: %.c    $(CC) -fPIC -c $(CFLAGS) -o $@ $< -MMD -MF $(@:.o=.d)lib%.so: %.o | dist    $(CC) -shared -o dist/$@ $^dist:    mkdir -p distinstall: lib    mkdir -p $(PREFIX)/lib/foobar    mkdir -p $(PREFIX)/include/foobar    cp dist/*.so $(PREFIX)/lib/foobar    cp dist/*.h $(PREFIX)/include/foobar    ldconfig $(PREFIX)/lib/foobar/

In another project, I would like to use libfoo.so now located in /usr/lib/foobar/libfoo.so. So I've built it with:

$(CC) test.c -lfoo 

Unfortunately I have this issue:

/usr/bin/ld: cannot find -lfoo

I now that I can do -L/usr/lib/foobar/libfoo.so but this location should be known by my operating system.

Am I forced to put it directly into /usr/lib? I have the same issue with /usr/local/lib which doesn't seem to be the default route to be used with gcc ... -l...

How should I normally deploy a shared library?


Viewing all articles
Browse latest Browse all 22155

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>