-
Notifications
You must be signed in to change notification settings - Fork 279
Build tips and tricks
First of all, we need to install opam-1.2.2
or later.
To get the latest opam
in Ubuntu do the following:
sudo add-apt-repository --yes ppa:avsm/ppa
sudo apt-get update
sudo apt-get --yes install opam
If you're using Mac OS X, First, get a working MacPorts up and working, the do the following:
sudo port install opam
Next, we need to initialize opam and to install OCaml compiler (I suggest to answer yes, to all question, that opam may ask you):
opam init --comp=4.02.3
eval `opam config env`
And finally we can install bap and all its system dependencies
opam depext --install bap
With opam, you can get the latest version from GitHub, or any other source. This is called "pinning" in opam hackers jargon.
Word of caution: unless you're pretty sure about what you're doing, then please do pinning only after you've properly installed bap.
And here is the command:
opam pin add bap --dev-repo
The source URL can be anything, including local path, another repository. You can
also specify a particular branch with, e.g., to pin to a branch new_feature
use:
git://github.com/BinaryAnalysisPlatform/bap.git#new_feature
In order to remove pin and return to a released BAP, issue
opam pin remove bap
The newest version of BAP, that depends on PPX extensions, requires the newest version of opam
, that can be installed on Ubuntu with:
sudo add-apt-repository --yes ppa:avsm/ppa
sudo apt-get update
sudo apt-get --yes install opam
Macports install opam 1.2.2
by default.
What concerning opam 1.1, it still should work, but command line syntax is a little bit different.
To update to the latest available version of BAP issue the following two commands:
opam update bap
opam upgrade
If you don't want to upgrade all your opam stack, then you can upgrade just bap,
opam upgrade bap
This is only needed if you're going to change BAP sources, it is not needed or recommended
way of using BAP. You can always get the latest version with opam
.
First of all, we need to install BAP dependencies. You can look at the opam/opam
file,
to get some insight, propably the configure
script will emit more or less sane errors,
in case of a missing dependency.
Once all the dependencies of bap
have been installed, we can start the actual
build. This is a usual tripple:
./configure --enable-everything
make
make reinstall
Note: if you have chosen prefix that requires super-user privileges,
then you need to run make install
using sudo
. If you have OCaml installed via opam, then it is better to pass the opam prefix, e.g.,
./configure --enable-everything --prefix=`opam config var prefix`
The --enable-everything
option will indeed enable all possible features that
are shipped with bap repository. Probably you don't need some of them.
In that case, just disable them, e.g.,
./configure --enable-everything --disable-ida --disable-fsi-benchmark
You may see, that sometimes you will need to disable other features, those that are dependent on already disabled. For example, the fsi-benchmark
feature depends on ida
feature. So, if you disable the latter you will need to disable the former, otherwise, you will not get through the configuration. You can figure out the dependencies by trial an error, or look into the oasis folder. But probably, it is better to use opam
or some other package management system to handle the dependencies.
If you're looking for only one specific feature, for example, when you want to hack some plugin, then just don't pass the --enable-everything
option, and cherry pick the feature that you need, e.g.,
./configure --enable-ida
It is good to know, that some modules add their specific options to the configure script. You can see the full list, by passing the --help
option, to the configure
script.
With the updated build system it is now possible to compile bap only with running make
, so that if you're lucky Emacs user, then you need only hit C-c C-c
et voila. But what if you would like to add some tricky configuration options. There're several possibilities to enumerate.
- Use
./configure
explicitly - Put all the needed stuff into your profile file, and forget about configuration:
export BAPCONFIGUREFLAGS="--prefix=`opam config var prefix` --enable-tests"
- Use emacs
setenv
command to setBAPCONFIGUREFLAGS
variable to anything you want - Invoke make with appropriate variables set, e.g.,
BAPCONFIGUREFLAGS --enable-tests make && make test
You can also hijack any other flags, like BAPBUILDFLAGS
, see Makefile
for a complete set of available environment variables and commands.
- Any variable in
setup.data
can be overridden by environment.
We believe that BAP can be installed on any system with recent compiler toolchain. The hardiest problem is to install system dependencies. As a stating approximation, you can take a look at our system dependencies on Ubuntu 14.04, and extrapolate them to your system,
opam list --safe --recursive --external=ubuntu --required-by=bap
If you managed to install BAP on another system, please share your success story with us!