"Fossies" - the Fresh Open Source Software Archive

Member "cutter-1.10.3/docs/source/building.rst" (8 May 2020, 8083 Bytes) of package /linux/privat/cutter-1.10.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format (assuming markdown format). Alternatively you can here view or download the uninterpreted source code file. A member file download can also be achieved by clicking within a package contents listing on the according byte size field. See also the latest Fossies "Diffs" side-by-side code changes report for "building.rst": 1.10.2_vs_1.10.3.

Building

Note

If you just want to use the latest Release version of Cutter, please note that we provide pre-compiled binaries for Windows, Linux and macOS on our release page.

Building on Linux

Requirements

On Linux, you will need:

On Debian-based Linux distributions, all of these packages can be installed with this single command:

sudo apt install git build-essential cmake meson libzip-dev zlib1g-dev qt5-default libqt5svg5-dev

On Arch-based Linux distributions, build-essential should be replaced by base-devel:

sudo pacman -Syu git base-devel cmake meson qt5-base qt5-svg

Building steps

The official way to build Cutter on Linux is by using CMake. First, clone the repository with its dependencies:

git clone --recurse-submodules https://github.com/radareorg/cutter

Then invoke CMake to build Cutter and its dependency radare2.

cd cutter
mkdir build && cd build
cmake -DCUTTER_USE_BUNDLED_RADARE2=ON ../src
cmake --build .

If your operating system has a newer version of CMake (> v3.12) you can use this cleaner solution:

cd cutter
cmake -S src -B build -DCUTTER_USE_BUNDLED_RADARE2=ON
cmake --build build

Note

If you are interested in building Cutter with support for Python plugins, Syntax Highlighting, Crash Reporting and more, please look at the full list of CMake Building Options.

After the build process is complete, you should have the Cutter executable in the build folder. You can now execute Cutter like this:

./build/Cutter

Building on Windows

Requirements

Cutter works on Windows starting from Windows 7 up to Windows 10. To compile Cutter it is necessary to have installed:

Default way

To build Cutter on Windows machines using CMake, you will have to make sure that the executables are available in your %PATH% environment variable.

Note that the paths below may vary depending on your version of Qt and Visual Studio.

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 your version of Visual Studio from the list, for example Visual Studio 14 2015. After configuration is done, click Generate and you can open Cutter.sln to compile the code as usual.

Building with Meson

There is another way to compile Cutter on Windows, if the one above does not work or does not suit your needs.

Additional requirements:

Download and unpack Ninja to the Cutter source root directory.

Note that in the below steps, the paths may vary depending on your version of Qt and Visual Studio.

Environment settings (example for x64 version):

:: Export MSVC variables
CALL "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
:: Add qmake to PATH
SET "PATH=C:\Qt\5.10.1\msvc2015_64\bin;%PATH%"
:: Add Python to PATH
SET "PATH=C:\Program Files\Python36;%PATH%"

Install Meson:

python -m pip install meson

To compile Cutter, run:

CALL prepare_r2.bat
CALL build.bat

Building with Qmake

Using QtCreator

One standard way is to simply load the project inside QtCreator. To do so, open QtCreator and on the welcome screen click on "Open Project", and finally select the cutter/src/Cutter.pro file. QtCreator will then allow you to directly edit the source code and build the project.

Note

For the .pro file to be compiled successfully, it is required to run prepare_r2.bat beforehand.

Compiling on Linux / macOS

The easiest way, but not the one we recommend, is to simply run ./build.sh from the root directory, and let the magic happen. The script will use qmake to build Cutter. The build.sh script is meant to be deprecated and will be deleted in the future.

If you want to manually use qmake, follow these steps:

mkdir build; cd build
qmake ../src/Cutter.pro
make
cd ..

Additional steps for macOS

On macOS you will also have to copy the launcher bash script:

mv Cutter.app/Contents/MacOS/Cutter Cutter.app/Contents/MacOS/Cutter.bin
cp ../src/macos/Cutter Cutter.app/Contents/MacOS/Cutter && chmod +x Cutter.app/Contents/MacOS/Cutter

CMake Building Options

Note that there are some major building options available:

These options can be enabled or disabled from the command line arguments passed to CMake. For example, in order to build Cutter with support for Python plugins, you can run this command:

cmake -B build -DCUTTER_ENABLE_PYTHON=ON -DCUTTER_ENABLE_PYTHON_BINDINGS=ON

Or if one wants to explicitely disable an option:

cmake -B build -DCUTTER_ENABLE_PYTHON=OFF

Compiling Cutter with Breakpad support

If you want to build Cutter with crash handling system, you will want to first prepare Breakpad. For this, simply run one of the scripts (according to your OS) from root Cutter directory:

source scripts/prepare_breakpad_linux.sh # Linux
source scripts/prepare_breakpad_macos.sh # MacOS
scripts/prepare_breakpad.bat # Windows

Then if you are building on Linux you want to change PKG_CONFIG_PATH environment variable so it contains $CUSTOM_BREAKPAD_PREFIX/lib/pkgconfig. For this simply run

export PKG_CONFIG_PATH="$CUSTOM_BREAKPAD_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"

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.:

rm CMakeCache.txt # the cache may be polluted with unwanted libraries found before
cmake -DCMAKE_PREFIX_PATH=/opt/Qt/5.9.1/gcc_64 ..

The exact r2 .so file that cannot be found may vary. On some systems, the linker by default uses RUNPATH instead of RPATH which is incompatible with the way r2 is currently compiled. It results in some of the r2 libraries not being found when running cutter. You can verify if this is the problem by running ldd ./Cutter. If all the r2 libraries are missing you have a different problem. The workaround is to either add the --disable-new-dtags linker flag when compiling Cutter or add the r2 installation path to LD_LIBRARY_PATH environment variable.

cmake -DCMAKE_EXE_LINKER_FLAGS="-Wl,--disable-new-dtags"  ..