Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6575007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:20:03+00:00 2026-05-25T15:20:03+00:00

Am facing a problem that may be slightly complicated to explain and understand as

  • 0

Am facing a problem that may be slightly complicated to explain and understand as giving the entire picture would be too big and difficult.

Please excuse me for it.

Consider the following Makefile:

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

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.

Threads are created by simulator.c and theses threads access functions written in he other files.

On doing make…Errors like the following appear.

/home/Juggler/client/libclient.a(client.o):In function 'setup_connection':
/home/Juggler/client/client.c:35: undefined reference to 'pthread_setspecific'

pthread.h has been included in both client.c and libclient.c

Would be grateful for anypointers . I understand information is very less…

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:20:04+00:00Added an answer on May 25, 2026 at 3:20 pm

    On linux, pthread functions live in the libpthread library. So you have to link to that.

    The proper way, when using pthreads, is to compile and link using the -pthread , which, among other things, will link in the pthread library. You have the -pthread flag for some of your executables, but not for others, and not for your clients.so library, so add the flag where required.

    Also, remember, when you are creating a shared library, you should compile the source files with the -fPIC flag.

    (And, seems you are calling ld directly to produce the client.so library, you really should use gcc to do the linking.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm facing a problem while unit testing my forms. The problem is that data
That was helpful kgiannakakis. I'm facing a problem as below: a = ['zbc','2.3'] for
I am facing a problem. I would like to localize my action names in
I'm facing a problem which is probably extremely common in game-design. Let's assume that
I'm facing a problem that Google couldn't solve yet! I'm trying to store URLs
I am facing a very peculiar problem that even when I delete some rows,
I am facing a conceptual problem that I am having a hard time overcoming.
I facing this problem in may Rails 3.0.3 App, I think this is a
I am facing a problem that I cannot see how it is solvable without
I am facing the problem that I need to serialize a RawQuerySet. It doesn't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.