Easier build instructions

This commit is contained in:
xarkes 2018-03-06 17:50:09 +01:00
parent e5c7a27b95
commit 93be7f4907
7 changed files with 137 additions and 99 deletions

View File

@ -34,52 +34,23 @@ git clone https://github.com/radareorg/cutter
cd cutter cd cutter
``` ```
##### Building radare2 Building on linux:
**/!\ WARNING /!\ This will delete your current radare2 version if any already installed.**
```sh ```sh
git submodule init radare2 && git submodule update radare2 ./build.sh
cd radare2 && ./sys/install.sh
cd ..
``` ```
##### Building cutter Building on Windows:
```batch
Cutter can be build with two methods: The preferred one is with qmake, but you can also compile it with cmake. Choose the one you want to use. set ARCH=x64
set PYTHON=C:\Python36-x64
- Method 1: Qmake prepare_r2.bat
```sh build.bat
mkdir build
cd build
qmake ../src
make
``` ```
- Method 2: CMake If any of those do not work, check the more detailed version [here](https://github.com/radareorg/cutter/blob/master/docs/Compiling.md).
```sh
mkdir build
cd build
cmake ../src
make
```
Then run cutter: `./Cutter` or `./build/Cutter`
Note: If radare2 is not installed system-wide (`./sys/user.sh` installation for instance) you might want to use `LD_LIBRARY_PATH=$HOME/bin/prefix/radare2/lib ./Cutter` to run cutter.
## Troubleshooting
Check this [page](https://github.com/radareorg/cutter/blob/master/docs/Common-errors.md) for common issues. Check this [page](https://github.com/radareorg/cutter/blob/master/docs/Common-errors.md) for common issues.
On Mac, QT5 apps fail to build on QtCreator if you have the libjpeg lib installed with brew. Run this command to workaround the issue:
sudo mv /usr/local/lib/libjpeg.dylib /usr/local/lib/libjpeg.dylib.not-found
If you encounter the `Project ERROR: r_core development package not found` try one of this commands instead:
- `PKG_CONFIG_PATH=$HOME/bin/prefix/radare2/lib/pkgconfig qmake`
- `PKG_CONFIG_PATH=$HOME/cutter/radare2/pkgcfg qmake` (for modern version and if radare2 was installed like the submodule)
## Platforms ## Platforms
Cutter is developed on OS X, Linux and Windows. The first release for users will include installers for all three platforms. Cutter is developed on OS X, Linux and Windows. The first release for users will include installers for all three platforms.

58
build.sh Executable file
View File

@ -0,0 +1,58 @@
#!/bin/sh
# This script is a work in progress
#### Constants ####
BUILDR2=1
#### User variables ####
BUILD="build"
#QMAKE_CONF="CONFIG+=CUTTER_ENABLE_JUPYTER CONFIG+=CUTTER_ENABLE_QTWEBENGINE"
QMAKE_CONF=""
# Checking for radare2
r2 -v >/dev/null 2>&1
if [ $? = 0 ]; then
R2COMMIT=$(r2 -v | tail -n1 | sed "s,commit: \\(.*\\) build.*,\\1,")
SUBMODULE=$(git submodule | awk '{print $1}')
if [ "$R2COMMIT" = "$SUBMODULE" ]; then
BUILDR2=0
fi
fi
# Check if qmake is available
qmake --help >/dev/null 2>&1
if [ $? != 0 ]; then
echo "You need qmake to build Cutter."
echo "Please make sure qmake is in your PATH environment variable."
exit 1
fi
# Build radare2
if [ $BUILDR2 -eq 1 ]; then
answer="Y"
echo -n "A (new?) version of radare2 will be installed. Do you agree? [Y/n] "
read answer
if [ "$answer" = "Y" ]; then
git submodule init && git submodule update
cd radare2 || exit 1
./sys/install.sh
cd ..
else
echo "Sorry but this script won't work otherwise. Read the README."
exit 1
fi
else
echo "Correct radare2 version found, skipping..."
fi
# Build
mkdir "$BUILD"
cd "$BUILD" || exit 1
qmake "$QMAKE_CONF" ../src/Cutter.pro
make
cd ..
# Done
echo "Build complete. Binary available at: $BUILD/Cutter"

View File

@ -1,8 +1,18 @@
# Common errors # Common errors
## Linux / OsX ## Errors on Linux or OS X
Please make sure you have the appropriate QT version: [https://www.qt.io/qt5-9/](https://www.qt.io/qt5-9/) Please make sure you have the appropriate QT version: [https://www.qt.io/qt5-9/](https://www.qt.io/qt5-9/)
### OS X compiling issues
On Mac, QT5 apps fail to build on QtCreator if you have the libjpeg lib installed with brew. Run this command to workaround the issue:
sudo mv /usr/local/lib/libjpeg.dylib /usr/local/lib/libjpeg.dylib.not-found
If you encounter the `Project ERROR: r_core development package not found` try one of this commands instead:
- `PKG_CONFIG_PATH=$HOME/bin/prefix/radare2/lib/pkgconfig qmake`
- `PKG_CONFIG_PATH=$HOME/cutter/radare2/pkgcfg qmake` (for modern version and if radare2 was installed like the submodule)
### Compilation error ### Compilation error
> r_core development package not found > r_core development package not found

View File

@ -1,58 +0,0 @@
# Compiling on Windows
## Cloning the project
Make sure that when cloning the project you use `git clone --recurse-submodules` or run `git submodule init` and `git submodule update` to clone the [iaito_win32](https://github.com/mrexodia/iaito_win32) submodule.
## Setting up Qt 5.6.2
It is advised to use [Qt 5.6.2](https://download.qt.io/archive/qt/5.6/5.6.2) to compile on Windows. Install one of the packages (MinGW or MSVC) before you start. If you want to use a different Qt version, make sure to change the commands below accordingly.
## Building Iaito
There are two main methods to build Iaito. Choose the one you prefer.
#### Building with Qt Creator
See [Adding Kits](http://doc.qt.io/qtcreator/creator-targets.html) for documentation on how to setup Qt kits (this works for both MinGW and MSVC). Once you have set up a kit simply open `Iaito.pro`, select a kit and compile.
#### Building with CMake
In the project root, run:
```batch
set CMAKE_PREFIX_PATH=c:\Qt\qt-5.6.2-msvc2013-x86\5.6\msvc2013\lib\cmake
mkdir build-cmake
cd build-cmake
cmake-gui ../src
```
Click `Configure` and select `Visual Studio 12 2013` from the list. After configuration is done, click `Generate` and you can open `Iaito.sln` to compile the code as usual.
## Deploying/Running Iaito
**These steps are required to get iaito.exe to run.**
You can use the following commands to deploy a standalone version of Iaito for your friends (assuming you have copied `iaito.exe` to a new empty directory and opened a terminal there).
```batch
set PATH=%PATH%;c:\Qt\qt-5.6.2-msvc2013-x86\5.6\msvc2013\bin
windeployqt iaito.exe
```
After this you will need to add the following files next to `iaito.exe` (they can usually be found in your system directories, OpenSSL binaries can be found [here](https://slproweb.com/products/Win32OpenSSL.html)):
```
libeay32.dll
ssleay32.dll
MSVCP120.dll
MSVCR120.dll
```
After that you have to extract the [recommended radare2 version](https://github.com/mrexodia/iaito_win32/releases/latest) (`radare2-XXXXXX.zip`) in this directory so that you have `iaito.exe` and `libr_core.dll` next to each other.
Starting `iaito.exe` should open the GUI. Typing `?d call` in the command bar should show you:
> calls a subroutine, push eip into the stack (esp)
![windows screenshot](https://i.imgur.com/BPKSSZY.png)

View File

@ -2,8 +2,6 @@
The "official" way to build Cutter is by using qmake, but as an alternative, a [CMakeLists.txt](https://github.com/radareorg/cutter/blob/master/src/CMakeLists.txt) is provided, so CMake can be used as well. The "official" way to build Cutter is by using qmake, but as an alternative, a [CMakeLists.txt](https://github.com/radareorg/cutter/blob/master/src/CMakeLists.txt) is provided, so CMake can be used as well.
This page provides a guide to compile on **Linux** or **macOS**, the process for Windows is described in [Compiling-on-Windows.md](Compiling-on-Windows.md).
## Requirements ## Requirements
* CMake >= 3.1 * CMake >= 3.1
* Radare2 installed from submodule, see [README.md](https://github.com/radareorg/cutter#requirements) * Radare2 installed from submodule, see [README.md](https://github.com/radareorg/cutter#requirements)
@ -24,6 +22,19 @@ If all went well, you should now have a working Makefile in your build directory
make make
``` ```
### On windows
Alternatively, on Windows you can run something like this (depending on your Cmake installation)
```batch
set CMAKE_PREFIX_PATH=c:\Qt\qt-5.6.2-msvc2013-x86\5.6\msvc2013\lib\cmake
cd src
mkdir build
cd build
cmake-gui ..
```
Click `Configure` and select `Visual Studio 12 2013` from the list. After configuration is done, click `Generate` and you can open `Cutter.sln` to compile the code as usual.
## Troubleshooting ## Troubleshooting
Depending on how Qt installed (Distribution packages or using the Qt installer application), CMake may not be able to find it by itself if it is not in a common place. If that is the case, double check that the correct Qt version is installed. Locate its prefix (a directory containing bin/, lib/, include/, etc.) and specify it to CMake using `CMAKE_PREFIX_PATH` in the above process, e.g.: Depending on how Qt installed (Distribution packages or using the Qt installer application), CMake may not be able to find it by itself if it is not in a common place. If that is the case, double check that the correct Qt version is installed. Locate its prefix (a directory containing bin/, lib/, include/, etc.) and specify it to CMake using `CMAKE_PREFIX_PATH` in the above process, e.g.:

42
docs/Compiling.md Normal file
View File

@ -0,0 +1,42 @@
# Compiling Cutter
Cutter supports different build systems:
* Building with qmake
* [Building with cmake](https://github.com/radareorg/cutter/blob/master/docs/Compiling-with-CMake.md)
* Building with meson (see ./meson.py)
Each time in the section below, the prefered method will be explained. For other methods check associated documentation.
## Requirements
* Qt (version differs from time to time but >= 5.6.1 should be fine)
* Radare2 (version changes, see `git submodule` to check the exact version)
* Python 3.6
### Compiling on Linux / OsX
The easy way is to simply run `./build.sh` from the root directory, and let the magic happen. The script will use qmake to build Cutter.
If you want to manually use qmake, follow this steps:
```
mkdir build; cd build
qmake ../src/Cutter.pro
make
cd ..
```
### Compiling on Windows
The easy way to compile on Windows is to run:
```
set PYTHON=C:\Python36-x64
set ARCH=x64
prepare_r2.bat
build.bat
```
## It doesn't work!
Check this [page](https://github.com/radareorg/cutter/blob/master/docs/Common-errors.md) for common issues.

View File

@ -21,12 +21,16 @@ DEFINES += APP_VERSION=\\\"$$VERSION\\\"
CUTTER_ENABLE_QTWEBENGINE { CUTTER_ENABLE_QTWEBENGINE {
message("Jupyter support enabled.") message("Jupyter support enabled.")
DEFINES += CUTTER_ENABLE_JUPYTER DEFINES += CUTTER_ENABLE_JUPYTER
} else {
message("Jupyter support disabled.")
} }
CUTTER_ENABLE_QTWEBENGINE { CUTTER_ENABLE_QTWEBENGINE {
message("QtWebEngine support enabled.") message("QtWebEngine support enabled.")
DEFINES += CUTTER_ENABLE_QTWEBENGINE DEFINES += CUTTER_ENABLE_QTWEBENGINE
QT += webenginewidgets QT += webenginewidgets
} else {
message("QtWebEngine support disabled.")
} }
INCLUDEPATH *= . INCLUDEPATH *= .