Problem with Includes on "standard" SLES 9

Just installed 5.2-2 on our benchmark quad Opteron running SLES 9. When trying to compile a customer benchmark we get the following error:

/usr/local/encap/pgi/linux86-64/5.2/bin/pgcc -fastsse -Mipa=fast,inline -c cputim.c
PGC-F-0206-Can’t find include file stddef.h (/usr//include/bits/types.h: 31)
PGC/x86-64 Linux/x86-64 5.2-2: compilation aborted

which is weird, because given pgccs STDINC (pgcc -show | grep STDINC):
STDINC =/usr/local/encap/pgi/linux86-64/5.2/include /usr/local/include /usr//include /include /usr/include

and this source code:

cputim.c

#include <sys/types.h>
#include <sys/times.h>
#include <sys/time.h>
#include <stdio.h> 
#include <unistd.h>

void cputim_(dsec)
double *dsec;
{
      struct tms buffer;

      times(&buffer);
      *dsec = (double)buffer.tms_utime/100.0;
/*      fprintf(stderr,"inside cputim: %lf\n",dsec);*/
}


void walltim_(dsec)
double * dsec;
{       struct timeval tv; 
        struct timezone tz;
        gettimeofday(&tv, &tz);
        *dsec = (double) tv.tv_sec + tv.tv_usec/1000000.0;
}

void cputim(dsec)
double *dsec;   
{ cputim_(dsec);
}

void walltim(dsec)
double * dsec;   
{ walltim_(dsec);
}

The compiler should use the sys/types.h provided in /usr/local/encap/pgi/linux86-64/5.2/include correct ?

Tried it with -Mnostdinc and manual -I the directories, the moment
I include a “system directory” like /usr/include it is automatically
searched first.

Any suggestions ?
Thx
Max

Looking through the 5.2 releasenotes, I found the “types.h” check paragraph. Since there is no bits/types.h build by the installer,here is the sys/types.h diff:

diff ./sys/types.h /usr/include/sys/types.h
c1,2
< /* Copyright (C) 1991,92,94,95,96,97,98,99,2000 Free Software Foundation, Inc.
---
> /* Copyright (C) 1991,1992,1994,1995,1996,1997,1998,1999,2000,2001,2002
>       Free Software Foundation, Inc.
157,171c158
< #if defined(__PGI)
< # ifndef __int8_t_defined
< #  define __int8_t_defined
< typedef       char int8_t;
< typedef       short int int16_t;
< typedef       int int32_t;
< typedef long int64_t;
< #endif
< /* not protected by __int8_t_defined */
< 
< typedef       unsigned char u_int8_t;
< typedef       unsigned short int u_int16_t;
< typedef       unsigned int u_int32_t;
< typedef int register_t;
< #elif !__GNUC_PREREQ (2, 7)
---
> #if !__GNUC_PREREQ (2, 7)
179c166
< #  ifdef __GNUC__
---
> #  if __GLIBC_HAVE_LONG_LONG
188c175
< # ifdef __GNUC__
---
> # if __GLIBC_HAVE_LONG_LONG
275a263,268
> 
> /* Now add the thread types.  */
> #if defined __USE_POSIX199506 || defined __USE_UNIX98
> # include <bits/pthreadtypes.h>
> #endif
>

Hello Max,

Typically this error occurs when someone copies the PGI directory instead of using the standard installation or if they’ve upgraded the OS but did not reinstall the compilers. Configuration of the compilers (such as the type.h file) is system dependent. We were able to compile your code here on a similar system.

The easiest thing to do is re-install the compilers using the provided installation script. If this doesn’t work, then something is preventing proper installation.

  • Mat