Skip to content

Commit 6e799d0

Browse files
committed
build: Fix .la files leaking into mpicc
Fix a bug that has existed for some time with static components, but became more noticable with static-by-default configuration combined with moving some helper libraries into 3rd-party/. If a component set its LIBS to a .la file (like the treematch case) and that component did not explicitly set WRAPPER_EXTRA_LIBS, then that .la file got copied into the wrapper LIBS and caused compile failures. Simplest solution is to filter out the .la files when copying the component's LIBS to WRAPPER_EXTRA_LIBS, since components should not be including non-static .la files. Signed-off-by: Brian Barrett <bbarrett@amazon.com>
1 parent d2284ec commit 6e799d0

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

config/opal_mca.m4

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,23 @@ AC_DEFUN([MCA_COMPONENT_COMPILE_MODE],[
725725
fi
726726
])
727727

728+
# OPAL_MCA_STRIP_LAFILES(output_variable(1),
729+
# input_list(2)
730+
#--------------------------------------------
731+
# Helper function to MCA_PROCESS_COMPONENT which will strip
732+
# any .la file entries in the LIBS list. Used for when copying
733+
# a component's LIBS into WRAPPER_LIBS.
734+
AC_DEFUN([OPAL_MCA_STRIP_LAFILES], [
735+
OPAL_VAR_SCOPE_PUSH([opal_tmp])
736+
737+
for arg in $2; do
738+
opal_tmp=`echo $arg | awk '{print substr([$][1], length([$][1])-2) }'`
739+
AS_IF([test "$opal_tmp" != ".la"],
740+
[AS_IF([test -z "$$1"], [$1=$arg], [$1="$$1 $arg"])])
741+
done
742+
743+
OPAL_VAR_SCOPE_POP
744+
])
728745

729746
# MCA_PROCESS_COMPONENT(project_name(1), framework_name (2), component_name (3),
730747
# all_components_variable (4), static_components_variable (5)
@@ -806,16 +823,20 @@ AC_MSG_ERROR([*** $2 component $3 was supposed to be direct-called, but
806823
# into the wrapper flags.
807824
AS_IF([test "$8" = "static"],
808825
[m4_foreach(flags, [LDFLAGS, LIBS],
809-
[AS_VAR_SET_IF([$2_$3_WRAPPER_EXTRA_]flags,
826+
[m4_if(flags, [LIBS],
827+
[OPAL_MCA_STRIP_LAFILES([tmp_]flags, [$$2_$3_]flags)],
828+
[tmp_]flags[=$$2_$3_]flags)
829+
AS_VAR_SET_IF([$2_$3_WRAPPER_EXTRA_]flags,
810830
[OPAL_FLAGS_APPEND_UNIQ([mca_wrapper_extra_]m4_tolower(flags), [$$2_$3_WRAPPER_EXTRA_]flags)],
811-
[OPAL_FLAGS_APPEND_UNIQ([mca_wrapper_extra_]m4_tolower(flags), [$$2_$3]_flags)])
831+
[OPAL_FLAGS_APPEND_UNIQ([mca_wrapper_extra_]m4_tolower(flags), [$tmp_]flags)])
812832
dnl yes, this is weird indenting, but the
813833
dnl combination of m4_foreach and AS_VAR_SET_IF
814834
dnl will result in the closing of one if and the
815835
dnl start of the next on the same line, resulting
816836
dnl in parse errors, if this is not here.
817837
])])
818838
839+
819840
# if needed, copy over WRAPPER_EXTRA_CPPFLAGS. Since a configure script
820841
# component can never be used in a STOP_AT_FIRST framework, we
821842
# don't have to implement the else clause in the literal check...

0 commit comments

Comments
 (0)