Skip to content

Commit 2f5ed7b

Browse files
committed
build: Add build mode check for common libraries
Add a macro OPAL_MCA_CHECK_DEPENDENCY() to check if a component's build mode (static / dso) conflicts with a dependent component's build mode (generally, a common library). The issue of concern is if the component is built as a static component, but the common component is build as a dso. Since all the common components currently depend on libopen-pal (and sometimes libmpi), libopen-pal and/or libmpi cannot depend on a common library without creating a circular dependency chain, and we do not like those. Signed-off-by: Brian Barrett <[email protected]>
1 parent f45a0cf commit 2f5ed7b

File tree

7 files changed

+60
-3
lines changed

7 files changed

+60
-3
lines changed

config/opal_mca.m4

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,3 +1033,29 @@ AC_DEFUN([OPAL_MCA_MAKE_DIR_LIST],[
10331033
done
10341034
AC_SUBST($1)
10351035
])
1036+
1037+
1038+
# OPAL_MCA_CHECK_DEPENDENCY(check project, check framework, check component,
1039+
# dependent project, dependent framework, dependent component)
1040+
# --------------------------------------------------------------------------
1041+
# Enforce that the check component does not introduce a dependency from its
1042+
# project library (ie libmpi.so or libopen-pal.so) to another component
1043+
# (ie, a common_*.so). This can happen if the check component is set to
1044+
# build static and the common library is set to build dso. If this situation
1045+
# is detected, print an error and abort configure.
1046+
AC_DEFUN([OPAL_MCA_CHECK_DEPENDENCY],
1047+
[
1048+
OPAL_VAR_SCOPE_PUSH([component_compile_mode dependency_compile_mode])
1049+
1050+
MCA_COMPONENT_COMPILE_MODE([$1], [$2], [$3], [component_compile_mode])
1051+
MCA_COMPONENT_COMPILE_MODE([$4], [$5], [$6], [dependency_compile_mode])
1052+
1053+
AS_IF([test "${component_compile_mode}" = "static" -a "${dependency_compile_mode}" = "dso"],
1054+
[AC_MSG_ERROR([Component $2:$3 is set to build as a
1055+
static component, but its dependency $5:$6 is set to build as
1056+
a dynamic component. This configuration is not supported. Please
1057+
either build $5:$6 as a static component or build $2:$3 as a dynamic
1058+
component.])])
1059+
1060+
OPAL_VAR_SCOPE_POP
1061+
])

ompi/mca/coll/sm/configure.m4

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# -*- autoconf -*-
2+
#
3+
# Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
4+
# $COPYRIGHT$
5+
#
6+
# Additional copyrights may follow
7+
#
8+
# $HEADER$
9+
#
10+
11+
AC_DEFUN([MCA_ompi_coll_sm_CONFIG],[
12+
AC_CONFIG_FILES([ompi/mca/coll/sm/Makefile])
13+
14+
OPAL_MCA_CHECK_DEPENDENCY([ompi], [coll], [sm], [opal], [common], [sm])
15+
16+
$1
17+
])dnl

ompi/mca/mtl/ofi/configure.m4

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ AC_DEFUN([MCA_ompi_mtl_ofi_CONFIG],[
4848
[],
4949
[mtl_ofi_happy=0])])])
5050
51+
AS_IF([test ${mtl_ofi_happy} -eq 1],
52+
[OPAL_MCA_CHECK_DEPENDENCY([opal], [btl], [ofi], [opal], [common], [ofi])])
53+
5154
AS_IF([test ${mtl_ofi_happy} -eq 1],
5255
[$1],
5356
[AS_IF([test -n "${with_ofi}" -a "${with_ofi}" != "no"],

ompi/mca/osc/ucx/configure.m4

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- shell-script -*-
22
#
33
# Copyright (C) Mellanox Technologies Ltd. 2001-2017. ALL RIGHTS RESERVED.
4+
# Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
45
# $COPYRIGHT$
56
#
67
# Additional copyrights may follow
@@ -25,6 +26,9 @@ AC_DEFUN([MCA_ompi_osc_ucx_CONFIG],[
2526
[osc_ucx_happy="yes"],
2627
[osc_ucx_happy="no"])
2728

29+
AS_IF([test "${osc_ucx_happy}" = "yes"],
30+
[OPAL_MCA_CHECK_DEPENDENCY([ompi], [osc], [ucx], [opal], [common], [ucx])])
31+
2832
AS_IF([test "$osc_ucx_happy" = "yes"],
2933
[$1],
3034
[$2])

ompi/mca/pml/ucx/configure.m4

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#
22
# Copyright (C) Mellanox Technologies Ltd. 2001-2015. ALL RIGHTS RESERVED.
3+
# Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
34
# $COPYRIGHT$
45
#
56
# Additional copyrights may follow
@@ -19,6 +20,9 @@ AC_DEFUN([MCA_ompi_pml_ucx_CONFIG], [
1920
[pml_ucx_happy="yes"],
2021
[pml_ucx_happy="no"])
2122
23+
AS_IF([test "${pml_ucx_happy}" = "yes"],
24+
[OPAL_MCA_CHECK_DEPENDENCY([ompi], [pml], [ucx], [opal], [common], [ucx])])
25+
2226
AS_IF([test "$pml_ucx_happy" = "yes"],
2327
[$1],
2428
[$2])

opal/mca/btl/ofi/configure.m4

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
# Copyright (c) 2011-2018 Los Alamos National Security, LLC.
1616
# All rights reserved.
1717
# Copyright (c) 2018 Intel, inc. All rights reserved
18-
#
1918
# Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
2019
# $COPYRIGHT$
2120
#
@@ -45,6 +44,9 @@ AC_DEFUN([MCA_opal_btl_ofi_CONFIG],[
4544
[#include <rdma/fabric.h>])
4645
CPPFLAGS=${CPPFLAGS_save}])
4746
47+
AS_IF([test ${btl_ofi_happy} -eq 1],
48+
[OPAL_MCA_CHECK_DEPENDENCY([opal], [btl], [ofi], [opal], [common], [ofi])])
49+
4850
AS_IF([test ${btl_ofi_happy} -eq 1],
4951
[$1],
5052
[AS_IF([test -n "${with_ofi}" -a "${with_ofi}" != "no"],

opal/mca/btl/smcuda/configure.m4

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
# reserved.
66
# Copyright (c) 2009-2010 Cisco Systems, Inc. All rights reserved.
77
# Copyright (c) 2012-2015 NVIDIA Corporation. All rights reserved.
8+
# Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
89
# $COPYRIGHT$
910
#
1011
# Additional copyrights may follow
@@ -23,7 +24,7 @@ AC_DEFUN([MCA_opal_btl_smcuda_CONFIG],[
2324

2425
# Only build if CUDA support is available
2526
AS_IF([test "x$CUDA_SUPPORT" = "x1"],
26-
[$1],
27+
[$1
28+
OPAL_MCA_CHECK_DEPENDENCY([opal], [btl], [smcuda], [opal], [common], [sm])],
2729
[$2])
28-
2930
])dnl

0 commit comments

Comments
 (0)