GCC:- unable to find libpthread_nonshared.a file while linking libraries to create a so file on Linux
06:51 15 May 2022

Hi I'm trying to compile a c project with gcc 10.2 in Ubuntu 20.04. But at the end it gives me error as below

/usr/bin/ld: cannot find /usr/lib/x86_64-linux-gnu/libpthread_nonshared.a
collect2: error: ld returned 1 exit status

Below are the libraries I'm trying to link while creating a so file -lpthread -ldl -lm -lstdc++ -lrt

When i looked into /usr/lib64 i could see only *.so files but no *.a files.

Do we need to install them separately?

Could someone help with this.

c linux gcc pthreads ld