PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Problems compiling HDF5 with 6.1

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



Joined: 09 Aug 2004
Posts: 3

PostPosted: Tue Jun 27, 2006 7:08 am    Post subject: Problems compiling HDF5 with 6.1 Reply with quote

I installed PGI 6.1 on a machine running Centos 4.3. Centos is derived from Red Hat Enterprise Linux and is the basis for the ROCKS cluster distribution, which we run on our clusters. I am trying to compile one of the libraries we provide for users, HDF5 1.6.5 (this is the latest stable version). The configure line is

./configure --prefix=/opt/hdf5/pgi --enable-fortran --enable-cxx --disable-shared --enable-static

The result is
pgCC -I. -I../src -I./../src -I../../test -I../../src -I../../src -D_BSD_SOURCE -D_POSIX_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -c tfile.cpp -o tfile.o
"tfile.cpp", line 484: error: identifier "__offsetof__" is undefined
comp_type.insertMember("a", HOFFSET(s1_t, a), PredType::NATIVE_INT);
^

1 error detected in the compilation of "tfile.cpp".

---

HDF5 compiles without problems with Intel 9.1.

I've tried fiddling with copying stddef.h into PGI's include directory but that hasn't helped.
Back to top
View user's profile
mkcolg



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

PostPosted: Tue Jun 27, 2006 8:32 am    Post subject: Reply with quote

Hi kholcomb,

Another user had the same issue (See Here) and was able to work around it by adding the following to "tfile.cpp".
Code:
#ifndef __offsetof__
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif

The issue is that "__offsetof__" is a non-standard feature which pgCC does not yet support. The above definition is how offsetof was defined before it was internalized by GNUC. Note that if you get a redefinition warning, it can be safely ignored.

- Mat
Back to top
View user's profile
kholcomb



Joined: 09 Aug 2004
Posts: 3

PostPosted: Wed Jun 28, 2006 9:09 am    Post subject: The result Reply with quote

I tried adding those lines and I got:

pgCC -I. -I../src -I./../src -I../../test -I../../src -I../../src -D_BSD_SOURCE -D_POSIX_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -c tfile.cpp -o tfile.o
"/usr/pgi/linux86/6.1/include/stddef.h", line 418: warning: incompatible
redefinition of macro "offsetof" (declared at line 26 of "tfile.cpp")
#define offsetof(TYPE, MEMBER) \
^

"tfile.cpp", line 488: error: identifier "__offsetof__" is undefined
comp_type.insertMember("a", HOFFSET(s1_t, a), PredType::NATIVE_INT);
^

1 error detected in the compilation of "tfile.cpp".

So I got a redefinition warning, as expected, *and* a fatal error.

I'm running kernel 2.6.9-34.107.plus.c4, glibc 2.3.4, and gcc 3.4.5 if that's any help.
Back to top
View user's profile
mkcolg



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

PostPosted: Wed Jun 28, 2006 12:08 pm    Post subject: Reply with quote

Hi kholcomb,

I was able to recreate the error on a RHEL 4.0 system and found when I added the offsetof definition to "src/H5Tpublic.h", "tfile.cpp" compiled successfully. Add it to line 24 just before the line which defines HOFFSET.

From hdf5-1.6.5/src/H5Tpublic.h
Code:
/* Public headers needed by this file */
#include "H5public.h"
#include "H5Ipublic.h"

#if __PGI
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif

#define HOFFSET(S,M)    (offsetof(S,M))



- Mat
Back to top
View user's profile
kholcomb



Joined: 09 Aug 2004
Posts: 3

PostPosted: Thu Jun 29, 2006 6:25 am    Post subject: Reply with quote

Thanks, that fixed it.
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