Skip to content

Commit fd322fa

Browse files
authored
Merge pull request #426 from sosy-lab/update-openSMT-to-2.8
Update OpenSMT to version 2.8.0
2 parents 00298dc + 5c3e0db commit fd322fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+13441
-216
lines changed

build/build-publish-solvers/solver-opensmt.xml

+30-25
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ SPDX-License-Identifier: Apache-2.0
3939
<echo message="Building OpenSMT in version '${opensmt.version}'"/>
4040

4141
<!-- Create build directories -->
42-
<property name="path.build" value="${opensmt.path}/build"/>
42+
<property name="path.build" value="${opensmt.path}/build"/>
4343
<property name="path.install" value="${opensmt.path}/install"/>
44-
<property name="path.source" value="${user.dir}/lib/native/source/opensmt"/>
44+
<property name="path.source" value="${user.dir}/lib/native/source/opensmt"/>
4545

4646
<mkdir dir="${path.build}"/>
4747
<mkdir dir="${path.install}"/>
@@ -71,13 +71,10 @@ SPDX-License-Identifier: Apache-2.0
7171
</exec>
7272

7373
<!-- Copy swig files to the install directory -->
74-
<copy todir="${path.install}" >
75-
<fileset dir="${path.source}" includes="**"/>
74+
<copy todir="${path.install}">
75+
<fileset dir="${path.source}" includes="swig/**/*"/>
7676
</copy>
7777

78-
<!-- Dump ${opensmt.version} to a file so that we can use it from swig -->
79-
<echo file="${path.install}/Version.h">#define VERSION "${opensmt.version}"</echo>
80-
8178
<!-- Run swig to generate java proxies and the jni wrapper -->
8279
<mkdir dir="${path.install}/java/opensmt"/>
8380
<exec executable="swig" dir="${path.install}" failonerror="true">
@@ -93,8 +90,7 @@ SPDX-License-Identifier: Apache-2.0
9390
<arg value="swig/opensmt.i"/>
9491
</exec>
9592

96-
<!-- Copy (only!) the required java files to the source tree. This should make sure that compilation fails
97-
if the OpenSMT interface changed, but the swig header wasn't updated -->
93+
<!-- Copy the generated Java classes and the c++ wrapper to the source tree -->
9894
<copy todir="${path.source}/src/org/sosy_lab/java_smt/solvers/opensmt/api">
9995
<fileset dir="${path.install}/java/opensmt">
10096
<include name="ArithLogic.java"/>
@@ -124,6 +120,13 @@ SPDX-License-Identifier: Apache-2.0
124120
<include name="VectorVectorInt.java"/>
125121
</fileset>
126122
</copy>
123+
<copy file="${path.install}/opensmt-wrap.cpp" toFile="${path.source}/opensmt-wrap.cpp"/>
124+
125+
<!-- Apply the patch to add the license headers -->
126+
<exec executable="git" failonerror="true">
127+
<arg value="apply"/>
128+
<arg value="${path.source}/swigWrapper.patch"/>
129+
</exec>
127130

128131
<!-- Package swig generated source code -->
129132
<jar destfile="opensmt-${opensmt.version}-sources.jar" basedir="${path.source}/src"/>
@@ -134,35 +137,39 @@ SPDX-License-Identifier: Apache-2.0
134137
<jar destfile="opensmt-${opensmt.version}-javadoc.jar" basedir="${path.source}/doc"/>
135138
<delete dir="${path.source}/doc"/>
136139

137-
<!-- Copy the lib to the root directory for later packaging-->
138-
<copy file="${path.install}/lib/libopensmt.so" toFile="libopensmt-${opensmt.version}.so"/>
140+
<!-- Dump ${opensmt.version} to a file so that we can use it for the swig wrapper -->
141+
<echo file="${path.source}/version.h">#define VERSION "${opensmt.version}"</echo>
139142

140-
<!-- Compile the wrapper and move the object file the source tree -->
141-
<exec executable="gcc" dir="${path.install}" failonerror="true">
143+
<!-- Compile the swig wrapper to create the library -->
144+
<exec executable="gcc" dir="${path.source}" failonerror="true">
142145
<arg value="-fPIC"/>
143-
<arg value="-std=c++17"/>
146+
<arg value="-std=c++20"/>
144147
<arg value="-o"/>
145-
<arg value="${path.source}/opensmt-wrap.o"/>
148+
<arg value="opensmt-wrap.o"/>
146149
<arg value="-c"/>
147150
<arg value="opensmt-wrap.cpp"/>
151+
<arg value="-I${path.install}/include/opensmt/"/>
148152
<arg value="-I${java.home}/include/"/>
149153
<arg value="-I${java.home}/include/linux"/>
150154
</exec>
155+
<delete file="${path.source}/version.h"/>
151156

