diff --git a/CHANGELOG.md b/CHANGELOG.md index 38e2e57..e7b7990 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,25 @@ -# Next +# Next Release Goals - New Features: - * Updated gradle to build Z3 from downloaded source zip - * Gradle build to support Java 17 for Ghidra 10.2+ - * Simplified build instructions, in new INSTALL.md file + * - Bugfixes: - * Fix an FnHash error + * + + +# Current Release + +## 230330 +- New Features: + * Updated gradle to allow auto building Z3 from downloaded source zip + * Gradle build to support Java 17 for Ghidra 10.2+ + * Simplified build and install instructions, in new INSTALL.md file + * Status check tool to test for Z3, autoload library if possible +- Bugfixes: + * Fix an FnHash error that would hang the UI (#25) + * Fix errors loading Z3 libraries (#6, #20, #30) + * Catch GhiHorn error from Ghidra HighVariable (#23) + * Catch an error with java time (#34) # Past Releases diff --git a/INSTALL.md b/INSTALL.md index 267849e..a25699b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -45,26 +45,6 @@ gradle -PKAIJU_AUTOCATS_DIR= test gradle -PKAIJU_AUTO_REMOVE install ``` -Before first run, use your favorite text editor to open the `ghidraRun` -script (or `ghidraRun.bat` on Windows) in the top level directory of -your Ghidra installation. Then, in the script line under -`# Launch Ghidra`, add the following to the empty quotes: -```bash --Djava.library.path=/path/to/Ghidra/Extensions/kaiju/os/ -``` -where `your_os_dir` is one of the following, depending -on the architecture you are running: -* `linux_x86_64` (Linux distributions) -* `mac_x86_64` (Mac iOS) -* `win_x86_64` (Windows 10+) - -As an example, on a typical 64-bit linux OS, `ghidraRun` (or -`ghidraRun.bat` on Windows) should after editing look similar to: -```bash -# Launch Ghidra -"${SCRIPT_DIR}"/support/launch.sh bg Ghidra "${MAXMEM}" "-Djava.library.path=/path/to/Ghidra/Extensions/kaiju/os/linux_x86_64" ghidra.GhidraRun "$@" -``` - Optionally: To make use of the `kaijuRun` script, be sure to set the script with executable permission on Linux: ```bash @@ -275,20 +255,26 @@ If you'd prefer to remove your old installation manually, perform a command like rm -rf $GHIDRA_INSTALL_DIR/Extensions/Ghidra/*kaiju*.zip $GHIDRA_INSTALL_DIR/Ghidra/Extensions/kaiju ``` -### Step 4: Set Java Parameters on GhidraRun Script Prior to Running +### Troubleshooting + +#### Fixing Z3 libraries not found -Once installed, Ghidra must be restarted (if you installed via the -graphical interface). +Once Kaiju is installed, Ghidra must be restarted (if you installed +via the graphical interface). -Prior to running Ghidra, however, we must tweak the parameters that -the Java virtual machine runs with in order for Ghidra to find -the pre-compiled Z3 binaries. At the moment we are not aware -of any way to consistently auto-load these binaries across -all platforms, due to both the way Java works at runtime -and the way Ghidra extensions are typically installed -via .zip files. +Kaiju attempts to autoload the Z3 native libraries based on your +operating system. The Status Check tool (at `Kaiju > Status Check` +in the main Ghidra window) will check if Z3 libraries are found +and loaded successfully. If you see a green check mark, +tools like GhiHorn that require Z3 should "just work". -Therefore, you will need to MANUALLY make a small change to +However, if the libraries are not loaded properly, there are +a couple of ways to try to fix it. + +**OPTION ONE**, if the autoload is unsuccessful (perhaps due to JVM +security, etc.), you can let Ghidra know to add the kaiju +library paths to the JVM runtime so they can be loaded. +To do this, you will need to MANUALLY make a small change to the `ghidraRun` script of your Ghidra installation. This is a completely Ghidra-supported step, not a "hack", to allow custom configuration of the Java virtual machine @@ -325,15 +311,25 @@ including this library path and load the Z3 libraries. If you install a new Ghidra version, you will need to repeat this process along with re-installing Kaiju. -**NOTE**: if you use Z3 packages for your Linux distribution, -as long as the Z3 binaries are installed in the typical -library paths like `/usr/lib`, Java will likely be able to find -and use the libraries from these locations instead of the prebuilt -included in the Kaiju extension. In this case, updating -the `ghidraRun` script may not be necessary -- but also, +**OPTION TWO**: Particularly on Linux, the included prebuilt +Z3 libraries are built for the latest Ubuntu LTS release. +The libraries may not run properly on other distributions. +You may however be able to install Z3 libraries directly +from your distrubtion's package manager, and Java will load +them since they are in system library paths like `/usr/lib`. +In this case, updating the `ghidraRun` script may not be +necessary -- but also, the system packages may be a different version of Z3 than supported by Kaiju. Therefore, certain Kaiju tools like GhiHorn may not work properly and we cannot promise being able to support or help with troubleshooting. + +**OPTION THREE**: If you want to ensure the same version of Z3 +we develop with, you can manually build Z3 for your particular +platform/operating system/distribution. The Gradle build system +can automatically build Z3 for your system if you build Kaiju +from source; otherwise, build Z3 separately according to the Z3 +docs and then drop the built Z3 libraries into an appropriate +system directory (or the os directory in Kaiju if you want to try). diff --git a/azure-pipelines.txt b/azure-pipelines.txt deleted file mode 100644 index 5f701ea..0000000 --- a/azure-pipelines.txt +++ /dev/null @@ -1,233 +0,0 @@ -schedules: -- cron: "0 12 * * 0" - displayName: Weekly Sunday build - branches: - include: - - main - always: true - -jobs: -- job: Build_Kaiju - variables: - CCACHE_DIR: $(Pipeline.Workspace)/cache - GRADLE_USER_HOME: $(Pipeline.Workspace)/.gradle - AUTOCATS_DIR: $(Pipeline.Workspace)/autocats - GHIHORN_TEST_DIR: $(Pipeline.Workspace)/autocats/exe/ghihorn - GRADLE_VERSION: gradle-7.6 - GRADLE_URL: https://services.gradle.org/distributions/$(GRADLE_VERSION)-bin.zip - GRADLE_INSTALL_DIR: $(Pipeline.Workspace)/gradle - Z3_VERSION: z3-4.12.0 - strategy: - matrix: - # disabled until make needed changes for Ghidra 10.3 - #ghidra-git: - # ghidraVersion: "master" - ghidra1022: - ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_10.2.2_build/ghidra_10.2.2_PUBLIC_20221115.zip" - ghidraVersion: "10.2.2" - ghidra1021: - ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_10.2.1_build/ghidra_10.2.1_PUBLIC_20221110.zip" - ghidraVersion: "10.2.1" - ghidra1020: - ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_10.2_build/ghidra_10.2_PUBLIC_20221101.zip" - ghidraVersion: "10.2.0" - ghidra1015: - ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_10.1.5_build/ghidra_10.1.5_PUBLIC_20220726.zip" - ghidraVersion: "10.1.5" - ghidra1014: - ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_10.1.4_build/ghidra_10.1.4_PUBLIC_20220519.zip" - ghidraVersion: "10.1.4" - ghidra1013: - ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_10.1.3_build/ghidra_10.1.3_PUBLIC_20220421.zip" - ghidraVersion: "10.1.3" - ghidra1012: - ghidraUrl: "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_10.1.2_build/ghidra_10.1.2_PUBLIC_20220125.zip" - ghidraVersion: "10.1.2" - pool: - vmImage: 'Ubuntu-22.04' - steps: - - - bash: | - set -e - sudo apt-get -y update - sudo apt-get install ccache -y - echo "##vso[task.prependpath]/usr/lib/ccache" - displayName: Install ccache and update PATH to use linked versions of gcc, cc, etc - - - task: Cache@2 - inputs: - key: 'ccache | "$(System.JobDisplayName)" ' # Same for each version of Ghidra more or less - restoreKeys: 'ccache' - path: $(CCACHE_DIR) - displayName: ccache - - - script: | - echo "##vso[task.setvariable variable=JAVA_HOME]$(JAVA_HOME_11_X64)" - echo "##vso[task.prependpath]$(JAVA_HOME_11_X64)/bin:$(PATH)" - displayName: "Set Java 11" - condition: or(eq(variables['ghidraVersion'], '10.1.5'), or(eq(variables['ghidraVersion'], '10.1.4'), or(eq(variables['ghidraVersion'], '10.1.3'), eq(variables['ghidraVersion'], '10.1.2')))) - - - script: | - echo "##vso[task.setvariable variable=JAVA_HOME]$(JAVA_HOME_17_X64)" - echo "##vso[task.prependpath]$(JAVA_HOME_17_X64)/bin:$(PATH)" - displayName: "Set Java 17" - condition: or(eq(variables['ghidraVersion'], 'master'), or(eq(variables['ghidraVersion'], '10.2.2'), or(eq(variables['ghidraVersion'], '10.2.1'), eq(variables['ghidraVersion'], '10.2.0')))) - - - task: Cache@2 - inputs: - key: '"$(Z3_VERSION)" | "$(JAVA_HOME)" | z3' - path: $(Pipeline.Workspace)/z3 - displayName: Cache z3 dir - - - task: Cache@2 - condition: and(succeeded(), ne(variables['ghidraUrl'], '')) - inputs: - key: '"$(ghidraUrl)" | binary' - path: $(Pipeline.Workspace)/zip - displayName: Cache ghidra binary - - - task: Cache@2 - inputs: - key: 'gradle | "$(Agent.OS)" | "$(System.JobDisplayName)" ' - restoreKeys: 'gradle' - path: $(GRADLE_USER_HOME) - displayName: Gradle build cache - - - task: Cache@2 - inputs: - key: '"$(AUTOCATS_DIR)" | "autocats" | "ghihorn"' - restoreKeys: "autocats" - path: $(AUTOCATS_DIR) - displayName: Cache AUTOCATS - - - task: Cache@2 - inputs: - key: '"$(GRADLE_URL)" | gradle' - path: $(GRADLE_INSTALL_DIR) - displayName: Cache Gradle 7.x - - - bash: | - set -ex - sudo apt-get -y install ninja-build - test -d $(Pipeline.Workspace)/z3 || git clone -b $(Z3_VERSION) --depth 1 https://github.com/Z3Prover/z3.git z3 - mkdir -p z3/build - cd z3/build - git checkout $(Z3_VERSION) - cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DZ3_BUILD_JAVA_BINDINGS=On .. - ninja - echo '##vso[task.setvariable variable=LD_LIBRARY_PATH]$(Pipeline.Workspace)/z3/build' - condition: succeeded() - workingDirectory: $(Pipeline.Workspace) - displayName: Build Z3 - - - bash: | - set -e - test -d zip || (mkdir zip && cd zip && wget $(ghidraUrl)) - unzip zip/*.zip - condition: and(succeeded(), ne(variables['ghidraUrl'], '')) - workingDirectory: $(Pipeline.Workspace) - displayName: Download Ghidra binary from $(ghidraUrl) - - - bash: | - set -e - sudo apt-get -y install bison flex xvfb - git clone --depth 1 https://github.com/NationalSecurityAgency/ghidra - condition: and(succeeded(), eq(variables['ghidraUrl'], '')) - workingDirectory: $(Pipeline.Workspace) - displayName: Download and build Ghidra from git part 1 - - - task: Cache@2 - displayName: Cache Ghidra dependencies - inputs: - key: 'gradle deps' - path: $(Pipeline.Workspace)/ghidra/dependencies - condition: and(succeeded(), eq(variables['ghidraUrl'], '')) - - - bash: | - set -e - echo "##vso[task.prependpath]$(GRADLE_INSTALL_DIR)/$(GRADLE_VERSION)/bin" - test -d $(GRADLE_INSTALL_DIR) && exit 0 - wget $(GRADLE_URL) -O gradle.zip - unzip -d $(GRADLE_INSTALL_DIR) gradle.zip - rm gradle.zip - workingDirectory: $(Pipeline.Workspace) - displayName: Download gradle 7.x binary from $(GRADLE_URL) - - - bash: | - set -ex - cd ghidra - gradle --build-cache --init-script gradle/support/fetchDependencies.gradle init - gradle --build-cache buildGhidra -x ip - mkdir -p $(Pipeline.Workspace)/zip - cp build/dist/*.zip $(Pipeline.Workspace)/zip/ - cd $(Pipeline.Workspace) - unzip zip/*.zip - condition: and(succeeded(), eq(variables['ghidraUrl'], '')) - workingDirectory: $(Pipeline.Workspace) - displayName: Download and build Ghidra from git part 2 - - - bash: | - set -e - Z3CLASSPATH=$(Pipeline.Workspace)/z3/build GHIDRA_INSTALL_DIR=$(find $(Pipeline.Workspace) -maxdepth 1 -type d -name 'ghidra_*') gradle -PKAIJU_AUTOCATS_DIR=$AUTOCATS_DIR --build-cache - displayName: Build Kaiju extension and plugins - workingDirectory: . - - - bash: | - set -ex - test -d $AUTOCATS_DIR || git clone https://github.com/cmu-sei/autocats $AUTOCATS_DIR - (cd $AUTOCATS_DIR && git pull) - displayName: Download AUTOCATS - - - bash: | - set -e - # Needs a head - Xvfb :1 & - DISPLAY=:1 Z3CLASSPATH=$(Pipeline.Workspace)/z3/build GHIDRA_INSTALL_DIR=$(find $(Pipeline.Workspace) -maxdepth 1 -type d -name 'ghidra_*') gradle -PKAIJU_AUTOCATS_DIR=$AUTOCATS_DIR --build-cache --stacktrace --info test - kill %% - displayName: Run Kaiju tests - workingDirectory: . - - - script: gradle --stop - - publish: dist/ - - task: GitHubRelease@0 - condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'main'), ne(variables['Build.Reason'], 'Schedule')) - inputs: - gitHubConnection: gh - repositoryName: $(Build.Repository.Name) - action: delete - tagSource: manual - tag: ghidra-$(ghidraVersion) - continueOnError: true - - task: DownloadSecureFile@1 - condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'main'), ne(variables['Build.Reason'], 'Schedule')) - name: deployKey - inputs: - secureFile: 'deploy.key' - - bash: | - mkdir -p ~/.ssh - ssh-keyscan github.com >> ~/.ssh/known_hosts - ssh-agent -a $SSH_AUTH_SOCK > /dev/null - chmod og-r $(deployKey.secureFilePath) - ssh-add $(deployKey.secureFilePath) - git config --global user.email "eschwartz@cert.org" - git config --global user.name "eschwartz" - git remote add ssh-origin git@github.com:sei-eschwartz/kaiju.git - git push --delete ssh-origin ghidra-$(ghidraVersion) - rm -f $(deployKey.secureFilePath) - condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'main'), ne(variables['Build.Reason'], 'Schedule')) - env: - SSH_AUTH_SOCK: /tmp/ssh_agent.sock - continueOnError: true - displayName: Delete old git tag ghidra-$(ghidraVersion) - - task: GitHubRelease@0 - condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'main'), ne(variables['Build.Reason'], 'Schedule')) - inputs: - gitHubConnection: gh - repositoryName: $(Build.Repository.Name) - action: create - target: $(Build.SourceVersion) - tagSource: manual - tag: ghidra-$(ghidraVersion) - title: CERT Kaiju binary analysis extension for Ghidra $(ghidraVersion) - assets: dist/*.zip - addChangeLog: false diff --git a/docs/GhiHorn.md b/docs/GhiHorn.md index 84dcbd5..a1eb4fd 100644 --- a/docs/GhiHorn.md +++ b/docs/GhiHorn.md @@ -1,7 +1,13 @@ # GhiHorn A horn encoder for Ghidra version 10.1+ and above. +GhiHorn uses Z3 SMT library. -## Installation +## Old Z3 Installation + +These instructions are outdated; see `INSTALL.md` in the Kaiju +source code for updated information. These directions are +preserved until confirmed that we have a better automated way +to install Z3. 1. You need to install Z3 and the [Z3 java bindings](https://github.com/Z3Prover/z3#java) 1. You need to add the jar file (`com.microsoft.z3.jar`) to the `GhiHorn/lib` diff --git a/extension.properties b/extension.properties index ebf2346..0c5345d 100644 --- a/extension.properties +++ b/extension.properties @@ -1,5 +1,5 @@ name=CERT Kaiju description=CERT Kaiju - Binary Analysis Framework for Ghidra author=CERT Executable Code Analysis Team -createdOn=03/28/2023 +createdOn=03/30/2023 version=@extversion@ diff --git a/src/main/help/help/topics/ghidraz3/help.html b/src/main/help/help/topics/ghidraz3/help.html deleted file mode 100644 index 8f858d2..0000000 --- a/src/main/help/help/topics/ghidraz3/help.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - Skeleton Help File for a Module - - - - -

