1

I am attempting to build a maven project (https://github.com/sdiemert/jgt) on Travis CI that depends on the Z3 SMT Solver.

I need to specifiy the location of the z3 dynamic library using:

-Djava.library.path=<path-to-directory-containing-lib>

I am using the Maven surefire plugin to execute tests and have specified the configuration as:

    <plugin>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.20.1</version>
        <configuration>
            <argLine>-Djava.library.path=./lib/</argLine>
        </configuration>
    </plugin>

I am able to execute tests on my local machine using: mvn test

However, when executing tests on Travis CI, I get build failures:

java.lang.UnsatisfiedLinkError: no libz3java in java.library.path`java.library.path

Here is a recent Travis CI build log:

https://travis-ci.org/sdiemert/jgt/builds/384010136

I am at a bit of a loss for how to proceed. The closest thing I could find on SO is: Travis CI ignoring MAVEN_OPTS?.

Any help apperciated.

Simon Diemert
  • 330
  • 3
  • 9

1 Answers1

0

So I seemed to have found a solution, posting for anyone who runs into this in the future.

Z3 for Java depends on the libz3java.so (or dylib on OSX). I had these correctly pointed to using the Surefire plugin's argLine configuration option (slightly modified from above):

    <plugin>
      <artifactId>maven-surefire-plugin</artifactId>
      <version>2.20.1</version>
        <configuration>
            <argLine>-Djava.library.path=${project.basedir}/lib/</argLine>
        </configuration>
    </plugin>

HOWEVER, the z3 binaries rely on libgomp1 which is not installed by default in the Travis CI environment (or the Atlassian Bamboo environment for working in that ecosystem). The obvious fix is to install this lib by adding an apt-get update install build-essential prior to invoking the mvn test.

Also, for good measure, I have also set LD_LIBRARY_PATH=<path-to-z3-libs> which seems to be required on Linux.

The resulting travis.yml is:

language: java

install:
    - sudo apt-get update
    - sudo apt-get install build-essential
    - scripts/install-dependencies.sh
    - mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V

script:
    - export LD_LIBRARY_PATH="$TRAVIS_BUILD_DIR/lib/"
    - mvn test -B
Simon Diemert
  • 330
  • 3
  • 9