Skip to content

Commit

Permalink
fortran: do not link Fortran libs with unnecessary libraries
Browse files Browse the repository at this point in the history
Fortran libraries do not need to be linked with PMIx, hwloc nor
libevent. That can cause some issues with incompatible flags are pulled
from the .la files.
For example, when the NAG Fortran compiler is used,
libmpi_mpifh_sizeof.la pulls the -pthread flag, that is translated
into -Wl,-pthread.
Then when libmpi_mpifh.la is linked with gcc but pulls -Wl,-pthread that
causes the build to fail since -pthread is not a valid ld option.
Not depending on these libraries is enough to avoid the above issue.

Refs #12413

Thanks to Matthew Thompson for reporting this issue and helping with
the diagnostic.

Signed-off-by: Gilles Gouaillardet <gilles@rist.or.jp>
  • Loading branch information
ggouaillardet committed Apr 10, 2024
1 parent 02bc0c5 commit 6c39666
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 27 deletions.
5 changes: 3 additions & 2 deletions config/opal_config_hwloc.m4
@@ -1,7 +1,7 @@
dnl -*- autoconf -*-
dnl
dnl Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved
dnl Copyright (c) 2014-2018 Research Organization for Information Science
dnl Copyright (c) 2014-2024 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl Copyright (c) 2020-2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
dnl Copyright (c) 2020 Intel, Inc. All rights reserved.
Expand Down Expand Up @@ -270,5 +270,6 @@ dnl configure, to avoid pulling it into other configure tests.
AC_DEFUN([OPAL_CONFIG_HWLOC_INTERNAL_LIBS_HANDLER], [
OPAL_FLAGS_APPEND_UNIQ([CPPFLAGS], [${opal_hwloc_CPPFLAGS}])
OPAL_FLAGS_APPEND_UNIQ([LDFLAGS], [$opal_hwloc_LDFLAGS])
OPAL_FLAGS_APPEND_MOVE([LIBS], [${opal_hwloc_BUILD_LIBS}])
opal_hwloc_LIBS=${opal_hwloc_BUILD_LIBS}
AC_SUBST([opal_hwloc_LIBS])
])
3 changes: 2 additions & 1 deletion config/opal_config_libevent.m4
Expand Up @@ -269,5 +269,6 @@ dnl configure, to avoid pulling it into other configure tests.
AC_DEFUN([OPAL_CONFIG_LIBEVENT_INTERNAL_LIBS_HANDLER], [
OPAL_FLAGS_APPEND_UNIQ([CPPFLAGS], [${opal_libevent_CPPFLAGS}])
OPAL_FLAGS_APPEND_UNIQ([LDFLAGS], [${opal_libevent_LDFLAGS}])
OPAL_FLAGS_APPEND_MOVE([LIBS], [${opal_libevent_BUILD_LIBS}])
opal_libevent_LIBS=${opal_libevent_BUILD_LIBS}
AC_SUBST([opal_libevent_LIBS])
])
3 changes: 2 additions & 1 deletion config/opal_config_pmix.m4
Expand Up @@ -295,5 +295,6 @@ dnl configure, to avoid pulling it into other configure tests.
AC_DEFUN([OPAL_CONFIG_PMIX_INTERNAL_LIBS_HANDLER], [
OPAL_FLAGS_APPEND_UNIQ([CPPFLAGS], [${opal_pmix_CPPFLAGS}])
OPAL_FLAGS_APPEND_UNIQ([LDFLAGS], [${opal_pmix_LDFLAGS}])
OPAL_FLAGS_APPEND_MOVE([LIBS], [${opal_pmix_BUILD_LIBS}])
opal_pmix_LIBS=${opal_pmix_BUILD_LIBS}
AC_SUBST([opal_pmix_LIBS])
])
3 changes: 2 additions & 1 deletion ompi/Makefile.am
Expand Up @@ -144,7 +144,8 @@ lib@OMPI_LIBMPI_NAME@_la_LIBADD = \


