0

Context: a classic linux system (archlinux) with a gcc toolchain

My program (let's call it P) depends on a shared lib of mine (let's call it "foo" or libfoo.so)

libfoo.so got a public header foo.h and P includes it in one of its files.

libfoo.so depends on the pthread lib for several public functions (among other functions present in foo.h) but P does NOT use those functions.

The problem is, when I link P with libfoo.so, the libpthread is requested and I don't understand why and how to fix this.

Guid
  • 2,137
  • 2
  • 20
  • 33
  • Add `-pthread` to your GCC command line. – Kerrek SB Nov 21 '12 at 22:01
  • and I don't want to link against libpthread because P does not use any of the libpthread fonctionnalites :) – Guid Nov 21 '12 at 22:03
  • 1
    but P depends on libfoo, and libfoo depends on pthread, so P depends on pthread. you need the headers – Jarry Nov 21 '12 at 22:04
  • Have a look at http://stackoverflow.com/questions/3571300/incorporate-so-into-another-so-without-dependency. And as users of libfoo do not use pthread, removing dependency to pthread from foo.h is a good idea too. – Michael Shmalko Nov 22 '12 at 00:20

0 Answers0