152157
<!-- Link the wrapper and create a new lib -->
153-
<symlink link="libopensmt.so" resource="libopensmt-${opensmt.version}.so"/>
154158
<exec executable="gcc" dir="${path.source}" failonerror="true">
155159
<arg value="-shared"/>
156160
<arg value="-o"/>
157161
<arg value="${user.dir}/libopensmtjava-${opensmt.version}.so"/>
158162
<arg value="opensmt-wrap.o"/>
159-
<arg value="-L${user.dir}"/>
160-
<arg value="-lopensmt"/>
161163
<arg value="-lstdc++"/>
162-
<arg value="-l:libgmp.a"/>
164+
<arg value="-Wl,--whole-archive"/>
165+
<arg value="/dependencies/gmp-6.2.1/.libs/libgmp.a"/>
166+
<arg value="/dependencies/gmp-6.2.1/.libs/libgmpxx.a"/>
167+
<arg value="${path.install}/lib/libopensmt.a"/>
168+
<arg value="-Wl,--no-whole-archive"/>
169+
<arg value="-lm"/>
170+
<arg value="-Wl,-z,defs"/>
163171
</exec>
164-
<delete file="libopensmt.so"/>
165-
<delete file="lib/native/source/opensmt/opensmt-wrap.o"/>
172+
<delete file="${path.source}/opensmt-wrap.o"/>
166173

167174
<!-- Compile java proxies and create jar file -->
168175
<mkdir dir="${path.source}/bin"/>
@@ -171,12 +178,10 @@ SPDX-License-Identifier: Apache-2.0
171178
</javac>
172179
<jar destfile="opensmt-${opensmt.version}.jar" basedir="${path.source}/bin"/>
173180
<delete dir="${path.source}/bin"/>
174-
<delete dir="lib/native/source/opensmt/src"/>
175181
</target>
176182

177-
<target name="publish-opensmt" depends="package-opensmt, load-ivy"
178-
description="Publish OpenSMT binaries to Ivy repository.">
179-
<ivy:resolve conf="solver-opensmt" file="solvers_ivy_conf/ivy_opensmt.xml" />
183+
<target name="publish-opensmt" depends="package-opensmt, load-ivy" description="Publish OpenSMT binaries to Ivy repository.">
184+
<ivy:resolve conf="solver-opensmt" file="solvers_ivy_conf/ivy_opensmt.xml"/>
180185
<publishToRepository solverName="OpenSMT" solverVersion="${opensmt.version}"/>
181186
</target>
182187
</project>

doc/Developers-How-to-Release-into-Ivy.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,17 @@ Finally, follow the instructions shown in the message at the end.
114114

115115
### Publishing OpenSMT
116116

117-
We prefer/need to compile our own OpenSMT2 binaries and Java bindings.
117+
We prefer/need to compile our own OpenSMT2 binaries and Java bindings on Ubuntu 22.04 or later.
118118
For simple usage, we provide a Docker definition/environment under `/docker`,
119119
in which the following command can be run.
120120

