2017-12-07 16:50:10 +08:00
|
|
|
# Quick Start
|
|
|
|
|
|
|
|
A short chapter on downloading the Memgraph source, compiling and running.
|
|
|
|
|
|
|
|
## Obtaining the Source Code
|
|
|
|
|
|
|
|
Memgraph uses `git` for source version control. You will need to install `git`
|
|
|
|
on your machine before you can download the source code.
|
|
|
|
|
|
|
|
On Debian systems, you can do it inside a terminal with the following
|
|
|
|
command:
|
|
|
|
|
2020-11-13 03:18:11 +08:00
|
|
|
apt install git
|
2017-12-07 16:50:10 +08:00
|
|
|
|
|
|
|
After installing `git`, you are now ready to fetch your own copy of Memgraph
|
|
|
|
source code. Run the following command:
|
|
|
|
|
2020-10-22 00:56:15 +08:00
|
|
|
git clone https://github.com/memgraph/memgraph.git
|
2017-12-07 16:50:10 +08:00
|
|
|
|
|
|
|
The above will create a `memgraph` directory and put all source code there.
|
|
|
|
|
|
|
|
## Compiling Memgraph
|
|
|
|
|
|
|
|
With the source code, you are now ready to compile Memgraph. Well... Not
|
|
|
|
quite. You'll need to download Memgraph's dependencies first.
|
|
|
|
|
|
|
|
In your terminal, position yourself in the obtained memgraph directory.
|
|
|
|
|
|
|
|
cd memgraph
|
|
|
|
|
|
|
|
### Installing Dependencies
|
|
|
|
|
2020-11-13 03:18:11 +08:00
|
|
|
Dependencies that are required by the codebase should be checked by running the
|
|
|
|
`init` script:
|
|
|
|
|
|
|
|
./init
|
2017-12-07 16:50:10 +08:00
|
|
|
|
2020-11-13 03:18:11 +08:00
|
|
|
If the script fails, dependencies installation scripts could be found under
|
|
|
|
`environment/os/`. The directory contains dependencies management script for
|
|
|
|
each supported operating system. E.g. if your system is **Debian 10**, run the
|
|
|
|
following to install all required build packages:
|
2017-12-07 16:50:10 +08:00
|
|
|
|
2020-11-13 03:18:11 +08:00
|
|
|
./environment/os/debian-10.sh install MEMGRAPH_BUILD_DEPS
|
2017-12-07 16:50:10 +08:00
|
|
|
|
2020-11-13 03:18:11 +08:00
|
|
|
Once everything is installed, rerun the `init` script.
|
2017-12-07 16:50:10 +08:00
|
|
|
|
2020-11-13 03:18:11 +08:00
|
|
|
Once the `init` script is successfully finished, issue the following commands:
|
2017-12-07 16:50:10 +08:00
|
|
|
|
|
|
|
mkdir -p build
|
2019-04-19 16:44:25 +08:00
|
|
|
./libs/setup.sh
|
2017-12-07 16:50:10 +08:00
|
|
|
|
|
|
|
### Compiling
|
|
|
|
|
2019-04-19 16:44:25 +08:00
|
|
|
Memgraph is compiled using our own custom toolchain that can be obtained from
|
2020-11-13 03:18:11 +08:00
|
|
|
the toolchain repository. You should read the `environment/README.txt` file
|
|
|
|
in the repository and install the apropriate toolchain for your distribution.
|
|
|
|
After you have installed the toolchain you should read the instructions for the
|
|
|
|
toolchain in the toolchain install directory (`/opt/toolchain-vXYZ/README.md`)
|
|
|
|
and install dependencies that are necessary to run the toolchain.
|
2019-04-19 16:44:25 +08:00
|
|
|
|
|
|
|
When you want to compile Memgraph you should activate the toolchain using the
|
|
|
|
prepared toolchain activation script that is also described in the toolchain
|
|
|
|
`README`.
|
|
|
|
|
2020-11-13 03:18:11 +08:00
|
|
|
NOTE: You **must** activate the toolchain every time you want to compile
|
2019-04-19 16:44:25 +08:00
|
|
|
Memgraph!
|
|
|
|
|
|
|
|
You should now activate the toolchain in your console.
|
|
|
|
|
|
|
|
source /opt/toolchain-vXYZ/activate
|
|
|
|
|
|
|
|
With all of the dependencies installed and the build environment set-up, you
|
|
|
|
need to configure the build system. To do that, execute the following:
|
2017-12-07 16:50:10 +08:00
|
|
|
|
|
|
|
cd build
|
|
|
|
cmake ..
|
|
|
|
|
|
|
|
If everything went OK, you can now, finally, compile Memgraph.
|
|
|
|
|
|
|
|
make -j$(nproc)
|
|
|
|
|
|
|
|
### Running
|
|
|
|
|
|
|
|
After the compilation verify that Memgraph works:
|
|
|
|
|
|
|
|
./memgraph --version
|
|
|
|
|
|
|
|
To make extra sure, run the unit tests:
|
|
|
|
|
|
|
|
ctest -R unit -j$(nproc)
|
|
|
|
|
|
|
|
## Problems
|
|
|
|
|
|
|
|
If you have any trouble running the above commands, contact your nearest
|
|
|
|
developer who successfully built Memgraph. Ask for help and insist on getting
|
|
|
|
this document updated with correct steps!
|
2018-08-01 23:15:10 +08:00
|
|
|
|
|
|
|
## Next Steps
|
|
|
|
|
2019-05-17 19:49:26 +08:00
|
|
|
Familiarise yourself with our code conventions and guidelines:
|
2018-08-01 23:15:10 +08:00
|
|
|
|
|
|
|
* [C++ Code](cpp-code-conventions.md)
|
|
|
|
* [Other Code](other-code-conventions.md)
|
2019-05-17 19:49:26 +08:00
|
|
|
* [Code Review Guidelines](code-review.md)
|
2018-08-01 23:15:10 +08:00
|
|
|
|
|
|
|
Take a look at the list of [required reading](required-reading.md) for
|
|
|
|
brushing up on technical skills.
|