Skip to content
Merged
Show file tree
Hide file tree
Changes from 113 commits
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
93fd470
Bitwuzla: Added SWIG file to autogenerate JNI bindings and switched t…
daniel-raffler Jan 23, 2024
68c9b64
Re-enabled dumpFormula in BitwuzlaFormulaManager.
daniel-raffler Jan 23, 2024
b3e6ea3
Merge remote-tracking branch 'origin/add_bitwuzla' into add_bitwuzla_…
daniel-raffler Jan 23, 2024
24a072a
Downgrade to local C++ build of Bitwuzla.
daniel-raffler Jan 23, 2024
573b6d2
Fixed includes in bitwuzla.i
daniel-raffler Jan 23, 2024
3671f10
Added bitwuzla_wrap.cpp to .gitignore
daniel-raffler Jan 23, 2024
5f485ba
Fixed a bug in BitwuzlaTheoremProver.getUnsatCore()
daniel-raffler Jan 23, 2024
44d4996
Improved error messages in BitwuzlaFormulaManager.parse()
daniel-raffler Jan 23, 2024
0a2431d
Fixed formating.
daniel-raffler Jan 23, 2024
72772bb
Fixed term substitution.
daniel-raffler Jan 23, 2024
992cbe4
Removed special case for BV_ZERO_EXTEND in BitwuzlaFormulaCreator.cal…
daniel-raffler Jan 23, 2024
bebae05
Added termination hook.
daniel-raffler Jan 24, 2024
bd3c009
Removed duplicate %include from bitwuzla.i
daniel-raffler Jan 24, 2024
33a328a
Added default exception handler to the swig script.
daniel-raffler Jan 24, 2024
b5d65f4
Make sure that rationals are supported in test rationalToFpMinusOne f…
daniel-raffler Jan 24, 2024
9fbbacd
Fixed solver option description.
daniel-raffler Jan 24, 2024
a3146e4
Fixed handling of ProverOptions.Generate_MODELS
daniel-raffler Jan 24, 2024
8f0ab73
Merge remote-tracking branch 'origin/add_bitwuzla' into add_bitwuzla_…
daniel-raffler Jan 25, 2024
67043df
Fixed the last merge.
daniel-raffler Jan 25, 2024
7945be0
Bitwuzla: Added support for floating point values in the model.
daniel-raffler Jan 25, 2024
aac0ffb
Bitwuzla: Re-enabled floating point tests.
daniel-raffler Jan 25, 2024
126109c
Bitwuzla: Rewrote Term.to_fp() to return a string as value. This allo…
daniel-raffler Jan 29, 2024
e848771
Bitwuzla: Fixed handling of negative zero in the JNI bindings.
daniel-raffler Jan 29, 2024
e7c09f6
Bitwuzla: Fixed bug in Term.to_fp() that affected the handling of 'In…
daniel-raffler Jan 29, 2024
0eac793
Bitwuzla: Clear mpf in mk_fp_value.
daniel-raffler Jan 29, 2024
de2258e
Bitwuzla does not seem to support casting float to bitvector. Disable…
daniel-raffler Jan 30, 2024
9d3508b
Clean up bitwuzla_wrap.h in the build script.
daniel-raffler Jan 30, 2024
93cc3c0
Added patch to disable finalizers in the swig generated code. This pr…
daniel-raffler Jan 30, 2024
624a4f0
Fix value type for bitvectors.
daniel-raffler Jan 30, 2024
334ba39
Disabled one more test for Bitwuzla as it requires casting form float…
daniel-raffler Jan 30, 2024
eb326fc
Added bitwuzla_wrap.h to gitignore.
daniel-raffler Jan 30, 2024
3303561
Added sources and javadoc to the distribution.
daniel-raffler Jan 30, 2024
0b3ce9b
Added checks in BitwuzlaTheoremProver.
daniel-raffler Feb 2, 2024
813128d
Update Bitwuzla to 0.3.2
daniel-raffler Feb 2, 2024
edf2ad5
Implemented toIeeeBitvector for BitwuzlaFloatingPointManager by using…
daniel-raffler Feb 2, 2024
2df6010
Reduce the number of test runs in FloatingPointFormulaManagerTest.che…
daniel-raffler Feb 2, 2024
74b0e3f
Added -0.0 to the list of test values in FloatingPointFormulaManagerT…
daniel-raffler Feb 2, 2024
f9be507
Fixed handling of negative numbers in JNI method to_fp().
daniel-raffler Feb 2, 2024
4c6cc93
Drop "e" part when printing a float with exponent 0 in to_fp().
daniel-raffler Feb 6, 2024
93956e7
Bitwuzla: Use named variables in toIeeeBitvector as CPAchecker can't …
daniel-raffler Feb 6, 2024
3121a58
Bitwuzla: Made fp cast map in BitwuzlaFormulaCreator static as the so…
daniel-raffler Feb 6, 2024
7b311bd
Bitwuzla: Added special handling of NaN in toIeeeBitvectorImpl.
daniel-raffler Feb 6, 2024
31ae390
Bitwuzla: Fixed dumpFormula in BitwuzlaFormulaManager. We need to add…
daniel-raffler Feb 6, 2024
528f067
Bitwuzla: Fixed formating.
daniel-raffler Feb 6, 2024
9e36ffb
Bitwuzla: Store Terminator callback as a member in BitwuzlaTheoremPro…
daniel-raffler Feb 6, 2024
ee94c0e
Bugfix for negate() in BitwuzlaBitvectorFormulaManager: We need to ne…
daniel-raffler Feb 6, 2024
fc85356
Bitwuzla: Fixed handling of NaN in toIeeeBitvectorImpl.
daniel-raffler Feb 6, 2024
ce8fe23
Merge remote-tracking branch 'origin/master' into add_bitwuzla_swig_cpp
daniel-raffler Feb 7, 2024
a7fdfd7
Bitwuzla: Added support for the new FloatingPointNumber class in Bitw…
daniel-raffler Feb 7, 2024
e290497
Bitwuzla: Disabled a test in SolverConcurrencyTest as Bitwuzla does n…
daniel-raffler Feb 7, 2024
edf94e5
Bitwuzla: Fixed handling of (set-logic ..) at the start of an input f…
daniel-raffler Feb 7, 2024
01e8224
Bitwuzla: Fixed printing of bv and float values as bit strings.
daniel-raffler Feb 7, 2024
dd9ee48
Bitwuzla: Fixed parsing of strings with multiple assertions in Bitwuz…
daniel-raffler Feb 7, 2024
b9809f9
Bitwuzla: Removed proxy class for bitwuzla.Exception from the JNI bin…
daniel-raffler Feb 8, 2024
860a731
Bitwuzla: Updated swig script for the new parser class.
daniel-raffler Feb 8, 2024
a10b1b3
Bitwuzla: Fixed some clean up issues in the solver build script.
daniel-raffler Feb 8, 2024
bd7b287
Updated Bitwuzla version. This new release fixes some issues we've ha…
daniel-raffler Feb 8, 2024
5916a2e
Bitwuzla: Updated native solver tests.
daniel-raffler Feb 8, 2024
bdf0313
Bitwuzla: Rewrote parse() in BitwuzlaFormulaManager for the new parse…
daniel-raffler Feb 8, 2024
4f063cb
Fixed checkstyle issues.
daniel-raffler Feb 9, 2024
59865e0
Moved clean up for bitwuzla build to clean in build.xml. This makes i…
daniel-raffler Feb 28, 2024
2c85acc
Updated Bitwuzla. The new version supports a TermManager and no longe…
daniel-raffler Feb 28, 2024
6b98093
Blacklisted Bitwuzla in SolverThreadLocalityTest.wrongContextTest as …
daniel-raffler Feb 28, 2024
89420eb
(Temporarily) fixed failing tests by using a shared TermManager for a…
daniel-raffler Feb 28, 2024
472891b
Fixed formatting.
daniel-raffler Feb 28, 2024
dc51ce2
Merge remote-tracking branch 'origin/master' into add_bitwuzla_swig_cpp
daniel-raffler Feb 28, 2024
680e75b
Bitwuzla: Updated phantomReferences patch to include the new class Te…
daniel-raffler Feb 28, 2024
6deda76
Revert "Bitwuzla: Made fp cast map in BitwuzlaFormulaCreator static a…
daniel-raffler Feb 28, 2024
4087901
Revert "(Temporarily) fixed failing tests by using a shared TermManag…
daniel-raffler Feb 28, 2024
14a6dc8
Reduced phantomReferences patch. We still need to disable finalizers …
daniel-raffler Feb 28, 2024
af60de3
Bitwuzla: Re-enabled concurrency tests for Bitwuzla.
daniel-raffler Feb 28, 2024
3e5d5df
Bitwuzla: Removed method parse_fp_value from the Swig script. We're n…
daniel-raffler Mar 1, 2024
0244742
Bitwuzla: Update to release 0.4.0
daniel-raffler Mar 9, 2024
f39d450
Bitwuzla: Remove old build files before recompiling bitwuzla source.
daniel-raffler Mar 9, 2024
e6d705d
Bitwuzla: Update Bitwuzla to the latest git commit. The new version i…
daniel-raffler Mar 14, 2024
b4a347e
Bitwuzla: Updated BitwuzlaFormulaManager.parse to use the new method …
daniel-raffler Mar 14, 2024
dbe1dce
Bitwuzla: Enabled tests that were blocked by the missing parser featu…
daniel-raffler Mar 14, 2024
f71a7be
Bitwuzla: Enabled 2 more tests that were blocked by missing features …
daniel-raffler Mar 14, 2024
77781cc
Bitwuzla: Fixed handling of quoted symbols in the parser.
daniel-raffler Mar 14, 2024
4c223cb
Bitwuzla: Fixed formating.
daniel-raffler Mar 14, 2024
e0a70f6
Merged master into add_bitwuzla_swig
daniel-raffler Apr 3, 2024
6137a95
Bitwuzla: Added a case for Kind.BV_SMOD in BitwuzlaFormulaCreator.get…
daniel-raffler Apr 3, 2024
658a3de
Bitwuzla: Added missing methods to BitwuzlaFloatingPointManager.
daniel-raffler Apr 3, 2024
4b2f4e1
Bitwuzla: Add native Bitwuzla support for rotate by constant in Bitwu…
daniel-raffler Apr 3, 2024
cbe27b6
Bitwuzla: Removed unused file and cleaned up some of the changes from…
daniel-raffler Apr 3, 2024
3ba8af9
Merge branch 'refs/heads/master' into add_bitwuzla_swig
daniel-raffler Apr 9, 2024
4bf6a71
Bitwuzla: Restored changes that were lost in the merge.
daniel-raffler Apr 9, 2024
53cf8c9
Bitwuzla: Fixed the build script and updated the git version.
daniel-raffler Apr 9, 2024
9acfed2
Bitwuzla: Added new method for constant array creation to BitwuzlaArr…
daniel-raffler Apr 9, 2024
b0feace
Bitwuzla: Restored changed to FormulaClassifierTest from 3372315caa47…
daniel-raffler Apr 9, 2024
4066a3e
Bitwuzla: Add requireInteger() checks to tests that need them. Bitwuz…
daniel-raffler Apr 9, 2024
8a50a25
Bitwuzla: Restored checkVariableIsDeclared in SolverFormulaIOTest. Bi…
daniel-raffler Apr 9, 2024
49f26aa
Bitwuzla: Cleaned up some unnecessary changes.
daniel-raffler Apr 9, 2024
c3d65dd
Bitwuzla: Fixed format.
daniel-raffler Apr 9, 2024
c9ea122
Bitwuzla: Fixed some checkstyle issues.
daniel-raffler Apr 9, 2024
49c6bc6
Switch to current Bitwuzla dev version
baierd Apr 9, 2024
54e90b9
Format
baierd Apr 9, 2024
c32a817
Add support for SMTLIB2 comments to parse() for Bitwuzla
baierd Apr 9, 2024
1516d6e
Fix Java version when building bitwuzla script based jar
baierd Apr 9, 2024
5d1d85a
Disable tests that translate int formulas to SMTLIB2 and try to parse…
baierd Apr 9, 2024
5023509
Improve ressource handling of Bitwuzla model
baierd Apr 9, 2024
3ae7860
Bitwuzla: Use -release=11 when building the jar to also specify the l…
daniel-raffler Apr 9, 2024
566363d
Bitwuzla: Add an option -Dbitwuzla.rebuildWrapper=on to the build scr…
daniel-raffler Apr 9, 2024
10c62f8
Bitwuzla: Added auto-generated wrapper files to the repository.
daniel-raffler Apr 9, 2024
961a4ef
Bitwuzla: Fixed test parseDeclareRedundantBv for MathSAT5 by using a …
daniel-raffler Apr 9, 2024
0df9aca
Bitwuzla: Fixed the build script.
daniel-raffler Apr 9, 2024
c1a256e
Bitwuzla: Removed unnecessary dependency on libgmp while building lib…
daniel-raffler Apr 9, 2024
6449569
Change Bitwuzla build script so that the JNI lib is patchelfed before…
baierd Apr 10, 2024
1d86ad2
Switch to correctly compiled version of Bitwuzla 0.4.0 commit 954bcfb…
baierd Apr 10, 2024
71a6808
Bitwuzla: Re-enabled test bvOutOfRange as it works with Bitwuzla now.
daniel-raffler Apr 10, 2024
52e09ae
Bitwuzla: Run patchelf twice on libbitwuzlaJNI to resolve the depende…
daniel-raffler Apr 10, 2024
a569f47
Use non-dev version for Biwuzla 0.4.0-g954bcfb0
baierd Apr 11, 2024
807da40
Merge branch 'daniel-raffler-add_bitwuzla_swig' into bitwuzla_updates
baierd Apr 11, 2024
2cd624d
Make gitignore more general
baierd Apr 11, 2024
698c73c
Some small improvements in the code and comments of Bitwuzla
baierd Apr 11, 2024
371e786
Use the initial symbol name + a prefix for Fp to IEEE BV transformati…
baierd Apr 11, 2024
3ef4a9e
Make Term given to BitwuzlaFormula final
baierd Apr 11, 2024
b242838
Simplify parsing in Bitwuzla a little and correctly remove (set-logic…
baierd Apr 11, 2024
181d750
Add a test for comments and logic settings in parse tests (As this is…
baierd Apr 11, 2024
b979f74
Fix comments and logic settings in parsing for OpenSMT2
baierd Apr 11, 2024
78ee2ea
Clean up BitwuzlaNativeApiTest
baierd Apr 11, 2024
bfeae7f
Use suppression of warning instead of annotation in BitwuzlaNativeApi…
baierd Apr 11, 2024
37bf4f7
Clean up the TermManager in close()
baierd Apr 11, 2024
f176424
Bitwuzla: Suppress a warning about the number of parameters in the Bi…
daniel-raffler Apr 11, 2024
15505d6
Bitwuzla: Applied refaster patch.
daniel-raffler Apr 11, 2024
0920e6d
Bitwuzla: Updated libc requirement to version 2.32 in SolverContextF…
daniel-raffler Apr 11, 2024
7ff2598
Bitwuzla: Added a license for the SWIG patch.
daniel-raffler Apr 11, 2024
263e60c
Bitwuzla: Reverted unintended change to NonLinearArithmeticWithModulo…
daniel-raffler Apr 11, 2024
35e731e
Make a model test better readable
baierd Apr 11, 2024
e948746
Use explicit list of solvers not supported in SolverThreadLocalityTes…
baierd Apr 11, 2024
b9a81c2
Bitwuzla: Tried to fix SolverContextFactoryTest again.
daniel-raffler Apr 11, 2024
1fdc1eb
Bitwuzla: Add license headers to all auto-generated files.
daniel-raffler Apr 11, 2024
048f636
Bitwuzla: Added Bitwuzla to testFormulaAccessAfterClose.
daniel-raffler Apr 11, 2024
58e73e6
Enable and improve exists quantifier Bitwuzla native test
baierd Apr 11, 2024
140ba93
Bitwuzla: Added Bitwuzla to testFormulaAccessAfterClose.
daniel-raffler Apr 11, 2024
6063862
Add Bitvector concurrency test for stack and disable Bitwuzla for thi…
baierd Apr 11, 2024
01bacf6
Bitwuzla: Renamed phantomReferences.patch to swigWrapper.patch and in…
daniel-raffler Apr 11, 2024
2259126
Bitwuzla: Added build commands for gmp to the Bitwuzla build script.
daniel-raffler Apr 11, 2024
5b7fb54
Bitwuzla: Documented the build script.
daniel-raffler Apr 11, 2024
18f406c
Bitwuzla: Avoid possible performance issue in isTrue and isFalse from…
daniel-raffler Apr 11, 2024
c2b7709
Bitwuzla: Cleaned up getRoundingModeImpl from BitwuzlaFloatingPointMa…
daniel-raffler Apr 11, 2024
1ad1d6a
Bitwuzla: Removed duplicate comments from BitwuzlaFormula.
daniel-raffler Apr 11, 2024
45691bc
Bitwuzla: Fixed commit 18f406c41b88f5215f6fe7e5e3923f5c19ab8980
daniel-raffler Apr 12, 2024
b11228b
Bitwuzla: Fixed formatting.
daniel-raffler Apr 12, 2024
28c8469
Add comment about ressources to the phantom reference comment in the …
baierd Apr 12, 2024
ada557c
Add a native Bitwuzla test for FP special value equality + documentation
baierd Apr 12, 2024
7e3499e
Better choose FP equality in the Bitwuzla model
baierd Apr 12, 2024
454833d
Improve readability of Bitwuzlas quantifier creation
baierd Apr 12, 2024
ba8be95
Add requireQuantifierElimination() to SolverBasedTest0
baierd Apr 12, 2024
a0b02d3
Decouple LIA and BV setups in QuantifierManagerTest from the Before a…
baierd Apr 12, 2024
fb8376b
Add correct catch block for CVC5 quant elim by using a pseudo functio…
baierd Apr 12, 2024
4c9622f
Remove unnecessary rounding mode loop in Bitwuzla native test
baierd Apr 12, 2024
dd009bd
Improve CVC5 quantifier elim handling and not reuse the formula, as t…
baierd Apr 12, 2024
b2479c6
Improve requireQuantififerElimination guard, as CVC5 now behaves diff…
baierd Apr 12, 2024
18372ac
Add issue to CVC5 quantifier elim exception problem
baierd Apr 12, 2024
0d9a64b
Bitwuzla: Rewrote BitwuzlaDeclaration using Google AutoValue as sugge…
daniel-raffler Apr 14, 2024
3d9a1dd
Revert "Add issue to CVC5 quantifier elim exception problem"
baierd Apr 15, 2024
9e8d756
Revert "Improve requireQuantififerElimination guard, as CVC5 now beha…
baierd Apr 15, 2024
261eb52
Revert "Improve CVC5 quantifier elim handling and not reuse the formu…
baierd Apr 15, 2024
1036d43
Revert "Add correct catch block for CVC5 quant elim by using a pseudo…
baierd Apr 15, 2024
161d319
Revert "Fix comments and logic settings in parsing for OpenSMT2"
baierd Apr 15, 2024
09d0690
Revert "Add a test for comments and logic settings in parse tests (As…
baierd Apr 15, 2024
8a653de
Revert "Decouple LIA and BV setups in QuantifierManagerTest from the …
baierd Apr 15, 2024
0097668
Revert "Add requireQuantifierElimination() to SolverBasedTest0"
baierd Apr 15, 2024
7162b64
Remove reflection based solution to Bitwuzla options and add a less e…
baierd May 2, 2024
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
lib/native/source/libz3j/org_sosy_lab_solver_z3_Z3NativeApi.c
lib/native/source/*/*.so
lib/native/source/*/*.o
lib/native/source/**/*.java
lib/native/source/opensmt/**/*.java
lib/native/*/*.asc

doc/Example-Maven-Project/target*
Expand Down
18 changes: 18 additions & 0 deletions .idea/JavaSMT.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ SPDX-License-Identifier: Apache-2.0

<!-- one configuration per solver -->
<property name="ivy.solver.configurations" value="
runtime-bitwuzla,
runtime-boolector,
runtime-cvc4,
runtime-cvc5,
Expand Down Expand Up @@ -78,9 +79,12 @@ SPDX-License-Identifier: Apache-2.0
<!-- Main targets -->

<target name="clean" description="Clean">
<property name="bitwuzla.path" value="${user.dir}/lib/native/source/libbitwuzla"/>
<delete includeEmptyDirs="true">
<fileset dir="." includes="${class.dir}/** ${ivy.module}-*.jar ivy-*.xml *.so *.dll *.dylib *.jar"/>
<fileset dir="lib/native/source/libmathsat5j" includes="*.so *.dll *.o"/>
<fileset dir="${bitwuzla.path}" includes="include/"/>
<fileset dir="${bitwuzla.path}" includes="bitwuzla_wrap.o"/>
</delete>
</target>

Expand Down
1 change: 1 addition & 0 deletions build/build-publish-solvers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ SPDX-License-Identifier: Apache-2.0
<!-- vim: set tabstop=8 shiftwidth=4 expandtab sts=4 filetype=ant fdm=marker: -->
<project name="publish-solvers" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">

<import file="build-publish-solvers/solver-bitwuzla.xml"/>
<import file="build-publish-solvers/solver-boolector.xml"/>
<import file="build-publish-solvers/solver-cvc4.xml"/>
<import file="build-publish-solvers/solver-cvc5.xml"/>
Expand Down
230 changes: 230 additions & 0 deletions build/build-publish-solvers/solver-bitwuzla.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
<?xml version="1.0" encoding="UTF-8" ?>

<!--
This file is part of JavaSMT,
an API wrapper for a collection of SMT solvers:
https://github.com/sosy-lab/java-smt

SPDX-FileCopyrightText: 2024 Dirk Beyer <https://www.sosy-lab.org>

SPDX-License-Identifier: Apache-2.0
-->

<!-- vim: set tabstop=8 shiftwidth=4 expandtab sts=4 filetype=ant fdm=marker: -->
Comment thread
baierd marked this conversation as resolved.
<project name="publish-solvers-bitwuzla" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">

<import file="macros.xml"/>

<!-- Determine version and build the Bitwuzla binaries -->
<target name="build-bitwuzla">
<fail unless="bitwuzla.path">
Please specify the path to Bitwuzla with the flag -Dbitwuzla.path=/path/to/bitwuzla.
The path has to point to the root Bitwuzla folder, i.e.,
a checkout of the official git repositoy from 'https://github.com/bitwuzla/bitwuzla'.
Note that shell substitutions do not work and a full absolute path has to be specified.
</fail>
<fail unless="bitwuzla.customRev">
Please specify a custom revision with the flag -Dbitwuzla.customRev=XXX.
The custom revision has to be unique amongst the already known version
numbers from the ivy repository. The script will append the git revision.
</fail>
<fail unless="gmp.path">
Please specify the path to GMP with the flag -Dgmp.path=/path/to/gmp.
The path has to point to the root GMP folder with version equal to or larger than 6.1.
Note that shell substitutions do not work and a full absolute path has to be specified.
</fail>

<!-- get a naive version -->
<exec executable="git" dir="${bitwuzla.path}" outputproperty="bitwuzla.revision"
failonerror="true">
<arg value="show"/>
<arg value="-s"/>
<arg value="--format=%h"/>
</exec>
<property name="bitwuzla.version" value="${bitwuzla.customRev}-g${bitwuzla.revision}"/>
<echo message="Building Bitwuzla in version '${bitwuzla.version}'"/>

<!-- path to our local directory in lib/native -->
<property name="source.path" value="${user.dir}/lib/native/source/libbitwuzla"/>

<!-- build bitwuzla -->
<exec executable="./configure.py" dir="${bitwuzla.path}" failonerror="true">
<arg value="--shared"/>
<arg value="--wipe"/>
<arg value="--prefix"/>
<arg value="${bitwuzla.path}/install"/>
</exec>
<exec executable="meson" dir="${bitwuzla.path}/build/" failonerror="true">
<arg value="compile"/>
</exec>
<exec executable="meson" dir="${bitwuzla.path}/build/" failonerror="true">
<arg value="install"/>
</exec>

<!-- copy bitwuzla include files to the source tree -->
<delete dir="${source.path}/include" quiet="true"/>
<copy todir="${source.path}">
<fileset dir="${bitwuzla.path}/install" includes="include/**"/>
</copy>

<!-- check if -Dbitwuzla.rebuildWrapper=on was used-->
<condition property="rebuild">
<istrue value="${bitwuzla.rebuildWrapper}"/>
</condition>
</target>

<!-- Run swig to generate a new wrapper. Only executed if rebuildWrapper was specified. -->
<target name="build-wrapper" if="rebuild" depends="build-bitwuzla">
<!-- create ouput directory for the swig proxies -->
<delete dir="$source.path}/src" quiet="true"/>
<mkdir dir="${source.path}/src/org/sosy_lab/java_smt/solvers/bitwuzla/api"/>

<!-- run swig to generate java files and the c wrapper -->
<exec executable="swig" dir="${source.path}" failonerror="true">
<arg value="-java"/>
<arg value="-c++"/>
<arg value="-package"/>
<arg value="org.sosy_lab.java_smt.solvers.bitwuzla.api"/>
<arg value="-outdir"/>
<arg value="src/org/sosy_lab/java_smt/solvers/bitwuzla/api"/>
<arg value="-o"/>
<arg value="bitwuzla_wrap.cpp"/>
<arg value="bitwuzla.i"/>
</exec>

<!-- apply patch for the phantom reference issue -->
<!-- FIXME: This will lead to memory leaks. We should look for a proper fix. -->
Comment thread
baierd marked this conversation as resolved.
<exec executable="patch" failonerror="true">
<arg value="-p0"/>
<arg value="-i"/>
<arg value="lib/native/source/libbitwuzla/phantomReferences.patch"/>
</exec>
</target>

<!-- Skip rebuilding the swig header if rebuildWrapper was not specified -->
<target name="skip-wrapper" unless="rebuild" depends="build-bitwuzla">
<echo>WARNING: Skipping the build step for the SWIG wrapper.
If the Bitwuzla API has changed since the last release the wrapper should be updated. Use
option -Dbitwuzla.rebuildWrapper to run SWIG and automatically generate a new wrapper.</echo>
</target>

<!-- Continue with the build and package everything -->
<target name="package-bitwuzla" depends="build-wrapper, skip-wrapper">
<!-- compile java proxies and create jar file -->
<mkdir dir="${source.path}/build"/>
<javac release="11" srcdir="${source.path}/src/" destdir="${source.path}/build" includeantruntime="false"
failonerror="true">
<include name="org/sosy_lab/java_smt/solvers/bitwuzla/api/*.java"/>
</javac>
<jar destfile="bitwuzla-${bitwuzla.version}.jar" basedir="${source.path}/build"/>
<delete dir="${source.path}/build"/>

<!-- generate and package javadoc documentation -->
<delete dir="${source.path}/doc"/>
<mkdir dir="${source.path}/doc"/>
<javadoc sourcepath="${source.path}/src" destdir="${source.path}/doc"/>
<jar destfile="bitwuzla-${bitwuzla.version}-javadoc.jar" basedir="${source.path}/doc"/>
<delete dir="${source.path}/doc"/>

<!-- package swig generated source code -->
<jar destfile="bitwuzla-${bitwuzla.version}-sources.jar" basedir="${source.path}/src"/>

<!-- compile the swig wrapper -->
<exec executable="g++" dir="${source.path}" failonerror="true">
<arg value="-fPIC"/>
<arg value="-c"/>
<arg value="bitwuzla_wrap.cpp"/>
<arg value="-I${source.path}/include"/>
<arg value="-I${gmp.path}"/>
<arg value="-I${java.home}/include"/>
<arg value="-I${java.home}/include/linux"/>
</exec>

<!-- link the wrapper to create libbitwuzlaJNI.so -->
<exec executable="g++" dir="${source.path}" failonerror="true">
<arg value="-shared"/>
<arg value="-o"/>
<arg value="libbitwuzlaJNI.so"/>
<arg value="bitwuzla_wrap.o"/>
<arg value="-L${bitwuzla.path}/install/lib/x86_64-linux-gnu"/>
<arg value="-lbitwuzla"/>
<arg value="-Wl,-z,defs"/>
</exec>

<!-- patch JNI library as it fails to do later for some reason -->
<exec executable="patchelf" failonerror="true">
<arg value="--set-rpath"/>
<arg value="$ORIGIN"/>
<arg value="--replace-needed"/><arg value="libbitwuzla.so.0"/><arg value="libbitwuzla.so"/>
<arg value="${source.path}/libbitwuzlaJNI.so"/>
</exec>
<exec executable="patchelf" failonerror="true">

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kfriedberger we currently execute patchelf twice, as once does not suffice when executing the script (even when done later). The dependency libbitwuzla.so.0 remains when executed only once. Do you know why?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no concrete idea about it, just a guess: it is possible that there are multiple entries in the library and patchelf only changes the first one.

@baierd baierd Apr 12, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ldd says that there is only one. @PhilippWendler maybe you have an idea?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, I wouldn't trust ldd to tell you details about what is in the files. ldd actually loads the file and then informs you about what happens (kinda). Pretty sure it also deduplicates transitive dependencies in the whole dependency graph.

For actually inspecting the binary, try using different tools. Maybe objdump can print this, or similar tools.

<arg value="--set-rpath"/>
<arg value="$ORIGIN"/>
<arg value="--replace-needed"/><arg value="libbitwuzla.so.0"/><arg value="libbitwuzla.so"/>
<arg value="${source.path}/libbitwuzlaJNI.so"/>
</exec>

<!-- copy library files into directory to be published for Ivy -->
<move file="${source.path}/libbitwuzlaJNI.so"
tofile="libbitwuzlaJNI-${bitwuzla.version}.so"
failonerror="true"/>
<copy file="${bitwuzla.path}/build/src/libbitwuzla.so.0"
tofile="libbitwuzla-${bitwuzla.version}.so"
failonerror="true"/>
<copy file="${bitwuzla.path}/build/src/lib/libbitwuzlals.so"
tofile="libbitwuzlals-${bitwuzla.version}.so"
failonerror="true"/>
<copy file="${bitwuzla.path}/build/src/lib/libbitwuzlabv.so"
tofile="libbitwuzlabv-${bitwuzla.version}.so"
failonerror="true"/>
<copy file="${bitwuzla.path}/build/src/lib/libbitwuzlabb.so"
tofile="libbitwuzlabb-${bitwuzla.version}.so"
failonerror="true"/>
<copy file="${gmp.path}/.libs/libgmp.so.10.5.0"
tofile="libgmp-${bitwuzla.version}.so"
failonerror="true"/>

<!-- patch all other libraries -->
<exec executable="patchelf" failonerror="true">
<arg value="--set-rpath"/>
<arg value="$ORIGIN"/>
<arg value="libgmp-${bitwuzla.version}.so"/>
</exec>
<exec executable="patchelf" failonerror="true">
<arg value="--set-rpath"/>
<arg value="$ORIGIN"/>
<arg value="libbitwuzlabb-${bitwuzla.version}.so"/>
</exec>
<exec executable="patchelf" failonerror="true">
<arg value="--set-rpath"/>
<arg value="$ORIGIN"/>
<arg value="--replace-needed"/>
<arg value="libgmp.so.10"/>
<arg value="libgmp.so"/>
<arg value="libbitwuzlabv-${bitwuzla.version}.so"/>
</exec>
<exec executable="patchelf" failonerror="true">
<arg value="--set-rpath"/>
<arg value="$ORIGIN"/>
<arg value="--replace-needed"/>
<arg value="libgmp.so.10"/>
<arg value="libgmp.so"/>
<arg value="libbitwuzlals-${bitwuzla.version}.so"/>
</exec>
<exec executable="patchelf" failonerror="true">
<arg value="--set-rpath"/>
<arg value="$ORIGIN"/>
<arg value="--replace-needed"/>
<arg value="libgmp.so.10"/>
<arg value="libgmp.so"/>
<arg value="libbitwuzla-${bitwuzla.version}.so"/>
</exec>
</target>

<target name="publish-bitwuzla" depends="package-bitwuzla, load-ivy"
description="Publish Bitwuzla binaries to Ivy repository.">
<ivy:resolve conf="solver-bitwuzla" file="solvers_ivy_conf/ivy_bitwuzla.xml"/>
<publishToRepository solverName="Bitwuzla" solverVersion="${bitwuzla.version}"/>
</target>
</project>
7 changes: 5 additions & 2 deletions lib/ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ SPDX-License-Identifier: Apache-2.0
<license name="The Apache Software License, Version 2.0" url="http://www.apache.org/licenses/LICENSE-2.0.txt"/>

<description homepage="https://github.com/sosy-lab/java-smt">
Java wrapper for SMT solvers like Z3, MathSAT5, SMTInterpol, Princess, CVC4, CVC5, Boolector, and Yices2.
Java wrapper for SMT solvers like Z3, MathSAT5, SMTInterpol, Princess, CVC4, CVC5,
Boolector, Yices2, and Bitwuzla.
</description>
</info>

Expand All @@ -41,6 +42,7 @@ SPDX-License-Identifier: Apache-2.0
<conf name="runtime-cvc5" extends="core" description="only one solver included"/>
<conf name="runtime-boolector" extends="core" description="only one solver included"/>
<conf name="runtime-yices2" extends="core" description="only one solver included"/>
<conf name="runtime-bitwuzla" extends="core" description="only one solver included"/>

<!-- The normal dependencies with all solvers included. -->
<conf name="runtime"
Expand All @@ -49,7 +51,7 @@ SPDX-License-Identifier: Apache-2.0

<!-- The normal dependencies with all solvers included, except those unter GPL. -->
<conf name="runtime-without-gpl"
extends="runtime-mathsat,runtime-opensmt,runtime-optimathsat,runtime-smtinterpol,runtime-princess,runtime-z3,runtime-cvc4,runtime-cvc5,runtime-boolector"
extends="runtime-mathsat,runtime-opensmt,runtime-optimathsat,runtime-smtinterpol,runtime-princess,runtime-z3,runtime-cvc4,runtime-cvc5,runtime-boolector,runtime-bitwuzla"
description="all solvers included, except those unter GPL"/>

<!-- Dependencies needed for building or running tests. -->
Expand Down Expand Up @@ -165,6 +167,7 @@ SPDX-License-Identifier: Apache-2.0
<dependency org="org.sosy_lab" name="javasmt-solver-cvc4" rev="1.8-prerelease-2020-06-24-g7825d8f28" conf="runtime-cvc4->solver-cvc4" />
<dependency org="org.sosy_lab" name="javasmt-solver-cvc5" rev="1.0.5-g4cb2ab9eb" conf="runtime-cvc5->solver-cvc5" />
<dependency org="org.sosy_lab" name="javasmt-solver-boolector" rev="3.2.2-g1a89c229" conf="runtime-boolector->solver-boolector" />
<dependency org="org.sosy_lab" name="javasmt-solver-bitwuzla" rev="0.4.0-g954bcfb0" conf="runtime-bitwuzla->solver-bitwuzla; contrib->sources,javadoc"/>

<!-- additional JavaSMT components with Solver Binaries -->
<dependency org="org.sosy_lab" name="javasmt-yices2" rev="4.1.1-59-gaf9c0520c" conf="runtime-yices2->runtime; contrib->sources" />
Expand Down
Loading