pgcc fails on ubuntu 12.04 for glob.h

Hi,

When I try to compile (with pgcc main.c):

#define _FILE_OFFSET_BITS 64
#include <glob.h>
#include <stdio.h>

int
main(int argc, char **argv) {
	printf("_FILE_OFFSET_BITS (%d)\n", _FILE_OFFSET_BITS);
}

I get:

PGC-S-0035-Syntax error: Recovery attempted by replacing ‘,’ by ‘)’ (/usr/include/glob.h: 155)
PGC-S-0037-Syntax error: Recovery attempted by deleting ‘)’ (/usr/include/glob.h: 158)
PGC-S-0082-Function returning array not allowed (/usr/include/glob.h: 158)
PGC-S-0069-Dummy parameter specification not allowed here (/usr/include/glob.h: 158)
PGC-S-0035-Syntax error: Recovery attempted by replacing ‘,’ by ‘)’ (/usr/include/glob.h: 160)
PGC-S-0037-Syntax error: Recovery attempted by deleting ‘)’ (/usr/include/glob.h: 160)
PGC-S-0082-Function returning array not allowed (/usr/include/glob.h: 160)
PGC-S-0069-Dummy parameter specification not allowed here (/usr/include/glob.h: 160)
PGC-S-0043-Redefinition of symbol, __REDIRECT_NTH (/usr/include/glob.h: 160)
PGC-S-0043-Redefinition of symbol, glob64 (/usr/include/glob.h: 166)
PGC-S-0043-Redefinition of symbol, globfree64 (/usr/include/glob.h: 168)
PGC/x86-64 Linux 13.1-1: compilation completed with severe errors

I do not have similar problems with gcc (e.g., v 4.6.3).

Note:

    • the program compiles with pgcc under ubuntu 10.04, however, the glob.h files of 10.04 and 12.04 are different.
  • if the #define is moved after the #include of glob.h, pgcc does not complain. I don’t see how this should be necessary, though.

Hi EC-HPCS,

The problem is the “__REDIRECT_NTH” macro only gets defined (in src/cdefs.h) if GNUC version > 2. Since we don’t define GNUC, the macro isn’t defined and the compiler intrupts it as a function prototype.

It “worked” before because “glob.h” had a guard to only use “__REDIRECT_NTH” is GNUC > 2. Looks like this guard was removed.

The work around is for you to add “-D__GNUC__=3” to you build. It may cause other errors in your larger code, but does work for this small example.

I’ll put in a request to add a definition for “__REDIRECT_NTH” in the cdefs.h file we ship.

  • Mat

We are still having this problem with the latest release (v13.8) and do not see any fix/change in it. Can I get an update on this issue and a timeframe for a fix?

In the meantime, is there a workaround that I can use for something more than trivial programs?

Hi EC-HPCS,

While I haven’t verified it myself, TPR#19413 is fixed in 13.9 which happens to have been released today. Mind trying the new version and see it works for your full production code?

Thanks,
Mat

Hi,

I’ve gotten around to trying out 13.9 and see that the sample code still does not work. What are the prospects of getting it fixed. I’d be surprised if I am the only one.

Thanks,
John

Hi Rob,

I show the header files as being fixed and your example working on my SuSE 12.2 system which also uses GNU 4.7. Though, I’m wondering if the installer didn’t get the right header files copied over.

Can you try manually copying the header files over? In the installation package, look for the “linux86-64/13.9/include-gcc47” directory and copy these header files to your installed “$PGI/linux86-64/13.9/include” directory. (Change 13.9 to 13.10 if you are using the latest release).

If that works, I’ll have our manufacturing folks investigate why the correct header files aren’t getting copied over on Ubuntu 12.04.

  • Mat

It required a number of header file adjustments.

We really fixed our headers to work with glob.h in 14.1.

thanks,
dave