Skip to content

Commit 3cb31c0

Browse files
committed
Configure script now also gets the flags for libzmq from pkg-config if available. This fixes an issue encountered on the BNL IC where the linker would prefer the system build rather than the spack build of the library.
Added extra spacing around SPDLOG flags in configure script to prevent incorrect argument concatenation Added a variant to the spack package (default on) which passes the pkg-config flags to the configure script
1 parent e65bf47 commit 3cb31c0

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

configure.ac

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,25 @@ if [[ "${no_pkgconfig}" -eq 0 ]]; then
2525
if [[ $(echo ${SPDLOG_CFLAGS} | grep -c "not found") -eq 1 ]]; then
2626
AC_MSG_FAILURE(["Cannot find spdlog configuration with pkg-config"])
2727
fi
28-
CXXFLAGS+="${SPDLOG_CFLAGS}"
28+
CXXFLAGS+=" ${SPDLOG_CFLAGS} "
2929
SPDLOG_LDFLAGS=$(pkg-config --libs spdlog 2>&1)
30-
LDFLAGS+="${SPDLOG_LDFLAGS}"
30+
LDFLAGS+=" ${SPDLOG_LDFLAGS} "
3131
AC_MSG_NOTICE([Retrieved configuration for spdlog from pkg-config])
3232
fi
3333

34+
#on the IC the incorrect build of zmq is being used despite spack. Here we explicitly set the paths using pkg-config
35+
if [[ "${no_pkgconfig}" -eq 0 ]]; then
36+
ZMQ_CFLAGS=$(pkg-config --cflags libzmq 2>&1)
37+
if [[ $(echo ${ZMQ_CFLAGS} | grep -c "not found") -eq 1 ]]; then
38+
AC_MSG_FAILURE(["Cannot find libzmq configuration with pkg-config"])
39+
fi
40+
CXXFLAGS+=" ${ZMQ_CFLAGS} "
41+
ZMQ_LDFLAGS=$(pkg-config --libs libzmq 2>&1)
42+
LDFLAGS+=" ${ZMQ_LDFLAGS} "
43+
AC_MSG_NOTICE([Retrieved configuration for libzmq from pkg-config])
44+
fi
45+
46+
3447

3548
# Check if compiling to generate a coverage report using gcov
3649
# Once built, run the tests in the install/test directory, then from the build directory run
@@ -198,7 +211,6 @@ if test "x$with_boost" != "x"; then
198211
fi
199212
AC_CHECK_HEADERS([boost/math/distributions/normal.hpp], [], [AC_MSG_ERROR(Boost library is required)])
200213

201-
202214
AC_CONFIG_HEADERS([chimbuko_config.h])
203215
AC_SUBST([PS_FLAGS])
204216

spack/repo/chimbuko/packages/chimbuko-performance-analysis/package.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class ChimbukoPerformanceAnalysis(AutotoolsPackage):
1818

1919
variant('perf-metric', default=True, description='Build with performance monitoring')
2020
variant('mpi', default=True, description='Enable building Chimbuko with MPI. If disabled the user must manually provide the rank index to the OAD.')
21-
21+
variant('pkg-config', default=True, description='Enable the configuration script to use pkg-config to aid in the configuration of dependencies')
22+
2223
depends_on('mpi', when="+mpi")
2324
depends_on('cereal')
2425
depends_on('adios2')
@@ -32,6 +33,7 @@ class ChimbukoPerformanceAnalysis(AutotoolsPackage):
3233
depends_on('automake', type='build')
3334
depends_on('libtool', type='build')
3435
depends_on('m4', type='build')
36+
depends_on('pkgconfig', when='+pkg-config', type='build')
3537

3638

3739
def setup_build_environment(self, env):
@@ -45,5 +47,8 @@ def configure_args(self):
4547
args.append('--with-perf-metric')
4648
if '+mpi' not in self.spec:
4749
args.append('--disable-mpi')
50+
if '+pkg-config' in self.spec:
51+
args.append('--with-pkg-config')
52+
4853

4954
return args

0 commit comments

Comments
 (0)