PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

NAMD Build Problems

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
ChristopherShare



Joined: 14 Jan 2009
Posts: 5

PostPosted: Wed Jan 14, 2009 6:10 pm    Post subject: NAMD Build Problems Reply with quote

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
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6134
Location: The Portland Group Inc.

PostPosted: Thu Jan 15, 2009 10:22 am    Post subject: Reply with quote

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:
Code:
% 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 "<blank>". 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.
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
Back to top
View user's profile
ChristopherShare



Joined: 14 Jan 2009
Posts: 5

PostPosted: Thu Jan 15, 2009 8:14 pm    Post subject: Reply with quote

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
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group