Skip to content

Bump mpsolve to 3.2.2 #3946

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions M2/cmake/build-libraries.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -517,13 +517,13 @@ _ADD_COMPONENT_DEPENDENCY(programs msolve "gmp;mpfr;flint" MSOLVE_FOUND)
# https://numpi.dm.unipi.it/software/mpsolve
# Known issue: tests don't work with static library
ExternalProject_Add(build-mpsolve
URL ${M2_SOURCE_URL}/mpsolve-3.2.1.tar.gz
URL_HASH SHA256=3d11428ae9ab2e020f24cabfbcd9e4d9b22ec572cf70af0d44fe8dae1d51e78e
URL https://numpi.dm.unipi.it/wp-content/uploads/2025/03/mpsolve-3.2.2.tgz
URL_HASH SHA256=c951b37ad0bf0761da495544453ac470e6d716a208577599d78ce6f0bfd30317
PREFIX libraries/mpsolve
SOURCE_DIR libraries/mpsolve/build
DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/BUILD/tarfiles
BUILD_IN_SOURCE ON
PATCH_COMMAND patch --batch -p1 < ${CMAKE_SOURCE_DIR}/libraries/mpsolve/patch-3.2.1
PATCH_COMMAND patch --batch -p1 < ${CMAKE_SOURCE_DIR}/libraries/mpsolve/patch-3.2.2
CONFIGURE_COMMAND autoreconf -vif
COMMAND ${CONFIGURE} --prefix=${M2_HOST_PREFIX}
#-C --cache-file=${CONFIGURE_CACHE}
Expand Down
7 changes: 3 additions & 4 deletions M2/libraries/mpsolve/Makefile.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
VPATH = @srcdir@
HOMEPAGE = https://numpi.dm.unipi.it/software/mpsolve
VERSION = 3.2.1
URL = https://macaulay2.com/Downloads/OtherSourceCode
VERSION = 3.2.2
TARFILE = $(LIBNAME)-$(VERSION).tgz
URL = https://numpi.dm.unipi.it/wp-content/uploads/2025/03

# obtained from https://numpi.dm.unipi.it/_media/software/mpsolve
# https://numpi.dm.unipi.it/_media/software/mpsolve/mpsolve-3.2.1.tar.gz

# the patch disables the python tests, which don't know that the name of the
# sharable library in Mac OS is libmps.3.dylib instead of libmps.so.3
PATCHFILE = @abs_srcdir@/patch-$(VERSION)

LICENSEFILES = README
Expand Down
66 changes: 66 additions & 0 deletions M2/libraries/mpsolve/patch-3.2.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
From 260432c9d1002261f60159d0520af7862d4471ed Mon Sep 17 00:00:00 2001
From: Doug Torrance <dtorrance@piedmont.edu>
Date: Fri, 8 Aug 2025 14:05:58 -0400
Subject: [PATCH] Include cmath in C++ before defining isnan macro

Otherwise we get the following compile error in macOS:

/Applications/Xcode_15.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/cmath:587:17: error: expected unqualified-id
return std::isnan(__lcpp_x);
^
../../include/mps/types.h:27:3: note: expanded from macro 'isnan'
(sizeof(x) == sizeof(long double) ? isnan_ld (x) \
^
---
include/mps/types.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

From 449d608b360fea0056049d7f8e874ea022fadab5 Mon Sep 17 00:00:00 2001
From: Doug Torrance <dtorrance@piedmont.edu>
Date: Sat, 9 Aug 2025 09:49:08 -0400
Subject: [PATCH] Use CPPFLAGS instead of CFLAGS for specifying header
directories

CPPFLAGS appear before CFLAGS, so if the user passes some directories
manually using CPPFLAGS, they will appear first. This is a problem if
these directories contain older versions of the mpsolve headers. We
want to ensure that the current versions are found first.
---
src/mpsolve/Makefile.am | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

--- a/include/mps/types.h
+++ mpsolve-3.2.2/include/mps/types.h
@@ -21,7 +21,11 @@ typedef bool mps_boolean;
typedef int mps_debug_level;

/* Handle systems where isnan and isinf are not available */
-#include <math.h>
+#ifdef __cplusplus
+ #include <cmath>
+#else
+ #include <math.h>
+#endif
#ifndef isnan
# define isnan(x) \
(sizeof(x) == sizeof(long double) ? isnan_ld (x) \
--- a/src/mpsolve/Makefile.am
+++ mpsolve-3.2.2/src/mpsolve/Makefile.am
@@ -6,10 +6,12 @@ man_MANS = ${builddir}/mpsolve.1

EXTRA_DIST = mpsolve.1

-mpsolve_CFLAGS = \
+mpsolve_CPPFLAGS = \
-I${top_srcdir}/include \
-I. \
- -I${top_builddir}/include \
+ -I${top_builddir}/include
+
+mpsolve_CFLAGS = \
$(GMP_CFLAGS) \
$(GTK_CFLAGS) \
$(PTHREAD_CFLAGS) \
--
2.43.0