sst-core: fix linkage against ncurses, zlib, and HDF5 (#49152)
* sst-core: fix for > 14.0.0 requiring ncurses * sst-core: backport fix for curses detection * sst-core: ensure HDF5 is ignored if not specified * sst-core: HDF5 integration is via C++ * sst-core: switch to with_or_without for configure * sst-core: switch to enable_or_disable for configure * sst-core: control memory pools and debug output with variants
This commit is contained in:
parent
e3bb0d77bc
commit
fd7dcf3a3f
@ -0,0 +1,116 @@
|
||||
commit a4dbc4ae575dc9bf6f6cac42d011a1ac0d496aa8
|
||||
Author: Eric Berquist <727571+berquist@users.noreply.github.com>
|
||||
Date: 2024-07-29 09:25:13 AM (Mon, 29 Jul 2024 09:25:13 -0600)
|
||||
|
||||
ncurses detection fixes (#1110)
|
||||
|
||||
* may have ncursesw6-config but not ncurses6-config
|
||||
|
||||
* go back to hardcoded lib checks
|
||||
|
||||
* fix using --with-ncurses
|
||||
|
||||
* avoid bad default usage of AC_CHECK_LIB
|
||||
|
||||
* add curses variables to sst.conf
|
||||
|
||||
* unset CURSES_CPPFLAGS and CURSES_LIBS if they're actually wrong
|
||||
|
||||
diff --git config/sst_check_curses.m4 config/sst_check_curses.m4
|
||||
index 47699427..1dbe0dcf 100644
|
||||
--- config/sst_check_curses.m4
|
||||
+++ config/sst_check_curses.m4
|
||||
@@ -1,25 +1,34 @@
|
||||
+dnl -*- mode: autoconf; -*-
|
||||
+
|
||||
AC_DEFUN([SST_CHECK_CURSES],
|
||||
[
|
||||
sst_check_curses_happy="yes"
|
||||
|
||||
- AC_ARG_WITH([curses],
|
||||
+ AC_ARG_WITH([ncurses],
|
||||
[AS_HELP_STRING([--with-ncurses@<:@=DIR or EXEC@:>@],
|
||||
[Use ncurses library found in DIR or associated with the ncursesN-config utility specified by EXEC])])
|
||||
|
||||
- AS_IF([test "$with_curses" = "no"], [sst_check_curses_happy="no"])
|
||||
+ AS_IF([test "$with_ncurses" = "no"], [sst_check_curses_happy="no"])
|
||||
|
||||
NCURSES_CONFIG_EXE="no"
|
||||
|
||||
dnl check if user provided a specific ncursesN-config
|
||||
- AS_IF([test ! -d "$with_curses"],
|
||||
- [AS_IF([test -x "$with_curses"],
|
||||
- [NCURSES_CONFIG_EXE=$with_curses])])
|
||||
+ AS_IF([test ! -d "$with_ncurses"],
|
||||
+ [AS_IF([test -x "$with_ncurses"],
|
||||
+ [NCURSES_CONFIG_EXE=$with_ncurses])])
|
||||
|
||||
dnl test ncursesN-config
|
||||
AS_IF([test $NCURSES_CONFIG_EXE = "no"],
|
||||
- [AS_IF([test -n "$with_curses"],
|
||||
- [AC_PATH_PROGS([NCURSES_CONFIG_EXE], ["ncurses6-config" "ncurses5.4-config" "ncurses5-config"], ["no"], ["$with_curses/bin"])],
|
||||
- [AC_PATH_PROGS([NCURSES_CONFIG_EXE], ["ncurses6-config" "ncurses5.4-config" "ncurses5-config"], ["no"])])])
|
||||
+ [AS_IF([test -n "$with_ncurses"],
|
||||
+ [AC_PATH_PROGS([NCURSES_CONFIG_EXE],
|
||||
+ ["ncurses6-config" "ncursesw6-config" "ncurses5.4-config" "ncurses5-config"],
|
||||
+ ["no"], ["$with_ncurses/bin"])],
|
||||
+ [AC_PATH_PROGS([NCURSES_CONFIG_EXE],
|
||||
+ ["ncurses6-config" "ncursesw6-config" "ncurses5.4-config" "ncurses5-config"],
|
||||
+ ["no"])])])
|
||||
+
|
||||
+ AC_MSG_CHECKING([ncurses config binary exists])
|
||||
+ AC_MSG_RESULT([$NCURSES_CONFIG_EXE])
|
||||
|
||||
dnl don't continue if ncursesN-config can't be found rather than look for the
|
||||
dnl specific libraries
|
||||
@@ -44,10 +53,27 @@ AC_DEFUN([SST_CHECK_CURSES],
|
||||
CPPFLAGS="$CPPFLAGS $CURSES_CPPFLAGS"
|
||||
LDFLAGS="$LDFLAGS $CURSES_LIBS"
|
||||
|
||||
- dnl Check that the specific header exists and that the config-provided lib locations are correct.
|
||||
+ dnl Check that the specific header exists and that plausible lib
|
||||
+ dnl locations are correct.
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_CHECK_HEADER([ncurses.h], [], [sst_check_curses_happy="no"])
|
||||
- AC_SEARCH_LIBS([initscr], [$CURSES_LIBS], [], [sst_check_curses_happy="no"])
|
||||
+ dnl We cannot check that the config-provided lib names are
|
||||
+ dnl correct, since those are not available at macro expansion
|
||||
+ dnl time. This is only necessary for platforms where libs are
|
||||
+ dnl reported but are broken or don't actually exist.
|
||||
+ dnl
|
||||
+ dnl If nothing is specified for `action-if-found`, the library
|
||||
+ dnl will be added to LIBS, which is not correct for our use case.
|
||||
+ curses_check_lib_tmp=""
|
||||
+ AS_IF([test "$sst_check_curses_happy" != "no"],
|
||||
+ [AC_CHECK_LIB([ncursesw], [initscr], [curses_check_lib_tmp="ncursesw is valid"],
|
||||
+ [AC_CHECK_LIB([ncurses], [initscr], [curses_check_lib_tmp="ncurses is valid"],
|
||||
+ [AC_CHECK_LIB([curses], [initscr], [curses_check_lib_tmp="curses is valid"],
|
||||
+ [sst_check_curses_happy="no"
|
||||
+ CURSES_CPPFLAGS=""
|
||||
+ CURSES_LIBS=""
|
||||
+ ])])])
|
||||
+ ])
|
||||
AC_LANG_POP([C++])
|
||||
|
||||
CPPFLAGS="$CPPFLAGS_saved"
|
||||
@@ -63,6 +89,6 @@ AC_DEFUN([SST_CHECK_CURSES],
|
||||
AC_MSG_CHECKING([for curses library])
|
||||
AC_MSG_RESULT([$sst_check_curses_happy])
|
||||
|
||||
- AS_IF([test "$sst_check_curses_happy" = "no" -a ! -z "$with_curses" -a "$with_curses" != "no"], [$3])
|
||||
+ AS_IF([test "$sst_check_curses_happy" = "no" -a ! -z "$with_ncurses" -a "$with_ncurses" != "no"], [$3])
|
||||
AS_IF([test "$sst_check_curses_happy" = "yes"], [$1], [$2])
|
||||
])
|
||||
diff --git src/sst/sst.conf src/sst/sst.conf
|
||||
index 13adb002..c30afb0b 100644
|
||||
--- src/sst/sst.conf
|
||||
+++ src/sst/sst.conf
|
||||
@@ -30,6 +30,8 @@ PYTHON_VERSION3=@PYTHON_VERSION3@
|
||||
LIBZ_CPPFLAGS=@LIBZ_CPPFLAGS@
|
||||
LIBZ_LDFLAGS=@LIBZ_LDFLAGS@
|
||||
LIBZ_LIBS=@LIBZ_LIBS@
|
||||
+CURSES_CPPFLAGS=@CURSES_CPPFLAGS@
|
||||
+CURSES_LIBS=@CURSES_LIBS@
|
||||
ELEMENT_CXXFLAGS=@SST_EXPORT_CXXFLAGS@ @SST_ELEMENT_FPIC_FLAGS@ -DHAVE_CONFIG_H -I@prefix@/include
|
||||
ELEMENT_LDFLAGS=-shared -fno-common -Wl,-undefined -Wl,dynamic_lookup
|
||||
pkgconfig=@prefix@/lib/pkgconfig/SST-@PACKAGE_VERSION@.pc
|
@ -61,10 +61,16 @@ class SstCore(AutotoolsPackage):
|
||||
variant(
|
||||
"curses",
|
||||
default=True,
|
||||
when="@develop,master",
|
||||
when="@develop,master,14.0.0:",
|
||||
description="Build support for interactive sst-info",
|
||||
)
|
||||
|
||||
variant("mempools", default=True, description="Use memory pools")
|
||||
variant(
|
||||
"debug",
|
||||
default=False,
|
||||
description="Enable additional debug output from core and components",
|
||||
)
|
||||
variant("trackevents", default=False, description="Enable event and activity tracking")
|
||||
variant(
|
||||
"trackperf",
|
||||
@ -77,37 +83,44 @@ class SstCore(AutotoolsPackage):
|
||||
depends_on("python@:3.11", type=("build", "run", "link"))
|
||||
depends_on("mpi", when="+pdes_mpi")
|
||||
depends_on("zoltan", when="+zoltan")
|
||||
depends_on("hdf5", when="+hdf5")
|
||||
depends_on("hdf5 +cxx", when="+hdf5")
|
||||
depends_on("zlib-api", when="+zlib")
|
||||
depends_on("gettext")
|
||||
depends_on("ncurses", when="+curses")
|
||||
depends_on("ncurses", when="+curses", type=("build", "link"))
|
||||
|
||||
for version_name in ("master", "develop"):
|
||||
depends_on("autoconf@1.68:", type="build", when="@{}".format(version_name))
|
||||
depends_on("automake@1.11.1:", type="build", when="@{}".format(version_name))
|
||||
depends_on("libtool@1.2.4:", type="build", when="@{}".format(version_name))
|
||||
depends_on("m4", type="build", when="@{}".format(version_name))
|
||||
with when("@develop,master,14.0.0"):
|
||||
depends_on("autoconf@1.68:", type="build")
|
||||
depends_on("automake@1.11.1:", type="build")
|
||||
depends_on("libtool@1.2.4:", type="build")
|
||||
depends_on("m4", type="build")
|
||||
|
||||
# Backport of https://github.com/sstsimulator/sst-core/pull/1110
|
||||
with when("@14.0.0"):
|
||||
patch("1110-ncurses_detection.patch", level=0)
|
||||
|
||||
# force out-of-source builds
|
||||
build_directory = "spack-build"
|
||||
|
||||
@when("@develop,master")
|
||||
# 14.0.0 could theoretically be avoided here, but introducing the patch
|
||||
# (even with autogen changes) causes file created/modified time problems
|
||||
# that cannot be easily circumvented with `touch`.
|
||||
@when("@develop,master,14.0.0")
|
||||
def autoreconf(self, spec, prefix):
|
||||
bash = which("bash")
|
||||
bash("autogen.sh")
|
||||
|
||||
def configure_args(self):
|
||||
args = []
|
||||
if "+zoltan" in self.spec:
|
||||
args.append("--with-zoltan=%s" % self.spec["zoltan"].prefix)
|
||||
if "+hdf5" in self.spec:
|
||||
args.append("--with-hdf5=%s" % self.spec["hdf5"].prefix)
|
||||
if "+zlib" in self.spec:
|
||||
args.append("--with-zlib=%s" % self.spec["zlib-api"].prefix)
|
||||
if "+curses" in self.spec:
|
||||
args.append("--with-curses={}".format(self.spec["ncurses"].prefix))
|
||||
args.extend(self.with_or_without("zoltan", activation_value="prefix"))
|
||||
args.extend(self.with_or_without("hdf5", activation_value="prefix"))
|
||||
args.extend(
|
||||
self.with_or_without(
|
||||
"libz", activation_value=lambda _: self.spec["zlib-api"].prefix, variant="zlib"
|
||||
)
|
||||
)
|
||||
args.extend(self.with_or_without("ncurses", activation_value="prefix", variant="curses"))
|
||||
|
||||
if "+pdes_mpi" in self.spec:
|
||||
if self.spec.satisfies("+pdes_mpi"):
|
||||
args.append("--enable-mpi")
|
||||
env["CC"] = self.spec["mpi"].mpicc
|
||||
env["CXX"] = self.spec["mpi"].mpicxx
|
||||
@ -116,16 +129,15 @@ def configure_args(self):
|
||||
else:
|
||||
args.append("--disable-mpi")
|
||||
|
||||
if "+trackevents" in self.spec:
|
||||
args.append("--enable-event-tracking")
|
||||
if "+trackperf" in self.spec:
|
||||
args.append("--enable-perf-tracking")
|
||||
if "+preview" in self.spec:
|
||||
args.append("--enable-preview-build")
|
||||
if "+profile" in self.spec:
|
||||
args.append("--enable-profile")
|
||||
args.extend(self.enable_or_disable("mem-pools", variant="mempools"))
|
||||
args.extend(self.enable_or_disable("debug"))
|
||||
args.extend(self.enable_or_disable("event-tracking", variant="trackevents"))
|
||||
args.extend(self.enable_or_disable("perf-tracking", variant="trackperf"))
|
||||
args.extend(self.enable_or_disable("preview-build", variant="preview"))
|
||||
args.extend(self.enable_or_disable("profile"))
|
||||
|
||||
args.append("--with-python=%s" % self.spec["python"].prefix)
|
||||
# Required, so no need for with_or_without
|
||||
args.append(f"--with-python={self.spec['python'].prefix}")
|
||||
return args
|
||||
|
||||
def patch(self):
|
||||
|
Loading…
Reference in New Issue
Block a user