diff --git a/next.config.mjs b/next.config.mjs index d88c84826..5cd5a5779 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -3405,7 +3405,36 @@ export default withNextra({ destination: '/ai-ecosystem#graphchat', permanent: true }, - + { + source: '/getting-started/build-memgraph-from-source#obtaining-the-source-code', + destination: '/getting-started/build-memgraph-from-source#obtain-the-source-code', + permanent: true + }, + { + source: '/getting-started/build-memgraph-from-source#downloading-the-dependencies', + destination: '/getting-started/build-memgraph-from-source#download-dependencies-required-for-methods-1--2', + permanent: true + }, + { + source: '/getting-started/build-memgraph-from-source#compiling', + destination: '/getting-started/build-memgraph-from-source#toolchain-installation-required-for-methods-1--2', + permanent: true + }, + { + source: '/getting-started/build-memgraph-from-source#toolchain-installation-procedure', + destination: '/getting-started/build-memgraph-from-source#toolchain-installation-required-for-methods-1--2', + permanent: true + }, + { + source: '/getting-started/build-memgraph-from-source#installing-memgraph-dependencies', + destination: '/getting-started/build-memgraph-from-source#download-dependencies-required-for-methods-1--2', + permanent: true + }, + { + source: '/getting-started/build-memgraph-from-source#running-memgraph', + destination: '/getting-started/build-memgraph-from-source#run-memgraph', + permanent: true + }, // END: NEW MEMGRAPH LAB REDIRECTS diff --git a/pages/advanced-algorithms/install-mage.mdx b/pages/advanced-algorithms/install-mage.mdx index 2e60d6adf..909415e0d 100644 --- a/pages/advanced-algorithms/install-mage.mdx +++ b/pages/advanced-algorithms/install-mage.mdx @@ -93,7 +93,7 @@ sudo apt-get update && sudo apt-get install -y \ git \ pkg-config \ uuid-dev \ - libxmlsec1-dev xmlsec1 \ + xmlsec1 \ --no-install-recommends ``` @@ -109,7 +109,7 @@ git clone --recurse-submodules https://github.com/memgraph/mage.git && cd mage Download and install the [Memgraph Toolchain](https://memgraph.com/docs/getting-started/build-memgraph-from-source#toolchain-installation-procedure): ```bash -curl -L https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-ubuntu-24.04-amd64.tar.gz -o toolchain.tar.gz +curl -L https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-ubuntu-24.04-amd64.tar.gz -o toolchain.tar.gz sudo tar xzvfm toolchain.tar.gz -C /opt ``` @@ -146,7 +146,7 @@ python3 -m pip install -r python/requirements-gpu.txt Run the following command: ```shell -source /opt/toolchain-v6/activate +source /opt/toolchain-v7/activate python3 setup build sudo cp -r dist/* /usr/lib/memgraph/query_modules ``` diff --git a/pages/getting-started/_meta.ts b/pages/getting-started/_meta.ts index 6f2d4b72a..0da9019e4 100644 --- a/pages/getting-started/_meta.ts +++ b/pages/getting-started/_meta.ts @@ -1,7 +1,8 @@ export default { "install-memgraph": "Install Memgraph", "cli": "CLI", - "first-steps-with-docker": "First steps with Docker" + "first-steps-with-docker": "First steps with Docker", + "build-memgraph-from-source": "Build Memgraph from source" } diff --git a/pages/getting-started/build-memgraph-from-source.mdx b/pages/getting-started/build-memgraph-from-source.mdx index 2adad95a6..38aab2488 100644 --- a/pages/getting-started/build-memgraph-from-source.mdx +++ b/pages/getting-started/build-memgraph-from-source.mdx @@ -1,5 +1,5 @@ --- -title: Building Memgraph from source +title: Build Memgraph from source description: This is a comprehensive guide for compiling Memgraph from source. It includes setting up the necessary toolchain, compiling the code, and running Memgraph. --- @@ -7,7 +7,7 @@ import { Callout } from 'nextra/components' import { Steps } from 'nextra/components' -# Building Memgraph from source +# Build Memgraph from source Follow this guide if you want to compile a Memgraph from a source. Here you will find all the necessary steps, including setting up the necessary toolchain, @@ -27,13 +27,9 @@ If you are using Mac M1 or above, please check our [MacOS Lima Compilation Guide](https://www.notion.so/MacOS-Lima-Compilation-Guide-eae1e9dcef5740579c5a41075b8f499b?pvs=21) first. -ARM build instructions are located at [Building Memgraph for ARM64 -CPU](https://www.notion.so/Building-Memgraph-for-ARM64-CPU-a73d243c3c7c4daa94cb574ca8ff9516?pvs=21) -document. - -## Obtaining the Source Code +## Obtain the Source Code After installing `git`, you are now ready to fetch your own copy of the Memgraph source code. Run the following command: @@ -44,16 +40,27 @@ git clone git@github.com:memgraph/memgraph.git The above will create a `memgraph` directory and put all source code there. -## Downloading the dependencies - -Before you can compile Memgraph, you first need to download its dependencies - In your terminal, position yourself in the obtained memgraph directory. ```bash cd memgraph ``` +

Choose build method

+ +There are three different methods for building Memgraph: + +1. Using the `build.sh` script (Recommended) +2. Manually with `conan` and `cmake` (Advanced) +3. Docker (ideal for unsupported systems) + +Before using methods 1 or 2, you must **download dependencies and install the +toolchain**. + +## Download dependencies (required for methods 1 & 2) + +Before you can compile Memgraph, you first need to download its dependencies. + Building Memgraph depends on some system-wide packages. The installation scripts can be found under `environment/os/`. The directory contains a dependencies management script for each supported operating system. @@ -63,17 +70,18 @@ sudo ./environment/os/install_deps.sh install TOOLCHAIN_RUN_DEPS sudo ./environment/os/install_deps.sh install MEMGRAPH_BUILD_DEPS ``` -The first command installs all the packages necessary for the Memgraph toolchain -to work correctly. The second command installs the system-wide packages that are -not necessary for the toolchain but are required by Memgraph. +- The first command installs all the packages necessary for the Memgraph +toolchain to work correctly. +- The second command installs the system-wide packages that are not necessary +for the toolchain but are required by Memgraph. - Based on your OS, version and architecture, execute appropriate scripts (e.g., on **Debian 11**, NOTE: the following commands/scripts are located under [memgraph repository](https://github.com/memgraph/memgraph/tree/master/environment/os): + Based on your OS, version and architecture, execute appropriate scripts (e.g., on **Debian 12**, NOTE: the following commands/scripts are located under [memgraph repository](https://github.com/memgraph/memgraph/tree/master/environment/os): ```bash - sudo ./environment/os/debian-11.sh install TOOLCHAIN_RUN_DEPS - sudo ./environment/os/debian-11.sh install MEMGRAPH_BUILD_DEPS + sudo ./environment/os/debian-12.sh install TOOLCHAIN_RUN_DEPS + sudo ./environment/os/debian-12.sh install MEMGRAPH_BUILD_DEPS ``` For ARM look for `-arm` in the script name (e.g., on Ubuntu 24.04 with Apple M processor): @@ -86,7 +94,7 @@ not necessary for the toolchain but are required by Memgraph. Once everything is installed, you can proceed to the compilation. -## Compiling +## Toolchain installation (required for methods 1 & 2) Memgraph is compiled using our own custom toolchain that can be obtained from the toolchain repository. All our tools used in the development of Memgraph are @@ -106,20 +114,20 @@ You should read the [Toolchain](https://www.notion.so/Toolchain-37c37c84382149a58d09b2ccfcb410d7?pvs=21) to install the appropriate toolchain for your distribution. -### Toolchain installation procedure - Download the toolchain for your operating system from one of the following links: -- [CentOS 9](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-centos-9-x86_64.tar.gz) -- [CentOS 10](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-centos-10-x86_64.tar.gz) -- [Debian 11 (x86_64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-debian-11-amd64.tar.gz) -- [Debian 11 (arm64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-debian-11-arm64.tar.gz) -- [Debian 12 (x86_64)](https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-debian-12-amd64.tar.gz) -- [Debian 12 (arm64)](https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-debian-12-arm64.tar.gz) -- [Fedora 41 (x86_64)](https://s3.eu-west-1.amazonaws.com/download.memgraph.com/memgraph/v3.1.1/fedora-41/memgraph-3.1.1_1-1.x86_64.rpm) -- [Ubuntu 22.04 (x86_64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-ubuntu-22.04-amd64.tar.gz) -- [Ubuntu 24.04 (x86_64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-ubuntu-24.04-amd64.tar.gz) -- [Ubuntu 24.04 (arm64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v6/toolchain-v6-binaries-ubuntu-24.04-arm64.tar.gz) +- [CentOS 9](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-centos-9-x86_64.tar.gz) +- [CentOS 10](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-centos-10-x86_64.tar.gz) +- [Debian 12 (x86_64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-debian-12-amd64.tar.gz) +- [Debian 12 (arm64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-debian-12-arm64.tar.gz) +- [Debian 13 (x86_64)](https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-debian-13-amd64.tar.gz) +- [Debian 13 (arm64)](https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-debian-13-arm64.tar.gz) +- [Fedora 42 (x86_64)](https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-fedora-42-x86_64.tar.gz) +- [Fedora 42 (arm64)](https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-fedora-42-aarch64.tar.gz) +- [Rocky Linux 10 (x86_64)](https://s3.eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-rocky-10-x86_64.tar.gz) +- [Ubuntu 22.04 (x86_64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-ubuntu-22.04-amd64.tar.gz) +- [Ubuntu 24.04 (x86_64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-ubuntu-24.04-amd64.tar.gz) +- [Ubuntu 24.04 (arm64)](https://s3-eu-west-1.amazonaws.com/deps.memgraph.io/toolchain-v7/toolchain-v7-binaries-ubuntu-24.04-arm64.tar.gz) Extract the toolchain with the following command: @@ -130,101 +138,170 @@ sudo tar xzvfm {{toolchain-archive}}.tar.gz -C /opt After you have installed the toolchain, you should read the instructions for the -toolchain in the toolchain install directory (`/opt/toolchain-v6/README.md`) +toolchain in the toolchain install directory (`/opt/toolchain-v7/README.md`) and install dependencies that are necessary to run the toolchain. If you have not already installed toolchain dependencies, please check and -install required toolchain runtime dependencies by executing +install required toolchain runtime dependencies as in the section above. + + + +If you put the toolchain on some other path, it’s possible to say to the `cmake` +the root is there, that is done by [setting `MG_TOOLCHAIN_ROOT` environment +variable](https://www.notion.so/If-you-put-toolchain-on-some-other-path-it-s-possible-to-say-to-the-cmake-there-the-root-is-that-s-e45311092e9a454eb73c720bf9ef04c1?pvs=21). + +That’s also useful where you have different versions of libraries under system +compare to what the Memgraph build process needs. + + + +## Use `build.sh` script + +This method is the easiest way to build Memgraph directly on a compatible host +system. + +Calling the script with no arguments will build everything, including tests, for +the `Release` build type: ```bash -sudo ./environment/os/install_deps.sh check TOOLCHAIN_RUN_DEPS -sudo ./environment/os/install_deps.sh install TOOLCHAIN_RUN_DEPS +./build.sh ``` - +Optionally you can specify target and build types, e.g. - Based on your OS, version and architecture, execute appropriate scripts (e.g., on Debian 11, NOTE: the following commands/scripts are located under [memgraph repository](https://github.com/memgraph/memgraph)): +```bash +./build.sh --target memgraph --build-type Debug +``` - ```bash - sudo ./environment/os/debian-11.sh check TOOLCHAIN_RUN_DEPS - sudo ./environment/os/debian-11.sh install TOOLCHAIN_RUN_DEPS - ``` - - For ARM look for `-arm` in script name (e.g. on Ubuntu 24.04 with Apple M processor): - - ```bash - sudo ./environment/os/ubuntu-24.04-arm.sh check TOOLCHAIN_RUN_DEPS - sudo ./environment/os/ubuntu-24.04-arm.sh install TOOLCHAIN_RUN_DEPS - ``` - +where the build type can be `Release` (default), `Debug` or `RelWithDebInfo`. + + +Other cmake options can be passed as well, e.g. to disable testing: + +```bash +./build.sh --target memgraph --build-type Release -DMG_ENABLE_TESTING=OFF +``` + +The resulting binary will be in the `build/` directory. + +## Use `conan` and `cmake` -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`. +This approach offers greater flexibility and granular control over the build process. +While it performs the same operations as the `build.sh` script, it gives you direct access +to configure individual build parameters and dependencies. -You must activate the toolchain every time you want to compile Memgraph: +To build Memgraph using this method, follow these steps: + + +

Create a Python virtual environment and install `conan`

```bash -source /opt/toolchain-v6/activate +python3 -m venv env +source env/bin/activate +pip install conan +conan profile detect ``` -In case you need to deactivate the toolchain, you can run: +

Run the init script to fetch other libs required for the build

```bash -deactivate +./init ``` - +

Install conan dependencies

-If you put the toolchain on some other path, it’s possible to say to the `cmake` -the root is there, that is done by [setting `MG_TOOLCHAIN_ROOT` environment -variable](https://www.notion.so/If-you-put-toolchain-on-some-other-path-it-s-possible-to-say-to-the-cmake-there-the-root-is-that-s-e45311092e9a454eb73c720bf9ef04c1?pvs=21). +```bash +export MG_TOOLCHAIN_ROOT=/opt/toolchain-v7 +conan install . --build=missing -pr ./memgraph_template_profile -s build_type=Release +source build/generators/conanbuild.sh +``` -That’s also useful where you have different versions of libraries under system -compare to what the Memgraph build process needs. +

Configure the project with cmake

-
+Note that the name of the preset depends on the build type set in the previous +step. + +```bash +cmake --preset conan-release +``` -## Installing Memgraph dependencies +

Build the project

-In addition to the system-wide dependencies, Memgraph requires certain libraries -to be built locally. The proper setup of these libraries should be checked by -running the `init` script: +The following command will build everything, including tests. ```bash -./init +cmake --build --preset conan-release -j$(nproc) ``` - +

Or for a specific target (e.g. Memgraph binary)

-Make sure to activate the toolchain before the `./init` command. +```bash +cmake --build --preset conan-release --target memgraph -j$(nproc) +``` +
-
-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: +## Use Docker + +Start by setting the environment variables for the desired OS, architecture, and build type: ```bash -mkdir -p build -cd build -cmake .. +export OS="ubuntu-24.04" +export ARCH="amd" # or arm +export BUILD_TYPE="Release" +export TOOLCHAIN="v7" ``` -If only Memgraph binary is required you can run build using: +Next, pull the appropriate Docker image for the build, e.g.: -```jsx -make -j$(nproc) memgraph +```bash +docker pull memgraph/mgbuild:v7_ubuntu-24.04 ``` -If you need to compile the whole project (e.g., unit tests) run: +Available image tags can be found [here](https://hub.docker.com/r/memgraph/mgbuild/tags). + +Then spin up the container: ```bash -make -j$(nproc) +./release/package/mgbuild.sh \ + --toolchain $TOOLCHAIN \ + --os $OS \ + --arch $ARCH \ + --build-type $BUILD_TYPE \ + run ``` -## Running Memgraph +Then build Memgraph: +```bash +./release/package/mgbuild.sh \ + --toolchain $TOOLCHAIN \ + --os $OS \ + --arch $ARCH \ + --build-type $BUILD_TYPE \ + build-memgraph +``` + +Run Memgraph inside the container (the name of the container will look something like `mgbuild_v7_ubuntu-24.04`): +```bash +# find the name of the container +docker ps + +# run Memgraph +docker exec -i mgbuild_v7_ubuntu-24.04 bash -c "cd /home/mg/memgraph && ./build/memgraph" +``` + +Stop the container: +```bash +./release/package/mgbuild.sh \ + --toolchain $TOOLCHAIN \ + --os $OS \ + --arch $ARCH \ + stop --remove +``` + +## Run Memgraph After the compilation, verify that Memgraph works: @@ -232,8 +309,20 @@ After the compilation, verify that Memgraph works: ./memgraph --version ``` -The unit tests can be run using +The unit tests can be run using: ```bash ctest -R unit -j$(nproc) ``` + +Or in Docker: + +```bash +./release/package/mgbuild.sh \ + --toolchain $TOOLCHAIN \ + --os $OS \ + --arch $ARCH \ + --enterprise-license $MEMGRAPH_ENTERPRISE_LICENSE \ + --organization-name $MEMGRAPH_ORGANIZATION_NAME \ + test-memgraph unit +``` diff --git a/pages/getting-started/install-memgraph.mdx b/pages/getting-started/install-memgraph.mdx index 2f468fba1..70cf61d1f 100644 --- a/pages/getting-started/install-memgraph.mdx +++ b/pages/getting-started/install-memgraph.mdx @@ -83,7 +83,7 @@ installation options and pick the preferred one. href="/getting-started/install-memgraph/wsl" /> diff --git a/pages/getting-started/install-memgraph/debian.mdx b/pages/getting-started/install-memgraph/debian.mdx index 33faf1e46..f1b392cef 100644 --- a/pages/getting-started/install-memgraph/debian.mdx +++ b/pages/getting-started/install-memgraph/debian.mdx @@ -9,7 +9,7 @@ import CodeSnippet from '/components/code-snippet/CodeSnippet' # Install Memgraph on Debian -Install and run Memgraph on Debian 11 or Debian 12. +Install and run Memgraph on Debian 12 or Debian 13. Newer versions of Memgraph might not be backward diff --git a/pages/getting-started/install-memgraph/fedora.mdx b/pages/getting-started/install-memgraph/fedora.mdx index 230cb65f7..89c828ed5 100644 --- a/pages/getting-started/install-memgraph/fedora.mdx +++ b/pages/getting-started/install-memgraph/fedora.mdx @@ -10,7 +10,7 @@ import CodeSnippet from '/components/code-snippet/CodeSnippet' # Install Memgraph on Fedora from RPM package Install and run Memgraph from a RPM package on: - - **Fedora 41** + - **Fedora 42** Newer versions of Memgraph might not be backward @@ -32,9 +32,9 @@ You can also use [direct download links](/getting-started/install-memgraph/direct-download-links) to get the latest Memgraph packages. -For example, for Fedora 39: +For example, for Fedora 42: - + @@ -50,7 +50,7 @@ After downloading the Memgraph RPM package, you can install it by issuing the following command: ``` console -sudo dnf install -y ./memgraph-3.1.1_1-1.x86_64.rpm +sudo dnf install -y ./memgraph-3.7.0_1-1.x86_64.rpm ``` If you run into any troubles while installing Memgraph, contact us on diff --git a/pages/getting-started/install-memgraph/rocky.mdx b/pages/getting-started/install-memgraph/rocky.mdx index 045ad9073..a0ff55afd 100644 --- a/pages/getting-started/install-memgraph/rocky.mdx +++ b/pages/getting-started/install-memgraph/rocky.mdx @@ -9,15 +9,9 @@ import CodeSnippet from '/components/code-snippet/CodeSnippet' # Install Memgraph on Rocky from RPM package - -The last released Memgraph RPM package for Rocky was for version 3.0.0. If you -require a package for a newer version, please [open an -issue](https://github.com/memgraph/memgraph/issues) on the Memgraph GitHub -repository. - Install and run Memgraph from a RPM package on: - - **Rocky 9.3** + - **Rocky 10** Newer versions of Memgraph might not be backward @@ -41,7 +35,7 @@ latest Memgraph packages. For example: - + @@ -57,7 +51,7 @@ After downloading the Memgraph RPM package, you can install it by issuing the following command: ``` -sudo dnf install -y ./memgraph-3.0.0_1-1.x86_64.rpm +sudo dnf install -y ./memgraph-3.7.0_1-1.x86_64.rpm ``` If you run into any troubles while installing Memgraph, contact us on