hidden symbol `stat' in /usr/lib/libc_nonshared.a(stat.oS)

I am getting the following error on trying to link in a mixed fortran/C code. This code builds with 5.0 but gives this hidden symbol ‘stat’ message with 6.0.

The link line as displayed by pgf90 -v shows the following error

/usr/bin/ld /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/gcc/x86_64-redhat-linux/3.4.5/32/crtbegin.o /usr/pgi61/linux86/6. 1/lib/f90main.o -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/pgi61/linux86/6.1/lib/pgi.ld sub1.o -o utility.x -L/usr/pgi61/linux86/6.1/lib -L/usr/lib -L/usr/lib/gcc/x86_64-redhat-linux/3.4.5/32 -rpath /usr/pgi61/linux86/6.1/lib -lpgmm1 -lpgmm2 -lpgf90 -lpgf90_rpm1 -lp gf902 -lpgf90rtl -lpgftnrtl -lpgsse1 -lpgsse2 -lc -lnspgc -lpgc -lm -lgcc -lc -lgcc /usr/lib/gcc/x86_64-redhat-linux/3.4.5/32/crtend.o /usr/lib/crtn.o

/usr/bin/ld: utility.x: hidden symbol `stat’ in /usr/lib/libc_nonshared.a(stat.oS) is referenced by DSO
/usr/bin/ld: final link failed: Nonrepresentable section on output
pgf90-Fatal-linker completed with exit code 1

I am using

pgf90 6.1-4 32-bit target on x86-64 Linux

and have the following gcc packages installed


Any help would be greatly appreciated.


Hi Waris,

I’m actually not sure what the problem is here. I’m guessing it has to do with how your system is configured but I’m not sure. Could you send a copy of your code to trs@pgroup.com that we could test here? Also, what OS are you using and what is the output of “/lib/libc.so.6”. Did you install GCC 3.4.5 yourself, or did it come as part of your OS?


I had that problem yesterday! I was doing so many things, I hope I can recall the solution properly. I believe that you have to specify


in the ld command to pick up the proper C library. The default library you’re picking up isn’t correct. There is some stuff about this on the RedHat forums.

Can you post a link to this fix? “-lc” is on the link line and I’ve only seen this error when ‘ld’ is used directly to link a shared object, which doesn’t appear to be the case for the original poster.