[petsc-dev] [petsc-maint #71297] Problem installing PETSc

Barry Smith bsmith at mcs.anl.gov
Sat Apr 23 22:28:42 CDT 2011


On Apr 23, 2011, at 9:28 PM, Jed Brown wrote:

> On Sun, Apr 24, 2011 at 03:46, Barry Smith <bsmith at mcs.anl.gov> wrote:
> 
>> Looks like we need a patch to deal with the "illegal" placement of
>> XOPEN_SOURCE and BSD_SOURCE in the source code so this issue doesn't keep
>> coming up.
> 
> 
> What exactly is the error?

In file included from /usr/include/stdio.h:22,
                 from /home/rgill/PETSc/petsc-3.1-p8/include/petscsys.h:147,
                 from options.c:14:
/usr/include/sys/feature_tests.h:336:2: error: #error "Compiler or options invalid; UNIX 03 and POSIX.1-2001 applications 	require the use of c99"


> Note that we already changed _XOPEN_SOURCE to
> _POSIX_C_SOURCE (in dev) because Open Solaris did not like the former.

   It could be that this fix just needs to be backported to petsc 3.1


   Barry

> One
> possible fix could be the ugly
> 
> #ifndef _BSD_SOURCE
> #  define _BSD_SOURCE
> #endif
> 
> 
> I really do not want to put feature test macros in public headers (our usual
> model with finding which header declares certain functions) because they
> change which symbols are available in headers and introduce order
> dependence. That is, a user writing
> 
> #include <stdlib.h>
> #include <petsc.h>
> 
> would not bring in atoll(), but including petsc.h first would have it (and
> lots of other symbols). I don't think a library should ever change the
> language "dialect" that a user writes their code in.
> 
> 
> I don't really understand why Solaris is having a problem with our defining
> feature test macros. As far as I know, we are using them as recommended.
> Searching for solaris feature test macros brings up results like the
> following man page that explains how to set them.
> 
> http://www.cims.nyu.edu/cgi-systems/man.cgi?section=5&topic=standards
> 
> On Sun, Apr 24, 2011 at 03:46, Barry Smith <bsmith at mcs.anl.gov> wrote:
> Looks like we need a patch to deal with the "illegal" placement of XOPEN_SOURCE and BSD_SOURCE in the source code so this issue doesn't keep coming up.
> 
> What exactly is the error? Note that we already changed _XOPEN_SOURCE to _POSIX_C_SOURCE (in dev) because Open Solaris did not like the former. One possible fix could be the ugly
> 
> #ifndef _BSD_SOURCE
> #  define _BSD_SOURCE
> #endif
> 
> 
> I really do not want to put feature test macros in public headers (our usual model with finding which header declares certain functions) because they change which symbols are available in headers and introduce order dependence. That is, a user writing
> 
> #include <stdlib.h>
> #include <petsc.h>
> 
> would not bring in atoll(), but including petsc.h first would have it (and lots of other symbols). I don't think a library should ever change the language "dialect" that a user writes their code in.
> 
> 
> I don't really understand why Solaris is having a problem with our defining feature test macros. As far as I know, we are using them as recommended. Searching for solaris feature test macros brings up results like the following man page that explains how to set them.
> 
> http://www.cims.nyu.edu/cgi-systems/man.cgi?section=5&topic=standards




More information about the petsc-dev mailing list