Skip to content

Commit 5d2fb43

Browse files
authored
Yices macos arm (#153)
* Yices macos-arm build * Update Yices macos build docs * Upgrade version to 0.5.20
1 parent fa2a997 commit 5d2fb43

File tree

9 files changed

+109
-12
lines changed

9 files changed

+109
-12
lines changed

Diff for: README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Get the most out of SMT solving with KSMT features:
1111
* Streamlined [solver delivery](#ksmt-distribution) with no need for building a solver or implementing JVM bindings
1212

1313
[![KSMT: build](https://github.com/UnitTestBot/ksmt/actions/workflows/build-and-run-tests.yml/badge.svg)](https://github.com/UnitTestBot/ksmt/actions/workflows/build-and-run-tests.yml)
14-
[![Maven Central](https://img.shields.io/maven-central/v/io.ksmt/ksmt-core)](https://central.sonatype.com/artifact/io.ksmt/ksmt-core/0.5.19)
14+
[![Maven Central](https://img.shields.io/maven-central/v/io.ksmt/ksmt-core)](https://central.sonatype.com/artifact/io.ksmt/ksmt-core/0.5.20)
1515
[![javadoc](https://javadoc.io/badge2/io.ksmt/ksmt-core/javadoc.svg)](https://javadoc.io/doc/io.ksmt/ksmt-core)
1616

1717
## Get started
@@ -20,9 +20,9 @@ To start using KSMT, install it via [Gradle](https://gradle.org/):
2020

2121
```kotlin
2222
// core
23-
implementation("io.ksmt:ksmt-core:0.5.19")
23+
implementation("io.ksmt:ksmt-core:0.5.20")
2424
// z3 solver
25-
implementation("io.ksmt:ksmt-z3:0.5.19")
25+
implementation("io.ksmt:ksmt-z3:0.5.20")
2626
```
2727

2828
Find basic instructions in the [Getting started](docs/getting-started.md) guide and try it out with the

Diff for: buildSrc/src/main/kotlin/io.ksmt.ksmt-base.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ plugins {
1111
}
1212

1313
group = "io.ksmt"
14-
version = "0.5.19"
14+
version = "0.5.20"
1515

1616
repositories {
1717
mavenCentral()

Diff for: docs/getting-started.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ repositories {
3434
```kotlin
3535
dependencies {
3636
// core
37-
implementation("io.ksmt:ksmt-core:0.5.19")
37+
implementation("io.ksmt:ksmt-core:0.5.20")
3838
}
3939
```
4040

@@ -43,9 +43,9 @@ dependencies {
4343
```kotlin
4444
dependencies {
4545
// z3
46-
implementation("io.ksmt:ksmt-z3:0.5.19")
46+
implementation("io.ksmt:ksmt-z3:0.5.20")
4747
// bitwuzla
48-
implementation("io.ksmt:ksmt-bitwuzla:0.5.19")
48+
implementation("io.ksmt:ksmt-bitwuzla:0.5.20")
4949
}
5050
```
5151

Diff for: examples/build.gradle.kts

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ repositories {
99

1010
dependencies {
1111
// core
12-
implementation("io.ksmt:ksmt-core:0.5.19")
12+
implementation("io.ksmt:ksmt-core:0.5.20")
1313
// z3 solver
14-
implementation("io.ksmt:ksmt-z3:0.5.19")
14+
implementation("io.ksmt:ksmt-z3:0.5.20")
1515
// Runner and portfolio solver
16-
implementation("io.ksmt:ksmt-runner:0.5.19")
16+
implementation("io.ksmt:ksmt-runner:0.5.20")
1717
}
1818

1919
java {

Diff for: ksmt-yices/bindings-native/macos_build.sh

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
YICES_VERSION="2.6.4"
2+
3+
export MACOSX_DEPLOYMENT_TARGET=11.1
4+
#apt-get install -y openjdk-8-jdk
5+
#omp install openjdk11
6+
7+
export CC=oa64-clang
8+
export CXX=oa64-clang++
9+
10+
JAVAC="/usr/bin/javac"
11+
JAVA_HOME="/usr/local/osxcross/macports/pkgs/opt/local/Library/Java/JavaVirtualMachines/openjdk11/Contents/Home"
12+
CPPFLAGS="-I $JAVA_HOME/include -I $JAVA_HOME/include/darwin -I $(realpath ../dist-mac/include) -I $(realpath ../libgmp/dist/include)"
13+
CXXFLAGS="-fpermissive -g -fPIC -O3 -stdlib=libc++"
14+
export LIBS="$(realpath ../libgmp/dist/lib/libgmp.a) $(realpath ../dist-mac/lib/libyices.2.dylib)"
15+
export LDFLAGS="-L$(realpath ../libgmp/dist/lib) -L$(realpath ../dist-mac/lib/)"
16+
17+
YICES_2_JAVA_LIB_NAME="libyices2java.dylib"
18+
19+
rm -rf yices2_java_bindings
20+
21+
# https://github.com/SRI-CSL/yices2_java_bindings/commit/d9858e540425072443830d2638db5ffdc8c92cd1
22+
git clone https://github.com/SRI-CSL/yices2_java_bindings
23+
cd yices2_java_bindings
24+
git checkout d9858e5
25+
26+
#
27+
# Patch description
28+
#
29+
# Bindings native part:
30+
# 1. Fix cardinality check in `expand function`.
31+
# 2. Provide methods to extract values of product/sum components
32+
#
33+
# Bindings java part:
34+
# 1. Add the corresponding methods and classes to interact
35+
# with native product/sum value extraction methods
36+
# 2. Disable default native library load
37+
#
38+
git apply ../yices-bindings-patch.patch
39+
40+
41+
rm -rf build
42+
mkdir build
43+
cd build
44+
45+
cp ../src/main/java/com/sri/yices/yicesJNI.cpp .
46+
47+
$JAVAC -h . ../src/main/java/com/sri/yices/*.java
48+
49+
$CXX $LD_STATIC_FLAGS $CPPFLAGS $CXXFLAGS -c yicesJNI.cpp
50+
51+
$CXX $LD_STATIC_FLAGS $LDFLAGS -s -shared -o $YICES_2_JAVA_LIB_NAME yicesJNI.o $LIBS
52+
53+
cp $YICES_2_JAVA_LIB_NAME ../../

Diff for: ksmt-yices/bindings-native/yices-bindings-patch.patch

+12-2
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,19 @@ Subject: [PATCH 5/7] Minor change
529529
1 file changed, 4 insertions(+)
530530

531531
diff --git a/src/main/java/com/sri/yices/YVal.java b/src/main/java/com/sri/yices/YVal.java
532-
index 574ba57..1509541 100644
532+
index 574ba57..8daa156 100644
533533
--- a/src/main/java/com/sri/yices/YVal.java
534534
+++ b/src/main/java/com/sri/yices/YVal.java
535-
@@ -27,4 +27,8 @@ public String toString(){
535+
@@ -7,7 +7,7 @@ package com.sri.yices;
536+
* yices_get_value evaluates a term and returns a node descriptor from
537+
* which the term value can be constructed.
538+
* Within a model, each node has an integer identifier and a tag that
539+
- * specifies the node’s type. All DAG-exploration functions store this
540+
+ * specifies the nodes type. All DAG-exploration functions store this
541+
* information in records of type YVal.
542+
*
543+
* I see no reason to make it anything more than a glorified C-struct.
544+
@@ -27,4 +27,8 @@ public class YVal {
536545
return String.format("<%s: %d>", tag, id);
537546
}
538547

@@ -542,6 +551,7 @@ index 574ba57..1509541 100644
542551
+ }
543552
}
544553

554+
545555
From dc29fd6c861384a3cc32eadd7cdc716b914a2efe Mon Sep 17 00:00:00 2001
546556
From: Pavel Balay <[email protected]>
547557
Date: Mon, 6 Feb 2023 02:53:12 +0300

Diff for: ksmt-yices/dist/macos/build.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#apt-get install -y autoconf gperf
2+
3+
export CC=oa64-clang
4+
export CXX=oa64-clang++
5+
6+
autoconf
7+
8+
export CFLAGS="-O3"
9+
export CXXFLAGS="-O3"
10+
export CPPFLAGS="-I$(realpath libgmp/dist/include)"
11+
export LIBS=$(realpath libgmp/dist/lib/libgmp.a)
12+
export LDFLAGS="-L$(realpath libgmp/dist/lib)"
13+
14+
./configure --enable-thread-safety --disable-mcsat --host=arm64-apple-darwin20.2 \
15+
--prefix=$(realpath dist-mac) \
16+
--with-pic-gmp=$(realpath libgmp/dist/lib/libgmp.a) \
17+
--with-pic-gmp-include-dir=$(realpath libgmp/dist/include)
18+
19+
make MODE=release ARCH=arm64-apple-darwin20.2 POSIXOS=darwin show-details dist install
20+
21+
llvm-install-name-tool-14 -id libyices.2.dylib dist-mac/lib/libyices.2.dylib

Diff for: ksmt-yices/dist/macos/libgmp_build.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#wget https://ftp.gnu.org/gnu/gmp/gmp-6.3.0.tar.xz && tar Jxf gmp-6.3.0.tar.xz
2+
cd gmp-6.3.0
3+
4+
export CC=oa64-clang
5+
export CXX=oa64-clang++
6+
export CFLAGS="-O3"
7+
export CXXFLAGS="-O3"
8+
9+
./configure --host=arm64-apple-darwin20.2 --prefix=$(realpath ../dist) \
10+
--enable-static=yes --enable-shared=no --enable-cxx --with-pic
11+
12+
make -j$(nproc)
13+
make install

Diff for: ksmt-yices/dist/yices-native-osx-arm64-0.0.zip

18.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)