Saturday, August 31, 2024

Re: [update] math/z3: update to 4.13.0

31.08.2024 16:35, Klemens Nanni пишет:
> 30.08.2024 22:17, Kirill A. Korinsky пишет:
>> On Tue, 27 Aug 2024 21:59:25 +0200,
>> Klemens Nanni <kn@openbsd.org> wrote:
>>>
>>> New diff including all the feedback above, you can now hack on the port and
>>> iterate over 'make retest' until it no longer crashes (or you give up) ;-)
>>>
>>
>> Here an updated version based on yours. Changes:
>> - improved testing to use smt2 models from examples;
>
> Sounds good. Do those strictly supersede the reproducers from the issue,
> or would it make sense to run both in post-test?
>
> I also noticed that our -DZ3_ENABLE_EXAMPLE_TARGETS=ON is already the default
> and =OFF results in less targets being built without PLIST change or effect
> on your tests, so I think we can spare a few cycles and avoid building
> whatever isn't used, anyway.
>
> Plus, -DZ3_INCLUDE_GIT_HASH=OFF implies -DZ3_INCLUDE_GIT_DESCRIBE=OFF, so
> the latter can be dropped as well.
>
>> By some reason gcc produces z3 which works quite stable.
>
> Switching COMPILER makes /usr/src/lib/check_sym report removal of dynamically
> exported symbols, so a major bump to 5.0 would be in order.
>
> Good find, perhaps we can narrow it down further!
>
>> I suggest to keep it that way.
>
> For your example tests: post-test runs in the ports dir, so you should ensure
> that z3 runs somewhere, where _pbuild is allowed to dump core.
>
> update-patches regen'ed a file and update-plist added some python dir
> after we dropped the RDEP on it -- unimportant changes really, but always
> good to rerun those targets to avoid churn.
>
>
> I'll soon commit with those tweaks, unless someone objects.

Oops, update-patches churn was actually picking up SUBST_CMD changes.
To fix, I moved that into post-extract, such that it runs before patch.

I also switched to DIST_TUPLE for brevity, WRKDIST can thus be dropped, too.

> -+ SO_EXT = '.so.${LIBz3_VERSION}'
> ++ SO_EXT = '.so.4.1'

Index: Makefile
===================================================================
RCS file: /cvs/ports/math/z3/Makefile,v
diff -u -p -r1.33 Makefile
--- Makefile 6 May 2024 12:23:45 -0000 1.33
+++ Makefile 31 Aug 2024 14:03:10 -0000
@@ -1,16 +1,9 @@
COMMENT = Z3 theorem prover