121-
Download [OpenSMT](https://github.com/usi-verification-and-security/opensmt) using Git into a
122-
file of your choice. The following command patches the OpenSMT2 API, generates Java bindings
121+
Download [OpenSMT](https://github.com/usi-verification-and-security/opensmt) using Git and
122+
checkout the required version, e.g., the tag "v2.8.0".
123+
The following command patches the OpenSMT2 API, generates Java bindings
123124
with SWIG, builds the library, and packages it.
124125

125126
```
126-
ant publish-opensmt -Dopensmt.path=/workspace/opensmt -Dopensmt.customRev=2.5.2
127+
ant publish-opensmt -Dopensmt.path=/workspace/opensmt -Dopensmt.customRev=2.8.0
127128
```
128129
Then upload the binaries to the Ivy repository using SVN as described in the message on the screen.
129130

doc/Example-Maven-Project/pom.xml

+1-15
Original file line numberDiff line numberDiff line change
@@ -248,21 +248,14 @@ SPDX-License-Identifier: Apache-2.0
248248
<classifier>libyices2j</classifier>
249249
</dependency>
250250

251-
<!-- OpenSMT has three dependencies (on Linux) -->
251+
<!-- OpenSMT has two dependencies (on Linux) -->
252252
<dependency>
253253
<groupId>org.sosy-lab</groupId>
254254
<artifactId>javasmt-solver-opensmt</artifactId>
255255
<version>${opensmt.version}</version>
256256
<type>jar</type>
257257
<classifier>opensmt</classifier>
258258
</dependency>
259-
<dependency>
260-
<groupId>org.sosy-lab</groupId>
261-
<artifactId>javasmt-solver-opensmt</artifactId>
262-
<version>${opensmt.version}</version>
263-
<type>so</type>
264-
<classifier>libopensmt</classifier>
265-
</dependency>
266259
<dependency>
267260
<groupId>org.sosy-lab</groupId>
268261
<artifactId>javasmt-solver-opensmt</artifactId>
@@ -498,13 +491,6 @@ SPDX-License-Identifier: Apache-2.0
498491
<classifier>libopensmtjava</classifier>
499492
<destFileName>libopensmtjava.so</destFileName>
500493
</artifactItem>
501-
<artifactItem>
502-
<groupId>org.sosy-lab</groupId>
503-
<artifactId>javasmt-solver-opensmt</artifactId>
504-
<type>so</type>
505-
<classifier>libopensmt</classifier>
506-
<destFileName>libopensmt.so</destFileName>
507-
</artifactItem>
508494
</artifactItems>
509495
</configuration>
510496
</plugin>

doc/Example-Maven-Web-Project/pom.xml

+1-16
Original file line numberDiff line numberDiff line change
@@ -249,21 +249,14 @@ SPDX-License-Identifier: Apache-2.0
249249
<classifier>libyices2j</classifier>
250250
</dependency>
251251

252-
<!-- OpenSMT has three dependencies (on Linux) -->
252+
<!-- OpenSMT has two dependencies (on Linux) -->
253253
<dependency>
254254
<groupId>org.sosy-lab</groupId>
255255
<artifactId>javasmt-solver-opensmt</artifactId>
256256
<version>${opensmt.version}</version>
257257
<type>jar</type>
258258
<classifier>opensmt</classifier>
259259
</dependency>
260-
<dependency>
261-
<groupId>org.sosy-lab</groupId>
262-
<artifactId>javasmt-solver-opensmt</artifactId>
263-
<version>${opensmt.version}</version>
264-
<type>so</type>
265-
<classifier>libopensmt</classifier>
266-
</dependency>
267260
<dependency>
268261
<groupId>org.sosy-lab</groupId>
269262
<artifactId>javasmt-solver-opensmt</artifactId>
@@ -334,7 +327,6 @@ SPDX-License-Identifier: Apache-2.0
334327
<include>libpoly.so</include>
335328
<include>libpolyxx.so</include>
336329
<include>libyices2j.so</include>
337-
<include>libopensmt.so</include>
338330
<include>libopensmtjava.so</include>
339331
</includes>
340332
<targetPath>WEB-INF/lib</targetPath>
@@ -545,13 +537,6 @@ SPDX-License-Identifier: Apache-2.0
545537
<classifier>libopensmtjava</classifier>
546538
<destFileName>libopensmtjava.so</destFileName>
547539
</artifactItem>
548-
<artifactItem>
549-
<groupId>org.sosy-lab</groupId>
550-
<artifactId>javasmt-solver-opensmt</artifactId>
551-
<type>so</type>
552-
<classifier>libopensmt</classifier>
553-
<destFileName>libopensmt.so</destFileName>
554-
</artifactItem>
555540
</artifactItems>
556541
</configuration>
557542
</plugin>

lib/ivy.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ SPDX-License-Identifier: Apache-2.0
169169
<!-- Solver Binaries -->
170170
<dependency org="org.sosy_lab" name="javasmt-solver-mathsat" rev="5.6.11-glibc2.27" conf="runtime-mathsat->solver-mathsat" />
171171
<dependency org="org.sosy_lab" name="javasmt-solver-z3" rev="4.13.0" conf="runtime-z3->solver-z3; contrib->sources,javadoc" />
172-
<dependency org="org.sosy_lab" name="javasmt-solver-opensmt" rev="2.6.0-g2f72cc0e" conf="runtime-opensmt->solver-opensmt; contrib->sources,javadoc" />
172+
<dependency org="org.sosy_lab" name="javasmt-solver-opensmt" rev="2.8.0-ge831bf23" conf="runtime-opensmt->solver-opensmt; contrib->sources,javadoc"/>
173173
<dependency org="org.sosy_lab" name="javasmt-solver-optimathsat" rev="1.7.1-sosy0" conf="runtime-optimathsat->solver-optimathsat" />
174174
<dependency org="org.sosy_lab" name="javasmt-solver-cvc4" rev="1.8-prerelease-2020-06-24-g7825d8f28" conf="runtime-cvc4->solver-cvc4" />
175175
<dependency org="org.sosy_lab" name="javasmt-solver-cvc5" rev="1.0.5-g4cb2ab9eb" conf="runtime-cvc5->solver-cvc5" />

0 commit comments

Comments
 (0)