lib@OMPI_LIBMPI_NAME@_la_LIBADD += \
$(OMPI_TOP_BUILDDIR)/opal/lib@OPAL_LIB_NAME@.la
$(OMPI_TOP_BUILDDIR)/opal/lib@OPAL_LIB_NAME@.la \
$(opal_pmix_LIBS)
lib@OMPI_LIBMPI_NAME@_la_DEPENDENCIES = $(lib@OMPI_LIBMPI_NAME@_la_LIBADD)
lib@OMPI_LIBMPI_NAME@_la_LDFLAGS = \
-version-info $(libmpi_so_version) \
Expand Down
11 changes: 8 additions & 3 deletions ompi/mca/topo/treematch/Makefile.am
Expand Up @@ -5,7 +5,7 @@
# Copyright (c) 2011-2015 INRIA. All rights reserved.
# Copyright (c) 2011-2015 Université Bordeaux 1
# Copyright (c) 2017 IBM Corporation. All rights reserved.
# Copyright (c) 2019 Research Organization for Information Science
# Copyright (c) 2019-2024 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2021 Google, LLC. All rights reserved.
# $COPYRIGHT$
Expand Down Expand Up @@ -43,11 +43,16 @@ mcacomponentdir = $(pkglibdir)
mcacomponent_LTLIBRARIES = $(component)
mca_topo_treematch_la_SOURCES = $(component_sources)
mca_topo_treematch_la_LDFLAGS = -module -avoid-version $(topo_treematch_LDFLAGS)
mca_topo_treematch_la_LIBADD = $(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la $(topo_treematch_LIBS)
mca_topo_treematch_la_LIBADD = \
$(top_builddir)/ompi/lib@OMPI_LIBMPI_NAME@.la \
$(topo_treematch_LIBS) \
$(opal_hwloc_LIBS)

noinst_LTLIBRARIES = $(lib)
libmca_topo_treematch_la_SOURCES = $(lib_sources)
libmca_topo_treematch_la_LIBADD = $(topo_treematch_LIBS)
libmca_topo_treematch_la_LIBADD = \
$(topo_treematch_LIBS) \
$(opal_hwloc_LIBS)
libmca_topo_treematch_la_LDFLAGS = -module -avoid-version $(topo_treematch_LDFLAGS)

distclean-local:
Expand Down
16 changes: 10 additions & 6 deletions opal/Makefile.am
Expand Up @@ -46,9 +46,11 @@ lib_LTLIBRARIES = lib@OPAL_LIB_NAME@.la

libopen_pal_core_la_SOURCES =
libopen_pal_core_la_LIBADD = \
mca/base/libmca_base.la \
util/libopalutil_core.la \
$(MCA_opal_FRAMEWORK_CORE_LIBS)
mca/base/libmca_base.la \
util/libopalutil_core.la \
$(MCA_opal_FRAMEWORK_CORE_LIBS) \
$(opal_pmix_LIBS) \
$(opal_libevent_LIBS)
libopen_pal_core_la_DEPENDENCIES = \
mca/base/libmca_base.la \
util/libopalutil_core.la \
Expand All @@ -57,9 +59,11 @@ libopen_pal_core_la_DEPENDENCIES = \
lib@OPAL_LIB_NAME@_la_SOURCES =
lib@OPAL_LIB_NAME@_la_LIBADD = \
libopen-pal_core.la \
datatype/libdatatype.la \
util/libopalutil.la \
$(MCA_opal_FRAMEWORK_LIBS)
datatype/libdatatype.la \
util/libopalutil.la \
$(MCA_opal_FRAMEWORK_LIBS) \
$(opal_pmix_LIBS) \
$(opal_libevent_LIBS)
lib@OPAL_LIB_NAME@_la_DEPENDENCIES = \
libopen-pal_core.la \
datatype/libdatatype.la \
Expand Down
12 changes: 9 additions & 3 deletions opal/mca/btl/smcuda/Makefile.am
Expand Up @@ -13,6 +13,8 @@
# Copyright (c) 2012 NVIDIA Corporation. All rights reserved.
# Copyright (c) 2017 IBM Corporation. All rights reserved.
# Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
# Copyright (c) 2024 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand Down Expand Up @@ -52,13 +54,17 @@ mcacomponentdir = $(opallibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_btl_smcuda_la_SOURCES = $(libmca_btl_smcuda_la_sources)
mca_btl_smcuda_la_LDFLAGS = -module -avoid-version $(btl_smcuda_LDFLAGS)
mca_btl_smcuda_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_NAME@.la \
mca_btl_smcuda_la_LIBADD = \
$(top_builddir)/opal/lib@OPAL_LIB_NAME@.la \
$(OPAL_TOP_BUILDDIR)/opal/mca/common/sm/lib@OPAL_LIB_NAME@mca_common_sm.la \
$(btl_smcuda_LIBS)
$(btl_smcuda_LIBS) \
$(opal_hwloc_LIBS)
mca_btl_smcuda_la_CPPFLAGS = $(btl_smcuda_CPPFLAGS)

noinst_LTLIBRARIES = $(component_noinst)
libmca_btl_smcuda_la_SOURCES = $(libmca_btl_smcuda_la_sources)
libmca_btl_smcuda_la_LDFLAGS = -module -avoid-version $(btl_smcuda_LDFLAGS)
libmca_btl_smcuda_la_CPPFLAGS = $(btl_smcuda_CPPFLAGS)
libmca_btl_smcuda_la_LIBADD = $(btl_smcuda_LIBS)
libmca_btl_smcuda_la_LIBADD = \
$(btl_smcuda_LIBS) \
$(opal_hwloc_LIBS)
12 changes: 9 additions & 3 deletions opal/mca/btl/ugni/Makefile.am
Expand Up @@ -3,6 +3,8 @@
# Copyright (c) 2011-2017 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2011 UT-Battelle, LLC. All rights reserved.
# Copyright (c) 2024 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
#
# Additional copyrights may follow
#
Expand Down Expand Up @@ -48,12 +50,16 @@ mcacomponentdir = $(opallibdir)
mcacomponent_LTLIBRARIES = $(component_install)
mca_btl_ugni_la_SOURCES = $(ugni_SOURCES)
nodist_mca_btl_ugni_la_SOURCES = $(ugni_nodist_SOURCES)
mca_btl_ugni_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_NAME@.la \
$(btl_ugni_LIBS)
mca_btl_ugni_la_LIBADD = \
$(top_builddir)/opal/lib@OPAL_LIB_NAME@.la \
$(btl_ugni_LIBS) \
$(opal_hwloc_LIBS)
mca_btl_ugni_la_LDFLAGS = -module -avoid-version $(btl_ugni_LDFLAGS)

noinst_LTLIBRARIES = $(component_noinst)
libmca_btl_ugni_la_SOURCES = $(ugni_SOURCES)
nodist_libmca_btl_ugni_la_SOURCES = $(ugni_nodist_SOURCES)
libmca_btl_ugni_la_LIBADD = $(btl_ugni_LIBS)
libmca_btl_ugni_la_LIBADD = \
$(btl_ugni_LIBS) \
$(opal_hwloc_LIBS)
libmca_btl_ugni_la_LDFLAGS = -module -avoid-version $(btl_ugni_LDFLAGS)
12 changes: 8 additions & 4 deletions opal/mca/btl/usnic/Makefile.am
Expand Up @@ -16,7 +16,7 @@
# Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
# Copyright (c) 2017 Los Alamos National Security, LLC. All rights
# reserved.
# Copyright (c) 2019 Research Organization for Information Science
# Copyright (c) 2019-2024 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
# $COPYRIGHT$
Expand Down Expand Up @@ -93,16 +93,20 @@ mca_btl_usnic_la_LDFLAGS = \
$(opal_btl_usnic_LDFLAGS) \
$(btl_usnic_LDFLAGS) \
-module -avoid-version
mca_btl_usnic_la_LIBADD = $(top_builddir)/opal/lib@OPAL_LIB_NAME@.la \
$(btl_usnic_LIBS)
mca_btl_usnic_la_LIBADD = \
$(top_builddir)/opal/lib@OPAL_LIB_NAME@.la \
$(btl_usnic_LIBS) \
$(opal_hwloc_LIBS)

noinst_LTLIBRARIES = $(lib)
libmca_btl_usnic_la_SOURCES = $(lib_sources)
libmca_btl_usnic_la_LDFLAGS = \
$(opal_btl_usnic_LDFLAGS) \
$(btl_usnic_LDFLAGS) \
-module -avoid-version
libmca_btl_usnic_la_LIBADD = $(btl_usnic_LIBS)
libmca_btl_usnic_la_LIBADD = \
$(btl_usnic_LIBS) \
$(opal_hwloc_LIBS)

if OPAL_BTL_USNIC_BUILD_UNIT_TESTS
usnic_btl_run_tests_CPPFLAGS = $(AM_CPPFLAGS) \
Expand Down
10 changes: 8 additions & 2 deletions opal/mca/common/ofi/Makefile.am
Expand Up @@ -16,6 +16,8 @@
# reserved.
# Copyright (c) 2019 Hewlett Packard Enterprise. All rights reserved.
# Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All Rights reserved.
# Copyright (c) 2024 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand Down Expand Up @@ -75,11 +77,15 @@ lib@OPAL_LIB_NAME@mca_common_ofi_la_SOURCES = $(headers) $(sources)
lib@OPAL_LIB_NAME@mca_common_ofi_la_LDFLAGS = \
$(common_ofi_LDFLAGS) \
-version-info $(libmca_opal_common_ofi_so_version)
lib@OPAL_LIB_NAME@mca_common_ofi_la_LIBADD = $(common_ofi_LIBS)
lib@OPAL_LIB_NAME@mca_common_ofi_la_LIBADD = \
$(common_ofi_LIBS) \
$(opal_hwloc_LIBS)

lib@OPAL_LIB_NAME@mca_common_ofi_noinst_la_SOURCES = $(headers) $(sources)
lib@OPAL_LIB_NAME@mca_common_ofi_noinst_la_LDFLAGS = $(common_ofi_LDFLAGS)
lib@OPAL_LIB_NAME@mca_common_ofi_noinst_la_LIBADD = $(common_ofi_LIBS)
lib@OPAL_LIB_NAME@mca_common_ofi_noinst_la_LIBADD = \
$(common_ofi_LIBS) \
$(opal_hwloc_LIBS)

# Conditionally install the header files

Expand Down
5 changes: 4 additions & 1 deletion oshmem/Makefile.am
Expand Up @@ -8,6 +8,8 @@
# Copyright (c) 2016 IBM Corporation. All rights reserved.
# Copyright (c) 2021 Amazon.com, Inc. or its affiliates.
# All Rights reserved.
# Copyright (c) 2024 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand Down Expand Up @@ -54,7 +56,8 @@ liboshmem_la_LIBADD = \
shmem/c/liboshmem_c.la \
$(fortran_oshmem_lib) \
$(MCA_oshmem_FRAMEWORK_LIBS) \
$(OSHMEM_TOP_BUILDDIR)/ompi/lib@OMPI_LIBMPI_NAME@.la
$(OSHMEM_TOP_BUILDDIR)/ompi/lib@OMPI_LIBMPI_NAME@.la \
$(opal_pmix_LIBS)
liboshmem_la_DEPENDENCIES = $(liboshmem_la_LIBADD)
liboshmem_la_LDFLAGS = \
-version-info $(liboshmem_so_version) \
Expand Down

0 comments on commit 6c39666

Please sign in to comment.