I don’t have a system with Fedora 10 installed nor am I able to reproduce this error on any other system (the source compiles fine for me). So unfortunately, I don’t know why you are seeing this error.
Can you please compile this file with “-P” and then look at the resulting “cio.i” file to determine which file is including “bits/byteswap.h”?
I’ll try and get our IT department to install Fedora 10 on a system, but it most likely wont be until after the holidays. Note that since Fedora 10 was released after our 8.0 release, it is not a currently supported OS.
Using -P stripped out a little too much to easily tell what was coming from where, but I liked the idea, and noticed the -dI option. Here’s some abridged output using “pgcc -dI test.c”:
// test.c:1 include /opt/pgi/linux86/8.0-1/include/stdlib.h
// /usr/include/stdlib.h:320 include /opt/pgi/linux86/8.0-1/include/sys/types.h
// /opt/pgi/linux86/8.0-1/include/sys/types.h:215 include /usr/include/endian.h
// /usr/include/endian.h:61 include /opt/pgi/linux86/8.0-1/include/bits/byteswap.h
PGC-F-0249-#error – “Never use <bits/byteswap.h> directly; include <byteswap.h> instead.” (/opt/pgi/linux86/8.0-1/include/bits/byteswap.h: 21)
PGC/x86 Linux 8.0-1: compilation aborted
I also noticed a
#ifdef __USE_BSD
line before a couple of blocks in that include chain.
I also got similar errors when recompiling NetCDF 4 using the instructions for an older version of the compiler (and an older version of NetCDF). Mind you, I encountered a few other errors first. On the first go, the configure script failed with:
checking size of short… 0
checking size of int… 0
checking size of long… 0
checking size of float… 0
checking size of double… 0
checking size of off_t… configure: error: cannot compute sizeof (off_t)
See `config.log’ for more details.
Removing the CC environment variable (and removing or adjusting CFLAGS too), and the configure script then runs fine, but then when I run make I get the same error above about byteswap.h from pgCC.
without any environment variables set, it builds fine, but it seemed to be using the system cc compiler, and pgf95.
We got Fedora 10 installed here and it appears they have changed a few header files which will require us to change our “bits/byteswap.h” file.
In particular, they have updated the system “endian.h” file to directly include “bits/byteswap.h”. This means in our version of "bits/byteswap.h, “endian.h” needs to be added to the list of header files that are allowed to call it directly. So by changing line 20 of “/opt/pgi/linux86/8.0-1/include/bits/byteswap.h” from:
#if !defined _BYTESWAP_H && !defined _NETINET_IN_H
# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
#endif
to
#if !defined _BYTESWAP_H && !defined _NETINET_IN_H && !defined _ENDIAN_H
# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
#endif
you can work around the problem.
I’ve added a technical problem report (TPR#15472) and send it on to engineering to have the problem corrected in a future release.