Yeah, I think Howard's commit isn't correct. We shouldn't have to put 
opal_config.h after the system includes. I think the real problem is that you 
aren't supposed to directly include the system malloc.h as that hoses the 
entire memory interceptor stuff.

Howard: can you try reverting your commit and just removing the system malloc.h 
as per Adrian's patch? I think that will correctly solve the problem.


On Aug 4, 2014, at 9:55 AM, Adrian Reber <adr...@lisas.de> wrote:

> And with following change I can get it to compile again:
> 
> diff --git a/opal/mca/mpool/base/mpool_base_frame.c 
> b/opal/mca/mpool/base/mpool_base_frame.c
> index c1b044b..f94b8a5 100644
> --- a/opal/mca/mpool/base/mpool_base_frame.c
> +++ b/opal/mca/mpool/base/mpool_base_frame.c
> @@ -21,12 +21,10 @@
> #include "opal_config.h"
> 
> #include <stdio.h>
> +#include <stdlib.h>
> #ifdef HAVE_UNISTD_H
> #include <unistd.h> 
> #endif  /* HAVE_UNISTD_H */
> -#ifdef HAVE_MALLOC_H
> -#include <malloc.h>
> -#endif
> 
> #include "opal/mca/mca.h"
> #include "opal/mca/base/base.h"
> diff --git a/opal/util/malloc.h b/opal/util/malloc.h
> index db5a4d0..efeaf98 100644
> --- a/opal/util/malloc.h
> +++ b/opal/util/malloc.h
> @@ -21,7 +21,7 @@
> #ifndef OPAL_MALLOC_H
> #define OPAL_MALLOC_H
> 
> -#include "opal_config.h"
> +#include <stdio.h>
> #include <stdlib.h>
> 
> /*
> 
> 
> On Mon, Aug 04, 2014 at 06:39:13PM +0200, Adrian Reber wrote:
>> I can confirm this on Fedora 20 with gcc 4.8.3.
>> 
>> Running ./configure without any options gives me the same error.
>> 
>> On Mon, Aug 04, 2014 at 04:24:29PM +0000, Pritchard Jr., Howard wrote:
>>> Hi Ralph,
>>> 
>>> Nope that doesn't fix the problem I'm hitting.   I tried to build the opmi 
>>> trunk
>>> on a system with a much older gcc compiler (4.4.7) and it compiled :)!  But
>>> I'd like to be able to compile opmi with a newer gcc like the one on my 
>>> opensuse
>>> 13.1 box.
>>> 
>>> The preprocessor is pulling in the system malloc.h and that's where things 
>>> blow up:
>>> 
>>>  CC       base/mpool_base_frame.lo
>>> In file included from ../../../opal/include/opal_config.h:2750:0,
>>>                 from base/mpool_base_frame.c:21:
>>> ../../../opal/include/opal_config_bottom.h:381:38: error: expected 
>>> declaration specifiers or '...' before '(' token
>>> #    define malloc(size) opal_malloc((size), __FILE__, __LINE__)
>>>                                      ^
>>> In file included from base/mpool_base_frame.c:28:0:
>>> /usr/include/malloc.h:38:1: error: expected declaration specifiers or '...' 
>>> before string constant
>>> extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
>>> ^
>>> /usr/include/malloc.h:38:1: error: expected declaration specifiers or '...' 
>>> before numeric constant
>>> In file included from ../../../opal/include/opal_config.h:2750:0,
>>>                 from base/mpool_base_frame.c:21:
>>> ../../../opal/include/opal_config_bottom.h:385:48: error: expected 
>>> declaration specifiers or '...' before '(' token
>>> #    define calloc(nmembers, size) opal_calloc((nmembers), (size), 
>>> __FILE__, __LINE__)
>>>                                                ^
>>> ../../../opal/include/opal_config_bottom.h:385:60: error: expected 
>>> declaration specifiers or '...' before '(' token
>>> #    define calloc(nmembers, size) opal_calloc((nmembers), (size), 
>>> __FILE__, __LINE__)
>>>                                                            ^
>>> In file included from base/mpool_base_frame.c:28:0:
>>> /usr/include/malloc.h:41:1: error: expected declaration specifiers or '...' 
>>> before string constant
>>> extern void *calloc (size_t __nmemb, size_t __size)
>>> ^
>>> /usr/include/malloc.h:41:1: error: expected declaration specifiers or '...' 
>>> before numeric constant
>>> In file included from ../../../opal/include/opal_config.h:2750:0,
>>>                 from base/mpool_base_frame.c:21:
>>> ../../../opal/include/opal_config_bottom.h:389:45: error: expected 
>>> declaration specifiers or '...' before '(' token
>>> #    define realloc(ptr, size) opal_realloc((ptr), (size), __FILE__, 
>>> __LINE__)
>>>                                             ^
>>> ../../../opal/include/opal_config_bottom.h:389:52: error: expected 
>>> declaration specifiers or '...' before '(' token
>>> #    define realloc(ptr, size) opal_realloc((ptr), (size), __FILE__, 
>>> __LINE__)
>>>                                                    ^
>>> In file included from base/mpool_base_frame.c:28:0:
>>> /usr/include/malloc.h:49:1: error: expected declaration specifiers or '...' 
>>> before string constant
>>> extern void *realloc (void *__ptr, size_t __size)
>>> ^
>>> /usr/include/malloc.h:49:1: error: expected declaration specifiers or '...' 
>>> before numeric constant
>>> In file included from ../../../opal/include/opal_config.h:2750:0,
>>>                 from base/mpool_base_frame.c:21:
>>> ../../../opal/include/opal_config_bottom.h:393:33: error: expected 
>>> declaration specifiers or '...' before '(' token
>>> #    define free(ptr) opal_free((ptr), __FILE__, __LINE__)
>>>                                 ^
>>> In file included from base/mpool_base_frame.c:28:0:
>>> /usr/include/malloc.h:53:1: error: expected declaration specifiers or '...' 
>>> before string constant
>>> extern void free (void *__ptr) __THROW;
>>> ^
>>> /usr/include/malloc.h:53:1: error: expected declaration specifiers or '...' 
>>> before numeric constant
>>> 
>>> 
>>> 
>>> From: devel [mailto:devel-boun...@open-mpi.org] On Behalf Of Ralph Castain
>>> Sent: Monday, August 04, 2014 10:09 AM
>>> To: Open MPI Developers
>>> Subject: Re: [OMPI devel] opal_config_bottom.h question again
>>> 
>>> I believe the issue is actually in opal/util/malloc.h, Howard. I noticed 
>>> this while looking around this weekend - someone included opal_config.h in 
>>> the malloc.h file even though it explicitly says "DON'T DO THIS"  in that 
>>> header file.
>>> 
>>> #ifndef OPAL_MALLOC_H
>>> #define OPAL_MALLOC_H
>>> 
>>> #include "opal_config.h"
>>> #include <stdlib.h>
>>> 
>>> /*
>>> * THIS FILE CANNOT INCLUDE ANY OTHER OPAL HEADER FILES!!!
>>> *
>>> * It is included via <opal_config_bottom.h>.  Hence, it should not
>>> * include ANY other files, nor should it include "opal_config.h".
>>> *
>>> */
>>> 
>>> Don't know why someone did that, but you might see if it fixes your problem
>>> 
>>> 
>>> On Aug 4, 2014, at 9:00 AM, Pritchard Jr., Howard 
>>> <howa...@lanl.gov<mailto:howa...@lanl.gov>> wrote:
>>> 
>>> 
>>> Hi Folks,
>>> 
>>> As I said last week, I'm noticing now that on my opensuse 13.1 system and 
>>> gcc 4.8.1, when I do a fresh
>>> checkout of trunk ompi and try to build, without any configure options,
>>> 
>>> mca_base_mpool_frame.c
>>> 
>>> does not compile.
>>> 
>>> The reason is there is a conflict in opal_config_bottom.h and the contents 
>>> of malloc.h,
>>> which for my system is pulled in by the preprocessor.
>>> 
>>> If I undefine HAVE_MALLOC_H in this file, the code compiles fine.  
>>> Alternatively,
>>> one can also move the malloc.h include prior to the opal_config.h include 
>>> and things
>>> work.  Alternatively, one can add the OPAL_DISABLE_ENABLE_MEM_DEBUG define
>>> as in mpool_base_lookup.c , and the compile problem similarly goes away.
>>> 
>>> I'd like to check in a fix for this.  I'd prefer to just move the std 
>>> include files ahead
>>> of the opal_config.h include.  I'd like to do this today unless someone 
>>> objects.
>>> 
>>> I'm somewhat surprised I'm the only one seeing this though.
>>> 
>>> Howard
>>> 
>>> 
>>> -------------------------------------------------
>>> Howard Pritchard
>>> HPC-5
>>> Los Alamos National Laboratory
>>> 
>>> 
>>> _______________________________________________
>>> devel mailing list
>>> de...@open-mpi.org<mailto:de...@open-mpi.org>
>>> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel
>>> Link to this post: 
>>> http://www.open-mpi.org/community/lists/devel/2014/08/15495.php
>>> 
>> 
>>> _______________________________________________
>>> devel mailing list
>>> de...@open-mpi.org
>>> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel
>>> Link to this post: 
>>> http://www.open-mpi.org/community/lists/devel/2014/08/15497.php
>> _______________________________________________
>> devel mailing list
>> de...@open-mpi.org
>> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel
>> Link to this post: 
>> http://www.open-mpi.org/community/lists/devel/2014/08/15498.php
> 
>               Adrian
> 
> -- 
> Adrian Reber <adr...@lisas.de>            http://lisas.de/~adrian/
> Hippogriff, n.:
>       An animal (now extinct) which was half horse and half griffin.
>       The griffin was itself a compound creature, half lion and half eagle.
>       The hippogriff was actually, therefore, only one quarter eagle, which
>       is two dollars and fifty cents in gold.  The study of zoology is full
>       of surprises.
>               -- Ambrose Bierce, "The Devil's Dictionary"
> _______________________________________________
> devel mailing list
> de...@open-mpi.org
> Subscription: http://www.open-mpi.org/mailman/listinfo.cgi/devel
> Link to this post: 
> http://www.open-mpi.org/community/lists/devel/2014/08/15499.php

Reply via email to