pgcc compiling : cannot find -lpthread

Hi~

I try to compile my previous code by PGCC to see some performance gain.
Originally, this code was compiled well by gcc
gcc version is 4.4.7

But, in step of compiling by PGCC, some error is shown.
/usr/bin/ld: cannot find -lpthread

In my system, libpthread.so.0 is placed in /lib, so I was using option -L/lib/ and try again, but the result is same.

What should I do?
I also check that gblic-devel was installed…

Hi 970980hs,

The linker will look for a file with a “.a” or “.so” suffix, hence a “.so.0” file wont be used.

Typically the pthread library would be found in the “/usr/lib” and/or “/usr/lib64” directories. The linker normally adds these directories to the default link path, indicating the libpthread isn’t there. Though, another possibility is that trying to statically link but libpthread doesn’t support static linking.

Does “/usr/lib[64]/libpthread.so” exist and what flags are you using to link?

  • Mat

Hi.

I double check whether libpthread.so is installed properly and it is installed in /usr/lib and /usr/lib64.

For same program, compiling using GCC is easily passed but there are error in case of using PGCC. The error message is about -lpthread option.

So I wonder if there are another named option in PGCC compiler instead of -lpthread in GCC ?

My best guess then is that you’re trying to link statically. What flags are you using to link? -Bstatic?

I didn’t use -Bstatic or -static for linking.
And also as I mentioned, gcc compiling is working well.
Also pthread library is installed proper location.
I think it just happen because there are no -lpthread option
in pgcc case… how do i solve this?

Can you please post the verbose output from the link? (i.e. add the “-v” flag to you link and post the full output).

Thanks,
Mat