Skeleton Help File for a Module

- -

This is a simple skeleton help topic. For a better description of what should and should not - go in here, see the "sample" Ghidra extension in the Extensions/Ghidra directory, or see your - favorite help topic. In general, language modules do not have their own help topics.

- - diff --git a/src/main/java/kaiju/common/KaijuNativeLibraryLoaderUtil.java b/src/main/java/kaiju/common/KaijuNativeLibraryLoaderUtil.java index 71d576f..8b22818 100644 --- a/src/main/java/kaiju/common/KaijuNativeLibraryLoaderUtil.java +++ b/src/main/java/kaiju/common/KaijuNativeLibraryLoaderUtil.java @@ -31,25 +31,22 @@ */ package kaiju.common; -import java.lang.reflect.Field; +import ghidra.framework.Application; + +import java.io.File; +import java.io.FileNotFoundException; +import java.lang.UnsatisfiedLinkError; public final class KaijuNativeLibraryLoaderUtil { - private static final String SYS_PATHS = "sys_paths"; - private KaijuNativeLibraryLoaderUtil() { + private KaijuNativeLibraryLoaderUtil() {} + + public static void loadLibrary(String name) throws FileNotFoundException, UnsatisfiedLinkError { + // System.mapLibraryName will add "lib" and proper extension depending on OS + // so e.g., call mapLibraryName("z3") to get libz3.so on linux + // but on windows mapLibraryName("z3") will get z3.dll so call mapLibraryName("libz3") + File libraryPath = Application.getOSFile("kaiju", System.mapLibraryName(name)); + System.load(libraryPath.getAbsolutePath()); } - - public static void addLibsToJavaLibraryPath(final String dirName) { - try { - System.setProperty("java.library.path", dirName); - System.setProperty("jna.library.path", dirName); - System.setProperty("jni.library.path", dirName); - final Field fieldSysPath = ClassLoader.class.getDeclaredField(SYS_PATHS); - fieldSysPath.setAccessible(true); - fieldSysPath.set(null, null); - } catch (IllegalAccessException | NoSuchFieldException e) { - // TODO: can we log errors somewhere? - //error(e.getMessage(), e); - } - } + } diff --git a/src/main/java/kaiju/tools/ghihorn/GhiHornPlugin.java b/src/main/java/kaiju/tools/ghihorn/GhiHornPlugin.java index 289720e..d336ce6 100644 --- a/src/main/java/kaiju/tools/ghihorn/GhiHornPlugin.java +++ b/src/main/java/kaiju/tools/ghihorn/GhiHornPlugin.java @@ -71,29 +71,24 @@ public class GhiHornPlugin extends ProgramPlugin implements AutoAnalysisManagerL public static final String HORNIFIER_NAME = "GH:Hornifier"; private static boolean z3LibsFound; - + static { - z3LibsFound = false; try { - ResourceFile z3osDir = Application.getModuleSubDirectory("kaiju", - "os/" + Platform.CURRENT_PLATFORM.getDirectoryName()); - String OS_DIR = z3osDir.getAbsolutePath() + "/"; - - ResourceFile z3libDir = Application.getModuleSubDirectory("kaiju", "lib/"); - String LIB_DIR = z3libDir.getAbsolutePath() + "/"; - - KaijuNativeLibraryLoaderUtil.addLibsToJavaLibraryPath(OS_DIR); - - System.load(OS_DIR + "libz3" + Platform.CURRENT_PLATFORM.getLibraryExtension()); - System.load(OS_DIR + "libz3java" + Platform.CURRENT_PLATFORM.getLibraryExtension()); + if (Platform.CURRENT_PLATFORM == Platform.WIN_X86_64) { + // load dependents first if on windows + KaijuNativeLibraryLoaderUtil.loadLibrary("vcruntime140"); + KaijuNativeLibraryLoaderUtil.loadLibrary("vcruntime140_1"); + KaijuNativeLibraryLoaderUtil.loadLibrary("msvcp140"); + KaijuNativeLibraryLoaderUtil.loadLibrary("libz3"); + KaijuNativeLibraryLoaderUtil.loadLibrary("libz3java"); + } else { + KaijuNativeLibraryLoaderUtil.loadLibrary("z3"); + KaijuNativeLibraryLoaderUtil.loadLibrary("z3java"); + } String z3status = "Z3 version: " + Version.getFullVersion(); z3LibsFound = true; - } catch (FileNotFoundException fnfe) { - // TODO - } catch (IOException ioe) { - // TODO - } catch (UnsatisfiedLinkError ule) { - // TODO + } catch (Throwable t) { + z3LibsFound = false; } } diff --git a/src/main/java/kaiju/tools/statuscheck/KaijuStatusCheckDialog.java b/src/main/java/kaiju/tools/statuscheck/KaijuStatusCheckDialog.java index f38242f..59e892b 100644 --- a/src/main/java/kaiju/tools/statuscheck/KaijuStatusCheckDialog.java +++ b/src/main/java/kaiju/tools/statuscheck/KaijuStatusCheckDialog.java @@ -42,8 +42,11 @@ import docking.DockingWindowManager; import docking.widgets.checkbox.GCheckBox; import docking.widgets.label.GLabel; +import ghidra.framework.Platform; import resources.ResourceManager; +import kaiju.common.*; + import com.microsoft.z3.Version; class KaijuStatusCheckDialog extends DialogComponentProvider { @@ -55,6 +58,27 @@ class KaijuStatusCheckDialog extends DialogComponentProvider { private JTextArea tipArea; private int tipIndex = 0; private List tips; + + private static boolean z3LibsFound; + + static { + try { + if (Platform.CURRENT_PLATFORM == Platform.WIN_X86_64) { + // load dependents first if on windows + KaijuNativeLibraryLoaderUtil.loadLibrary("vcruntime140"); + KaijuNativeLibraryLoaderUtil.loadLibrary("vcruntime140_1"); + KaijuNativeLibraryLoaderUtil.loadLibrary("msvcp140"); + KaijuNativeLibraryLoaderUtil.loadLibrary("libz3"); + KaijuNativeLibraryLoaderUtil.loadLibrary("libz3java"); + } else { + KaijuNativeLibraryLoaderUtil.loadLibrary("z3"); + KaijuNativeLibraryLoaderUtil.loadLibrary("z3java"); + } + z3LibsFound = true; + } catch (Throwable t) { + z3LibsFound = false; + } + } KaijuStatusCheckDialog(KaijuStatusCheckPlugin plugin, List tips) { super("Kaiju Status Check", false, false, true, false); @@ -63,12 +87,12 @@ class KaijuStatusCheckDialog extends DialogComponentProvider { this.tips = tips; JLabel z3VerLabel = new GLabel("", ResourceManager.loadImage("images/red-x.png"), SwingConstants.LEFT); - boolean z3LibsFound = false; + //boolean z3LibsFound = false; try { z3VerLabel.setText("Z3 loaded successfully. Using Z3 version: " + Version.getFullVersion()); // by calling getFullVersion() above, we are implicitly // checking that Z3 is loaded. If not, it will throw an exception. - z3LibsFound = true; + //z3LibsFound = true; } catch (NoClassDefFoundError nce) { z3VerLabel.setText("Warning: NoClassDefFoundError while loading Z3. Some tools like Ghihorn will be disabled."); } catch (UnsatisfiedLinkError e) { diff --git a/src/main/java/kaiju/tools/statuscheck/KaijuStatusCheckPlugin.java b/src/main/java/kaiju/tools/statuscheck/KaijuStatusCheckPlugin.java index 3fa94a5..498941f 100644 --- a/src/main/java/kaiju/tools/statuscheck/KaijuStatusCheckPlugin.java +++ b/src/main/java/kaiju/tools/statuscheck/KaijuStatusCheckPlugin.java @@ -67,10 +67,22 @@ public class KaijuStatusCheckPlugin extends Plugin implements ApplicationLevelOn private KaijuStatusCheckDialog dialog; private DockingAction action; + + private static boolean z3LibsFound; public KaijuStatusCheckPlugin(PluginTool tool) { super(tool); } + + static { + try { + KaijuNativeLibraryLoaderUtil.loadLibrary("z3"); + KaijuNativeLibraryLoaderUtil.loadLibrary("z3java"); + z3LibsFound = true; + } catch (Throwable t) { + z3LibsFound = false; + } + } @Override protected void init() {