Update the Windows build instructions ##doc

This commit is contained in:
pancake 2022-03-17 10:11:28 +01:00
parent b0f1c3716f
commit 202e7d3b26
2 changed files with 64 additions and 21 deletions

View File

@ -6,8 +6,7 @@
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/741/badge)](https://bestpractices.coreinfrastructure.org/projects/741) [![Build Status](https://scan.coverity.com/projects/416/badge.svg)](https://scan.coverity.com/projects/416) [![Total alerts](https://img.shields.io/lgtm/alerts/g/radareorg/radare2.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/radareorg/radare2/alerts/)
See the [Releases](https://github.com/radareorg/radare2/releases) page for
binary downloads. The current git `master` branch is `5.6.5`, next release
will be `5.6.6`.
downloads. The current git `master` branch is `5.6.5`, next release will be `5.6.6`.
We ensure ABI stability for all the patch releases, you can mix/swap libraries
and plugins without the need to recompile them if major and minor numbers are

View File

@ -1,34 +1,78 @@
How to Build for Windows
========================
# Native Windows Builds
These are the standard instructions to build radare2 on Windows, keep
reading for alternative methods below.
You can follow the [r2book](https://radare.gitbooks.io/radare2book/content/first_steps/windows_compilation.html) for a more complete guide.
Native
---------------
## Requirements
You will need:
* Python 3
* Meson (pip3 install meson)
* Visual Studio 2015 (or later)
* Python 3 with pip3
* Meson and ninja (pip3 install meson)
* Visual Studio 2019 (2015 and 2022 should work too)
First, call `vcvarsall.bat` with your architecture (x86, x64, arm) to setup the compilation environment.
## Compilation
cd radare2
python3 sys\meson.py --release --backend vs2019 --shared --install --prefix="%cd%\radare2_dist" --webui
The easiest way to build is by using the batch scripts:
You can change `--backend` to your VS version (`vs2015`, `vs2017`), `ninja` buildsystem is also supported.
```
preconfigure.bat
configure.bat
make.bat
```
For XP support, append `--xp` to the command (not compatible with VS2019).
The first one will setup the python and visual studio in PATH, you
only need to run it once per console.
You can then add `radare2_dist` to your PATH to make radare2 accessible from everywhere.
The second will run meson under the hood and create the `b` and `vs`
directories to build using `ninja` or `visual studio` project.
Crosscompilation
----------------
Finally the `make` will run `ninja` and create the `prefix` directory
containing all the distribution binaries, libraries and support files.
As building with mingw is no longer officially supported in radare2, crosscompilation isn't (easily) possible.
## Running
You can check the official [Meson documentation](https://mesonbuild.com/Cross-compilation.html).
As said, check the `prefix\bin` directory and type `radare2`
Good luck.
# Crosscompilation
Run `sys/mingw32.sh` or `sys/mingw64.sh` to crosscompile r2 from Linux/macOS
to 32 or 64bit Windows using `acr/make`.
# Blob builds
The `binr/blob` directory contains the program that acts like `busybox` but
for `r2`. Rename the executable to any of the collection and it will act
accordingly.
This is, a single executable, with no external libraries that you can drop
anywhere easily, 3rd party plugins won't work well with it, but it's useful
to have in a variety of situations.
## Compiling the blob for windows
Follow the **native build instructions** and just pass an argument to the
second step:
```
configure.bat static
make.bat
```
# Continuous Integration
You can also check the CI scripts under `.github/workflow` to see the steps
performed to generate the release builds for Windows.
Most notabily there are some 3rd party bugs that we cannot handle and they
are workarounded in the environment setup.
## Troubleshooting
* meson have race condition bugs that force you to compile with `ninja -j1`
* Some recent versions of pip generate bogus wrapper programs for meson
* Visual Studio 2022 may not be supported out of the box yet
* Python PATH can break over shells, better use pyenv as `preconfigure.bat` does