title: linking pthread library issue
body: <p>Am facing a problem that may be slightly complicated to explain and understand as giving the entire picture would be too big and difficult.</p>
  
  <p>Please excuse me for it.</p>
  
  <p>Consider the following Makefile:</p>
  
  <pre><code>all: clients.so simulator backup
      LD_PRELOAD=/home/Juggler/client/clients.so ./simulator
  
  backup: backup.c libclient.a
      gcc backup.c -o backup -L /home/Juggler/client -L. -lclient -ldl
  simulator: simulator.c libclient.a
      gcc -g simulator.c -o simulator -L /home/Juggler/client -L. -lclient -ldl -pthread
  libclient.a: libclient.o client.o
      ar rcs libclient.a libclient.o client.o
  libclient.o:libclient.c  
      gcc -c libclient.c -o libclient.o -pthread
  
  clients.so: client.o client_invoke.o
      ld -shared -o clients.so client_invoke.o client.o -ldl
  client_invoke.o: client_invoke.c
      gcc -Wall -fPIC -DPIC -c -g client_invoke.c
  client.o: client.c
      gcc -Wall -fPIC -DPIC -c -g client.c -ldl -pthread
  </code></pre>
  
  <p>We call function written in client.c from libclient.c and these functions in client.c make call to pthread_key_create(), pthread_setspecific..etc.</p>
  
  <p>Threads are created by simulator.c and theses threads access functions written in he other files.</p>
  
  <p>On doing make...Errors like the following appear. </p>
  
  <pre><code>/home/Juggler/client/libclient.a(client.o):In function 'setup_connection':
  /home/Juggler/client/client.c:35: undefined reference to 'pthread_setspecific'
  </code></pre>
  
  <p>pthread.h has been included in both client.c and libclient.c</p>
  
  <p>Would be grateful for anypointers . I understand information is very less...</p>
  
  <p>Thanks</p>