Logo

Troubleshooting

Muse couldn’t understand my build system / complained about not being able to produce a compilation database

Because Muse includes advanced program analysis tools, it has to be able to build the application. There are three common cases:

  1. Building the code requires Java 11 (Muse defaults to JDK 1.8). In this case, add a .muse.toml file in the root directory of your repository containing
    jdk11 = true
    
  2. Analyzing the code requires a non-standard build target. When possible, it is best to use a build target that doesn’t invoke tests, perform benchmarks, or pull in non-code resources such as images or binaries. This will make the analysis faster and more robust. To specify the build target, add a .muse.toml file containing the following:
    build = "<build command>"
    

    For example,

    build = "./gradlew assembleAndroid"
    
  3. Some dependencies are needed before build and analysis can proceed. Add a .muse.toml file that contains the following:
    setup = ".muse/setup.sh"
    

    Now add a .muse/setup.sh file that contains commands to download any needed dependencies. You can apt install packages or git clone public GitHub repositories. This script will be run from the root directory of the repository prior to the build and analyze steps.

I have a multi-project repository and I want Muse to only run on one particular project

Normally, Muse will do its best to autodetect your projects and analyze them. In the case that you had something else in mind, simply place a .muse.toml configuration file in the directory containing the project you want analyzed.

For more information, see subprojects.

My custom build script has the error “E: Unable to locate package ‘packagename’”

First ensure your script runs apt update to get the latest package definitions before attempting adding another package.

Muse uses Ubuntu 20.04 “focal” as the base image for all analysis builds. Check if it is a valid “focal” package using the ubuntu package search

My Android project is not building in Muse

Android projects in Muse will require some special configuration. See this guide for instructions and an example.

I don’t have my own repository, but I still want to try Muse

In this case here is a great example repository you can fork to see the benefits of muse for yourself.

For this tutorial, we are going to analyze a C project that uses the ‘make’ build system. We’ll start by cloning the Cisco libacvp library. Go to https://github.com/Muse-Dev/libacvp and click fork.

NOTE: if you didn’t give the Muse app permissions to all repositories then you’ll need to give it permission to this new repository. It’s easy, just go to https://github.com/apps/muse-dev, click configure and include this new repository by selecting it under ‘repository access’.

On a terminal, clone your repository and checkout a development branch as follows. In the commands below, replace $USER with your GitHub username.

git clone git@github.com:$USER/libacvp.git
cd libacvp
git checkout -b quickstart/master 3769935f6df86fc8b47ea7e47c7da2ee89d6f4b0
git push --set-upstream origin quickstart/master
git checkout -b quickstart/develop ca5fd4d0f45428b90c5ec8d7992c6f3b03ccb7b9
git push --set-upstream origin quickstart/develop

The develop branch has a single, obviously incorrect change. This is a more redable reduced change from a commit that involved a bit of refactoring. Muse can analyze the changed code and call out any bugs that have been introduced. You can start the analysis process by making a pull request. Navigate to the URL below and click Create pull request. Again, replace $USER with your GitHub username.

https://github.com/$USER/libacvp/compare/quickstart%2fmaster...quickstart%2fdevelop

After a few minutes Muse will respond with its discoveries through pull request comments such as the one below.

image

Muse will also take advantage of GitHub’s status API to let you know if there were any new bugs introduced by the pull request:

image

The full set of comments can be seen at the following URL.

https://github.com/$USER/libacvp/pull/1

Note that the reported memory leaks are not arbitrary examples. Several leaks in this repository were identified by Muse and subsequently fixed by the library maintainers.

I am wondering what utilities are available to Muse analysis by default

Great! You are in the right place. The Muse analysis image is based on Ubuntu 20.04. Here is a list of packages installed by default:

apt-get install --yes --no-install-recommends \
    autoconf \
    automake \
    awscli \
    curl \
    git \
    software-properties-common \
    gcc-7 \
    gcc-9 \
    g++-9 \
    g++-multilib \
    libc6-dev \
    libgmp-dev \
    libsqlite3-dev \
    opam \
    libtool \
    libtool-bin \
    autotools-dev \
    openjdk-8-jdk-headless \
    openjdk-11-jdk-headless \
    pkg-config \
    ruby \
    libsqlite3-dev \
    gawk \
    tzdata \
    maven \
    libpcre3-dev \
    netbase \
    npm \
    locales \
    libcurl4-gnutls-dev \
    libssl-dev \
    ant \
    jq \
    vim \
    zlib1g-dev \
    python3 \
    python3-dev \
    python3-pip \
    python-setuptools

I have a problem that is not addressed here

Whether it’s a cryptic build error or just confusting results, don’t hesitate to contact our support for personalized assistance.