I have done fresh installs (without error) of PGI 10.9, 11.10 and 12.2 on a RHEL 6.1 system. None of them are able to compile a simple hello world app if -Bstatic is used.
Here’s the code:
And here’s what happens when I go to compile:
pgcc -Bstatic -o hello.c.static hello.c
/usr/bin/ld: cannot find -lpthread
The code will compile normally if I remove the -Bstatic flag, though I end up with the expected dynamic executable instead of the desired static one.
My /usr/bin/ld version is
GNU ld version 184.108.40.206.2-5.20.el6_1.1 20091009
Copyright 2009 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.
It appears that our sysadmins have left out the glibc-static rpms needed for building static libs on RHEL6.1. I believe this to be the cause. I installed PGI 12.2 on another RHEL6.1 system that did have glibc-static installed and it works as expected.
Thanks for the question. libpthreads is a system library, and Linux releases want you
to use the libpthreads installed on the system, and not one statically linked on another.
Either compile and/or link with
to only statically link the PGI libs - then the executable will dynamically link
with the systems versions of libc and libpthreads, and incompatibliites can be
prevented. You still have no need to install PGI libs on the target systems.
We decided with 11.* releases to link every executable as if -mp were set.
This exposed a number of problems we fixed, but there are some cases, like this,
that do not match users’ expectations.