Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] trunk - build failure on OpenBSD
From: Paul Hargrove (phhargrove_at_[hidden])
Date: 2014-01-10 02:20:06


Based on how MAP_ANONYMOUS vs MAP_ANON is dealt with
in opal/mca/memory/linux/malloc.c, I believe the patch below is an
appropriate solution for this issue. Additionally, it handles the
possibility that MAP_FAILED is not defined (not sure where that comes up,
but opal/mca/memory/linux/malloc.c allows for it).

-Paul

Index: oshmem/mca/memheap/base/memheap_base_alloc.c
===================================================================
--- oshmem/mca/memheap/base/memheap_base_alloc.c (revision 30223)
+++ oshmem/mca/memheap/base/memheap_base_alloc.c (working copy)
@@ -18,6 +18,12 @@
 #ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
 #endif
+#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+# define MAP_ANONYMOUS MAP_ANON
+#endif
+#if !defined(MAP_FAILED)
+# define MAP_FAILED ((char*)-1)
+#endif

 #include <sys/ipc.h>
 #include <sys/shm.h>
@@ -278,10 +284,8 @@
                 size,
                 PROT_READ | PROT_WRITE,
                 MAP_SHARED |
-#if defined (__APPLE__)
-MAP_ANON |
-#elif defined (__GNUC__)
-MAP_ANONYMOUS |
+#ifdef MAP_ANONYMOUS
+ MAP_ANONYMOUS |
 #endif
                 MAP_FIXED,
                 0,

On Thu, Jan 9, 2014 at 8:35 PM, Paul Hargrove <phhargrove_at_[hidden]> wrote:

> Same issue for NetBSD, too.
>
> -Paul
>
>
> On Thu, Jan 9, 2014 at 7:09 PM, Paul Hargrove <phhargrove_at_[hidden]> wrote:
>
>> With the new opal/util/path.c I get farther building the trunk on OpenBSD
>> but hit a new failure:
>>
>> Making all in mca/memheap
>> CC base/memheap_base_frame.lo
>> CC base/memheap_base_select.lo
>> CC base/memheap_base_alloc.lo
>> /home/phargrov/OMPI/openmpi-trunk-openbsd5-i386/openmpi-1.9a1r30215/oshmem/mca/memheap/base/memheap_base_alloc.c:
>> In function '_mmap_attach':
>> /home/phargrov/OMPI/openmpi-trunk-openbsd5-i386/openmpi-1.9a1r30215/oshmem/mca/memheap/base/memheap_base_alloc.c:284:
>> error: 'MAP_ANONYMOUS' undeclared (first use in this function)
>> /home/phargrov/OMPI/openmpi-trunk-openbsd5-i386/openmpi-1.9a1r30215/oshmem/mca/memheap/base/memheap_base_alloc.c:284:
>> error: (Each undeclared identifier is reported only once
>> /home/phargrov/OMPI/openmpi-trunk-openbsd5-i386/openmpi-1.9a1r30215/oshmem/mca/memheap/base/memheap_base_alloc.c:284:
>> error: for each function it appears in.)
>> *** Error 1 in oshmem/mca/memheap (Makefile:1631
>> 'base/memheap_base_alloc.lo': @echo " CC "
>> base/memheap_base_alloc.lo;depbase=`echo b...)
>> *** Error 1 in oshmem (Makefile:1962 'all-recursive')
>> *** Error 1 in /home/phargrov/OMPI/openmpi-trunk-openbsd5-i386/BLD
>> (Makefile:1685 'all-recursive')
>>
>> On OpenBSD one must use MAP_ANON rather than MAP_ANONYMOUS.
>>
>> -Paul
>>
>>
>> --
>> Paul H. Hargrove PHHargrove_at_[hidden]
>> Future Technologies Group
>> Computer and Data Sciences Department Tel: +1-510-495-2352
>> Lawrence Berkeley National Laboratory Fax: +1-510-486-6900
>>
>
>
>
> --
> Paul H. Hargrove PHHargrove_at_[hidden]
> Future Technologies Group
> Computer and Data Sciences Department Tel: +1-510-495-2352
> Lawrence Berkeley National Laboratory Fax: +1-510-486-6900
>

-- 
Paul H. Hargrove                          PHHargrove_at_[hidden]
Future Technologies Group
Computer and Data Sciences Department     Tel: +1-510-495-2352
Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900