NAMD Build Problems

Hi,

I’m trying to build NAMD (latest CVS version) using pgCC/pgcc on CentOS 5.2. The first part of the build process involves building Charm which I’ve been able to do. However, I’m having problems with building NAMD.

I’m using the following .arch file (which contains the processor options):


1 # pgcc build copied from g++ build arch file.
2
3 NAMD_ARCH = Linux-amd64
4 CHARM_ARCH = net-linux-x86_64-smp-pgcc
5
6 CXX = pgCC
7 CXXOPTS = -O2 --no_exceptions -tp x64
8 CC = pgcc
9 COPTS = -fast -Mvect=assoc,prefetch -tp x64


Here’s the error that I’m getting:


pgCC -I.rootdir/charm-6.0//include -DCMK_OPTIMIZE=1 -Isrc -Iinc -Iplugins/include -I/home/christopher/NAMD_PGI/namd2/tcl/linux/include -DNAMD_TCL -I/home/christopher/NAMD_PGI/namd2/fftw/linux/include -DNAMD_FFTW -DNAMD_VERSION=“2.6” -DNAMD_PLATFORM=“Linux-amd64” -DREMOVE_PROXYRESULTMSG_EXTRACOPY -O2 --no_exceptions -tp x64 -o obj/colvarbias.o -c src/colvarbias.C
pgCC -I.rootdir/charm-6.0//include -DCMK_OPTIMIZE=1 -Isrc -Iinc -Iplugins/include -I/home/christopher/NAMD_PGI/namd2/tcl/linux/include -DNAMD_TCL -I/home/christopher/NAMD_PGI/namd2/fftw/linux/include -DNAMD_FFTW -DNAMD_VERSION=“2.6” -DNAMD_PLATFORM=“Linux-amd64” -DREMOVE_PROXYRESULTMSG_EXTRACOPY -O2 --no_exceptions -tp x64 -o obj/colvarbias_abf.o -c src/colvarbias_abf.C
“/usr/include/glob.h”, line 92: error: this declaration has no storage class
or type specifier
__size_t gl_pathc; /* Count of paths matched by the pattern. */
^

“/usr/include/glob.h”, line 94: error: this declaration has no storage class
or type specifier
__size_t gl_offs; /* Slots to reserve in `gl_pathv’. */
^

2 errors detected in the compilation of “src/colvarbias_abf.C”.
make: *** [obj/colvarbias_abf.o] Error 2


I’m not sure what’s going on here. Any help would be appreciated.

Cheers,

Chris

Hi Christopher,

While I don’t have access to NAMD’s CVS repository (I’ll put in a request though), I can recreate the error with this small test case:

% cat test.C
#include <glob.h>
#include <iostream>

int main () {
        cout << "Hello\n";
        return 0;
}

% pgCC -c test.C
"/usr/include/glob.h", line 92: error: this declaration has no storage class
          or type specifier
      __size_t gl_pathc;                /* Count of paths matched by the pattern.  */
               ^

"/usr/include/glob.h", line 94: error: this declaration has no storage class
          or type specifier
      __size_t gl_offs;         /* Slots to reserve in `gl_pathv'.  */
               ^

2 errors detected in the compilation of "test.C".

What’s happening is that the “glob_t” struct uses the typedef “__size_t”. Unfortunately, “__size_t” is being preprocessed to “size_t” which in turn is preprocessed to “”. So the variable “gl_pathc” doesn’t have a type and the compiler errors.

The include file “stddef.h” contains the definition of “size_t”. While the “glob.h” file does include “stddef.h”, it does so only if “GNUC” is defined (i.e. if a gnu compiler, or one pretending to be gnu, is being used). To fix, we need to add “#include <stddef.h>” to our code.

% cat test.C
#include <stddef.h>
#include <glob.h>
#include <iostream>

int main () {
        cout << "Hello\n";
        return 0;
}

% pgCC test.C
%

While I have not tested this with NAMD, I think it should work for you as well. The second option is to add the flag “-D__GNUC__=2” to your compilation but this may cause other issues.

Hope this helps,
Mat

Thanks!

I included <stddef.h> in the source file (before the glob.h include) and it fixed the problem. The program builds successfully now.

Cheers,

Chris