-VERSION = 4.12.2
-REVISION = 1
+DIST_TUPLE = github Z3Prover z3 z3-4.13.0 .
+PKGNAME = ${DISTNAME:S/z3-//}

-GH_ACCOUNT = Z3Prover
-GH_PROJECT = z3
-GH_TAGNAME = ${GH_PROJECT}-${VERSION}
-
-DISTNAME = ${GH_TAGNAME}
-PKGNAME = ${DISTNAME:L}
-
-SHARED_LIBS = z3 4.0 # 4.10
+SHARED_LIBS = z3 5.0

CATEGORIES = math

@@ -19,25 +12,39 @@ WANTLIB += c m pthread ${COMPILER_LIBCXX
# MIT
PERMIT_PACKAGE = Yes

-# c++11
-COMPILER = base-clang ports-gcc
+# C++17, clang leads to segfaults
+# See: https://github.com/Z3Prover/z3/issues/6902
+COMPILER = ports-gcc

MODULES = devel/cmake \
lang/python

-CONFIGURE_ARGS += -DZ3_ENABLE_EXAMPLE_TARGETS=ON \
+MODPY_RUNDEP = No
+
+CONFIGURE_ARGS = -DZ3_BUILD_PYTHON_BINDINGS=ON \
+ -DZ3_ENABLE_EXAMPLE_TARGETS=OFF \
-DZ3_INCLUDE_GIT_HASH=OFF \
- -DZ3_INCLUDE_GIT_DESCRIBE=OFF \
- -DZ3_BUILD_PYTHON_BINDINGS=ON \
-DZ3_USE_LIB_GMP=OFF

DEBUG_PACKAGES = ${BUILD_PACKAGES}

-WRKDIST = ${WRKDIR}/z3-${DISTNAME}
-
-NO_TEST = Yes
-
-pre-configure:
+post-extract:
${SUBST_CMD} ${WRKSRC}/scripts/mk_util.py
+
+post-test:
+ # with clang:
+ # 4.12.2 segfaults on 1,2,3
+ # 4.13.0 segfaults on 2,3 and warns on 1
+.for _repro in \
+ '(declare-datatype)' \
+ '(declare-datatype a)' \
+ '(declare-const p Bool)'
+ -echo ${_repro:Q} | (cd ${WRKBUILD} && ./z3 -in)
+ @echo
+.endfor
+ # run example models for good measure as well
+ cd ${WRKBUILD} && \
+ find ${WRKSRC}/examples/SMT-LIB2/ -type f -name '*.smt2' \
+ -exec echo \; -print -exec ./z3 {} \;

.include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/math/z3/distinfo,v
diff -u -p -r1.14 distinfo
--- distinfo 12 Aug 2023 13:31:09 -0000 1.14
+++ distinfo 31 Aug 2024 13:54:29 -0000
@@ -1,2 +1,2 @@
-SHA256 (z3-4.12.2.tar.gz) = n1jzcQvSCUCFlRp1eRVQ9UeQPXX+fi/LNzxfA/x2G48=
-SIZE (z3-4.12.2.tar.gz) = 5401038
+SHA256 (Z3Prover-z3-z3-4.13.0.tar.gz) = AbzGHINi43u4n9JDD34zheht95FQGb0s5F3p2b2TRQI=
+SIZE (Z3Prover-z3-z3-4.13.0.tar.gz) = 5520232
Index: patches/patch-cmake_cxx_compiler_flags_overrides_cmake
===================================================================
RCS file: /cvs/ports/math/z3/patches/patch-cmake_cxx_compiler_flags_overrides_cmake,v
diff -u -p -r1.2 patch-cmake_cxx_compiler_flags_overrides_cmake
--- patches/patch-cmake_cxx_compiler_flags_overrides_cmake 11 Mar 2022 19:36:33 -0000 1.2
+++ patches/patch-cmake_cxx_compiler_flags_overrides_cmake 30 Aug 2024 21:28:52 -0000
@@ -1,3 +1,5 @@
+Removed hardcoded optimizations
+
Index: cmake/cxx_compiler_flags_overrides.cmake
--- cmake/cxx_compiler_flags_overrides.cmake.orig
+++ cmake/cxx_compiler_flags_overrides.cmake
Index: patches/patch-scripts_mk_util_py
===================================================================
RCS file: /cvs/ports/math/z3/patches/patch-scripts_mk_util_py,v
diff -u -p -r1.10 patch-scripts_mk_util_py
--- patches/patch-scripts_mk_util_py 9 Feb 2023 06:53:56 -0000 1.10
+++ patches/patch-scripts_mk_util_py 31 Aug 2024 13:58:06 -0000
@@ -1,7 +1,11 @@
+- Remove hardcoded optimizations
+- Fix .so versioning
+- use -fPIC to build shared libs on all archs
+
Index: scripts/mk_util.py
--- scripts/mk_util.py.orig
+++ scripts/mk_util.py
-@@ -2607,7 +2607,6 @@ def mk_config():
+@@ -2609,7 +2609,6 @@ def mk_config():
EXAMP_DEBUG_FLAG = '-g'
CPPFLAGS = '%s -DZ3DEBUG -D_DEBUG' % CPPFLAGS
else:
@@ -9,7 +13,7 @@ Index: scripts/mk_util.py
if GPROF:
CXXFLAGS += '-fomit-frame-pointer'
CPPFLAGS = '%s -DNDEBUG -D_EXTERNAL_RELEASE' % CPPFLAGS
-@@ -2632,7 +2631,7 @@ def mk_config():
+@@ -2634,7 +2633,7 @@ def mk_config():
SO_EXT = '.so'
SLIBFLAGS = '-shared'
elif sysname == 'OpenBSD':
@@ -18,15 +22,12 @@ Index: scripts/mk_util.py
SLIBFLAGS = '-shared'
elif sysname == 'SunOS':
SO_EXT = '.so'
-@@ -2648,9 +2647,8 @@ def mk_config():
+@@ -2650,7 +2649,7 @@ def mk_config():
LIB_EXT = '.lib'
else:
raise MKException('Unsupported platform: %s' % sysname)
- if is64():
-- if not sysname.startswith('CYGWIN') and not sysname.startswith('MSYS') and not sysname.startswith('MINGW'):
-- CXXFLAGS = '%s -fPIC' % CXXFLAGS
-+ if not sysname.startswith('CYGWIN') and not sysname.startswith('MSYS') and not sysname.startswith('MINGW'):
-+ CXXFLAGS = '%s -fPIC' % CXXFLAGS
++ if true:
+ if not sysname.startswith('CYGWIN') and not sysname.startswith('MSYS') and not sysname.startswith('MINGW'):
+ CXXFLAGS = '%s -fPIC' % CXXFLAGS
elif not LINUX_X64:
- CXXFLAGS = '%s -m32' % CXXFLAGS
- LDFLAGS = '%s -m32' % LDFLAGS
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/math/z3/pkg/PLIST,v
diff -u -p -r1.9 PLIST
--- pkg/PLIST 11 Mar 2022 19:36:33 -0000 1.9
+++ pkg/PLIST 31 Aug 2024 12:43:27 -0000
@@ -1,4 +1,4 @@
-@conflict py3-z3-solver-*
+@conflict ${MODPY_PY_PREFIX}z3-solver-*
@bin bin/z3
include/z3++.h
include/z3.h
@@ -22,6 +22,8 @@ lib/cmake/z3/Z3Targets${MODCMAKE_BUILD_S
lib/cmake/z3/Z3Targets.cmake
@lib lib/libz3.so.${LIBz3_VERSION}
lib/pkgconfig/z3.pc
+lib/python${MODPY_VERSION}/
+lib/python${MODPY_VERSION}/site-packages/
lib/python${MODPY_VERSION}/site-packages/z3/
lib/python${MODPY_VERSION}/site-packages/z3/__init__.py
lib/python${MODPY_VERSION}/site-packages/z3/z3.py

No comments:

Post a Comment