@@ -15,7 +15,7 @@ dnl Copyright (c) 2015 Research Organization for Information Science
15
15
dnl and Technology (RIST). All rights reserved.
16
16
dnl Copyright (c) 2016 Los Alamos National Security, LLC. All rights
17
17
dnl reserved.
18
- dnl Copyright (c) 2017 IBM Corporation. All rights reserved.
18
+ dnl Copyright (c) 2017-2020 IBM Corporation. All rights reserved.
19
19
dnl $COPYRIGHT $
20
20
dnl
21
21
dnl Additional copyrights may follow
@@ -120,6 +120,70 @@ AC_DEFUN([ORTE_CHECK_LSF],[
120
120
[orte_check_lsf_happy= " yes" ],
121
121
[orte_check_lsf_happy= " no" ])])
122
122
123
+
124
+ # Some versions of LSF ship with a libevent.so in their library path.
125
+ # This is _not_ a copy of Libevent, but something specific to their project.
126
+ # The Open MPI components should not need to link against LSF's libevent.so
127
+ # However, the presence of it in the linker search path can cause a problem
128
+ # if there is a system installed Libevent and Open MPI chooses the 'external'
129
+ # event component prior to this stage.
130
+ #
131
+ # Add a check here to see if we are in a scenario where the two are conflicting.
132
+ # In which case the earlier checks for successful compile of an LSF program will
133
+ # have failed with messages like:
134
+ # lib64/libevent_pthreads.so: undefined reference to `evthread_set_condition_callbacks'
135
+ # lib64/libevent_pthreads.so: undefined reference to `event_mm_malloc_'
136
+ # lib64/libevent_pthreads.so: undefined reference to `event_mm_free_'
137
+ # lib64/libevent_pthreads.so: undefined reference to `evthread_set_id_callback'
138
+ # lib64/libevent_pthreads.so: undefined reference to `evthread_set_lock_callbacks'
139
+ # Because it picked up -levent from LSF, but -levent_pthreads from Libevent.
140
+ #
141
+ # So look for a function that libevent_pthreads is looking for from libevent.so
142
+ # If it does not appear here when adding the same option then we have
143
+ # a conflict.
144
+ orte_check_lsf_event_conflict= na
145
+ AS_IF([test " $orte_check_lsf_happy " = " no" ],
146
+ [AS_IF([test " $opal_event_external_support " = " yes" ],
147
+ [AS_IF([test " $orte_check_lsf_libdir " = " " ],
148
+ [],
149
+ [LDFLAGS= " $LDFLAGS -L$orte_check_lsf_libdir " ])
150
+ # Note that we do not want to set LIBS here to include -llsf since
151
+ # the check is not for an LSF library, but for the conflict with
152
+ # LDFLAGS.
153
+ AC_CHECK_LIB([event], [evthread_set_condition_callbacks],
154
+ [AC_MSG_CHECKING([for libevent conflict])
155
+ AC_MSG_RESULT([No. The correct libevent.so was linked.])
156
+ orte_check_lsf_event_conflict= no],
157
+ [AC_MSG_CHECKING([for libevent conflict])
158
+ AC_MSG_RESULT([Yes. A wrong libevent.so was linked.])
159
+ orte_check_lsf_event_conflict= yes])
160
+ ],
161
+ [AC_MSG_CHECKING([for libevent conflict])
162
+ AC_MSG_RESULT([No. Internal Libevent is being used.])
163
+ orte_check_lsf_event_conflict= na])],
164
+ [AC_MSG_CHECKING([for libevent conflict])
165
+ AC_MSG_RESULT([No. LSF checks passed.])
166
+ orte_check_lsf_event_conflict= na])
167
+
168
+ AS_IF([test " $orte_check_lsf_event_conflict " = " yes" ],
169
+ [AC_MSG_WARN([=================================================================== ])
170
+ AC_MSG_WARN([Conflicting libevent.so libraries detected on the system.])
171
+ AC_MSG_WARN([])
172
+ AC_MSG_WARN([A system-installed Libevent library was detected and the Open MPI])
173
+ AC_MSG_WARN([build system chose to use the ' external' component expecting to])
174
+ AC_MSG_WARN([link against the Libevent in the linker search path.])
175
+ AC_MSG_WARN([LSF provides a libevent.so that is not from Libevent in its])
176
+ AC_MSG_WARN([library path. At this point the linker is attempting to resolve])
177
+ AC_MSG_WARN([Libevent symbols using the LSF library because of the lack of])
178
+ AC_MSG_WARN([an explicit linker path pointing to the system-installed Libevent.])
179
+ AC_MSG_WARN([])
180
+ AC_MSG_WARN([To resolve this issue either (A) explicitly pass the Libevent])
181
+ AC_MSG_WARN([library path on the configure line (--with-libevent-libdir), or])
182
+ AC_MSG_WARN([(B) use the internal libevent by requesting it from configure ])
183
+ AC_MSG_WARN([with the --with-libevent= internal option.])
184
+ AC_MSG_WARN([=================================================================== ])
185
+ ])
186
+
123
187
CPPFLAGS= " $orte_check_lsf_ $1 _save_CPPFLAGS"
124
188
LDFLAGS= " $orte_check_lsf_ $1 _save_LDFLAGS"
125
189
LIBS= " $orte_check_lsf_ $1 _save_LIBS"
@@ -137,7 +201,7 @@ AC_DEFUN([ORTE_CHECK_LSF],[
137
201
$1 _WRAPPER_EXTRA_LDFLAGS= [$]$1 _LDFLAGS
138
202
$1 _WRAPPER_EXTRA_LIBS= [$]$1 _LIBS
139
203
$2 ],
140
- [AS_IF([test ! -z " $with_lsf " && test " $with_lsf " != " no" ],
204
+ [AS_IF([test ! -z " $with_lsf " && test " $with_lsf " != " no" && test " $orte_check_lsf_event_conflict " = " yes " ],
141
205
[AC_MSG_WARN([LSF support requested (via --with-lsf) but not found.])
142
206
AC_MSG_ERROR([Aborting.])])
143
207
$3 ])
0 commit comments