Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bash script to setup JPF and SPF in unix-based systems #61

Open
y553546436 opened this issue Jul 29, 2021 · 0 comments
Open

Bash script to setup JPF and SPF in unix-based systems #61

y553546436 opened this issue Jul 29, 2021 · 0 comments

Comments

@y553546436
Copy link

y553546436 commented Jul 29, 2021

Thanks to Yannic's guidance (in google group discussion), I successfully installed and run the SPF from the command line. I wrote a bash script for unix-based system users. I hope this script can help you get started faster.

# Prerequisites: git,ant,java
dir=$(pwd)

# set up JPF
git clone https://github.com/javapathfinder/jpf-core
cd jpf-core
jpf_dir=$(pwd)
git checkout java-8
# remove deprecated import
sed -i.back '/import com.sun.org.apache.bcel.internal.generic.InstructionConstants;/d' src/main/gov/nasa/jpf/vm/MJIEnv.java
ant build

# set up SPF
cd ${dir}
git clone https://github.com/SymbolicPathFinder/jpf-symbc
cd jpf-symbc
spf_dir=$(pwd)

# set up site.properties
mkdir -p ~/.jpf
echo "jpf-core=${jpf_dir}" >> ~/.jpf/site.properties
echo "jpf-symbc=${spf_dir}" >> ~/.jpf/site.properties
echo "extensions=\${jpf-core},\${jpf-symbc}" >> ~/.jpf/site.properties

# build SPF
ant build

# set the Java library path to include SPF's lib folder
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
    # for linux; better append this line to ~/.bash_profile
    export LD_LIBRARY_PATH=${spf_dir}/lib
elif [[ "$OSTYPE" == "darwin"* ]]; then
    # for Mac OSX; better append this line to ~/.bash_profile
    export DYLD_LIBRARY_PATH=${spf_dir}/lib
    # DYLD_LIBRARY_PATH works only after disabling the SIP
    # see https://developer.apple.com/documentation/security/disabling_and_enabling_system_integrity_protection
fi

# run a simple example
java -Xmx1024m -ea -cp "${jpf_dir}/build/*:${spf_dir}/build/*" gov.nasa.jpf.tool.RunJPF ${spf_dir}/src/examples/ByteTest.jpf
# include also ${spf_dir}/lib/com.microsoft.z3.jar in the java classpath if you see such error: "java.lang.NoClassDefFoundError: com/microsoft/z3/Expr"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant