From d4926ccecdf160bfdaf6c1428520750bdb6125c0 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 21 Dec 2016 11:58:10 +0900 Subject: [PATCH 1/2] hwloc: correctly handle --with-hwloc=external - simply #include "hwloc.h" to use the external hwloc header - do use the external hwloc header instead of opal/mca/hwloc/hwloc.h Thanks Orion Poplawski for the report Fixes open-mpi/ompi#2616 Signed-off-by: Gilles Gouaillardet (cherry picked from commit open-mpi/ompi@9649c44fa0aafa2bf93c36663d11214833e83369) --- opal/mca/hwloc/Makefile.am | 7 +++++++ opal/mca/hwloc/external/configure.m4 | 13 +++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/opal/mca/hwloc/Makefile.am b/opal/mca/hwloc/Makefile.am index 9a12052746c..ac24ea2fcd3 100644 --- a/opal/mca/hwloc/Makefile.am +++ b/opal/mca/hwloc/Makefile.am @@ -1,5 +1,7 @@ # # Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2016 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -7,6 +9,11 @@ # $HEADER$ # +# we do not want -I$(srcdir) in DEFAULT_INCLUDES +# otherwise there can be a conflict between system hwloc.h and opal/mca/hwloc/hwloc.h +# so just hack DEFAULT_INCLUDES with only what we need +DEFAULT_INCLUDES = -I$(top_builddir)/opal/include + # main library setup noinst_LTLIBRARIES = libmca_hwloc.la libmca_hwloc_la_SOURCES = diff --git a/opal/mca/hwloc/external/configure.m4 b/opal/mca/hwloc/external/configure.m4 index 31fd1e3c0e9..79b3e6cb61b 100644 --- a/opal/mca/hwloc/external/configure.m4 +++ b/opal/mca/hwloc/external/configure.m4 @@ -1,7 +1,7 @@ # -*- shell-script -*- # # Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2014 Research Organization for Information Science +# Copyright (c) 2014-2016 Research Organization for Information Science # and Technology (RIST). All rights reserved. # # $COPYRIGHT$ @@ -61,12 +61,17 @@ AC_DEFUN([MCA_opal_hwloc_external_POST_CONFIG],[ # OPAL_HWLOC_WANT_VERBS_HELPER is set, that file will # include the external hwloc/openfabrics-verbs.h file (via # the MCA_hwloc_external_openfabrics_helper define). + AS_IF([test "$opal_hwloc_dir" != ""], + [opal_hwloc_include="$opal_hwloc_dir/include/hwloc.h" + opal_hwloc_openfabrics_include="$opal_hwloc_dir/include/hwloc/hwloc/openfabrics-verbs.h"], + [opal_hwloc_include="hwloc.h" + opal_hwloc_openfabrics_include="hwloc/openfabrics-verbs.h"]) AC_DEFINE_UNQUOTED(MCA_hwloc_external_header, - ["$opal_hwloc_dir/include/hwloc.h"], + ["$opal_hwloc_include"], [Location of external hwloc header]) AC_DEFINE_UNQUOTED(MCA_hwloc_external_openfabrics_header, - ["$opal_hwloc_dir/include/hwloc/openfabrics-verbs.h"], - [Location of external hwloc header]) + ["$opal_hwloc_openfabrics_include"], + [Location of external hwloc openfabrics header]) ]) OPAL_VAR_SCOPE_POP ])dnl From f8bff560b01c331c9fef3d7ec9cd47b51c32a1de Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Wed, 21 Dec 2016 09:06:24 -0800 Subject: [PATCH 2/2] hwloc external: minor fixes to 9649c44 - Fix capitolization typos - Make comment more correct / flow better - Use AM_CPPFLAGS, not DEFAULT_INCLUDES - Remove extra "hwloc/" from external hwloc.h specification Signed-off-by: Jeff Squyres (cherry picked from commit 3571c3c5bb4c14e419b844cd2da378155378b30a) --- opal/mca/hwloc/Makefile.am | 10 +++++----- opal/mca/hwloc/external/configure.m4 | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/opal/mca/hwloc/Makefile.am b/opal/mca/hwloc/Makefile.am index ac24ea2fcd3..c5340da386d 100644 --- a/opal/mca/hwloc/Makefile.am +++ b/opal/mca/hwloc/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (c) 2011 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2011-2016 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2016 Research Organization for Information Science # and Technology (RIST). All rights reserved. # $COPYRIGHT$ @@ -9,10 +9,10 @@ # $HEADER$ # -# we do not want -I$(srcdir) in DEFAULT_INCLUDES -# otherwise there can be a conflict between system hwloc.h and opal/mca/hwloc/hwloc.h -# so just hack DEFAULT_INCLUDES with only what we need -DEFAULT_INCLUDES = -I$(top_builddir)/opal/include +# We do not want -I$(srcdir) in AM_CPPFLAGS, or there can be a +# conflict between system hwloc.h and opal/mca/hwloc/hwloc.h. So just +# set only what we need to AM_CPPFLAGS. +AM_CPPFLAGS = -I$(top_builddir)/opal/include # main library setup noinst_LTLIBRARIES = libmca_hwloc.la diff --git a/opal/mca/hwloc/external/configure.m4 b/opal/mca/hwloc/external/configure.m4 index 79b3e6cb61b..c9c8a272df2 100644 --- a/opal/mca/hwloc/external/configure.m4 +++ b/opal/mca/hwloc/external/configure.m4 @@ -63,7 +63,7 @@ AC_DEFUN([MCA_opal_hwloc_external_POST_CONFIG],[ # the MCA_hwloc_external_openfabrics_helper define). AS_IF([test "$opal_hwloc_dir" != ""], [opal_hwloc_include="$opal_hwloc_dir/include/hwloc.h" - opal_hwloc_openfabrics_include="$opal_hwloc_dir/include/hwloc/hwloc/openfabrics-verbs.h"], + opal_hwloc_openfabrics_include="$opal_hwloc_dir/include/hwloc/openfabrics-verbs.h"], [opal_hwloc_include="hwloc.h" opal_hwloc_openfabrics_include="hwloc/openfabrics-verbs.h"]) AC_DEFINE_UNQUOTED(MCA_hwloc_external_header, @@ -71,7 +71,7 @@ AC_DEFUN([MCA_opal_hwloc_external_POST_CONFIG],[ [Location of external hwloc header]) AC_DEFINE_UNQUOTED(MCA_hwloc_external_openfabrics_header, ["$opal_hwloc_openfabrics_include"], - [Location of external hwloc openfabrics header]) + [Location of external hwloc OpenFabrics header]) ]) OPAL_VAR_SCOPE_POP ])dnl