I just bought a m2 MacBook Pro running latest Xcode / Sonoma from apple refurbed. I am porting from an older macbook pro/intel chip a project that uses pthread. as this is my first week using the laptop, I recompiled the project but the apple linker does not find the libpthread library. I see it is not included in the installed Xcode. how do I get this library from Apple? regards Dave
Replies
This library is included. Maybe there is some incorrect path setting for it in your old project? Can you link a fresh test app using pthreads successfully?
Thank you for the reply. I verified that the pthread library in not on my computer by:
- Apple linker ld uses the -L/usr/lib directory that issues the pthread not found error message.
- "ls /usr/lib" command does not show it.
- Using find across the complete disk did not find it. "find / | grep libpthread".
I attached file yyy.txt giving various outs proving this. The find wild search output across the complete disk is not included due to its size.
Dave
See this thread for details on why /usr/lib
looks a little thin these days.
On my machine with Xcode 15.3 installed, the library is found here:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libpthread.tbd
And with Command Line Tools installed, also found here:
/Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/lib/libpthread.tbd
Note those are .tbd
files, not .dylib
any more.
Thank you for reply. I do have your pthread link on my new machine. I will try working with this newer approach to ld and its libraries. I definitely will study "this thread" link to bring me up-to-date. Appreciate your help. Dave