Skip to content

Latest commit

 

History

History
687 lines (476 loc) · 27.2 KB

INSTALL.md

File metadata and controls

687 lines (476 loc) · 27.2 KB

Building

System requirements

To build and run Organic Maps you'll need a machine with at least 4GB of RAM. Download and disk requirements depend on the target platform, build type, and selected clone options.

For Windows you need to have Git for Windows installed and Git bash available in the PATH.

Getting sources

First get the source code. The repository and its submodules are large, so use the clone options that suit your bandwidth and disk space.

For Windows, it's necessary to enable symlink support:

  1. Activate Windows Development Mode to enable symlinks globally:
  • Windows 10: Settings -> Update and Security -> For Developers -> Activate Developer Mode
  • Windows 11: Settings -> Privacy and Security -> For Developers -> Activate Developer Mode
  1. Enable symlinks support in git. The easiest way is to reinstall the latest Git for Windows with the "Enable Symlinks" checkbox checked. If you don't want to reinstall Git, then you can add -c core.symlinks=true parameter to the clone command below to enable symlinks for the repository.
git config --global core.symlinks true

Clone the repository including all submodules (see Special cases options below):

(if you plan to contribute and propose pull requests then use a web interface at https://github.com/organicmaps/organicmaps to fork the repository first and use your fork's URL in the command below)

git clone --recurse-submodules --shallow-submodules https://github.com/organicmaps/organicmaps.git

Go into the cloned repository:

cd organicmaps

Special cases options

If you're only doing a one-off build or your internet bandwidth or disk space is limited, add following options to the git clone command:

  • a --filter=blob:limit=128k option to make a partial clone. Blob files over 128KB are downloaded on demand; this is suitable for general development.

  • a --depth=1 option to make a shallow copy (and possibly --no-single-branch to retain all branches rather than only master). This omits history and is suitable for one-off builds.

If you mistakenly did a git clone without checking out submodules, you can run git submodule update --init --recursive. If you don't want to clone complete submodules, you can add --depth=1 to the update command.

Desktop app

Preparing

You need a Linux or a macOS machine to build a desktop version of Organic Maps. Windows users can use the WSL (Windows Subsystem for Linux) and follow "Linux or Mac" steps described below.

Linux or macOS

Ensure that you have at least 20GB of free space.

Install CMake (3.22.1 minimum), Qt 6, and the other dependencies.

Installing ccache can speed up active development.

Ubuntu

Fully supported versions

Ubuntu 24.04 or newer:

sudo apt update && sudo apt install -y \
    build-essential \
    cmake \
    ninja-build \
    python3 \
    qt6-base-dev \
    qt6-positioning-dev \
    libc++-dev \
    libfreetype-dev \
    libglvnd-dev \
    libgl1-mesa-dev \
    libharfbuzz-dev \
    libicu-dev \
    libqt6svg6-dev \
    libsqlite3-dev \
    zlib1g-dev
Workarounds for older Ubuntu versions
Software Minimum version Impacted Ubuntu release Workaround
CMake 3.22.1 20.04 and older Install newer cmake from PPA or from snap
with sudo snap install --classic cmake
FreeType 2.13.1 22.04 and older Install newer libfreetype6 and libfreetype-dev from PPA
GeoClue 2.5.7 20.04 and older Install newer geoclue-2.0 from PPA
Qt 6 6.4.0 22.04 and older Build and install Qt 6.4 manually
sudo add-apt-repository -y ppa:savoury1/qt-6-2

Linux Mint

Check which Ubuntu version is the PACKAGE BASE for your Linux Mint release here, and apply the Ubuntu workarounds accordingly.

Fedora

sudo dnf install -y \
    cmake \
    gcc \
    gcc-c++ \
    ninja-build \
    freetype-devel \
    libicu-devel \
    libstdc++-devel \
    mesa-libGL-devel \
    libglvnd-devel \
    qt6-qtbase-devel \
    qt6-qtpositioning \
    qt6-qtpositioning-devel \
    qt6-qtsvg-devel \
    sqlite-devel

Alpine

sudo apk add \
    cmake \
    freetype-dev \
    g++ \
    icu-dev \
    mesa-gl \
    ninja-build \
    qt6-qtbase-dev \
    qt6-qtpositioning-dev \
    qt6-qtsvg-dev \
    samurai \
    sqlite-dev

macOS

brew install cmake ninja qt@6

Optional developer sandbox

The developer graphics sandbox is enabled by default. Qt-only and command-line builds can omit it and its GLFW/ImGui dependencies with -DBUILD_DEV_SANDBOX=OFF. Selecting --target desktop alone does not skip CMake's dependency discovery.

On Linux the sandbox currently uses X11. Install these additional development packages only when building it:

Distribution Packages
Ubuntu libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev
Fedora libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel
Alpine libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev

To enable the sandbox again in an existing build directory, configure with -DBUILD_DEV_SANDBOX=ON and build the dev_sandbox target.

Note: Homebrew (Linuxbrew) Qt6 on Linux with NVIDIA

Installing Qt6 via Homebrew (Linuxbrew) on a Linux machine that uses the NVIDIA proprietary graphics driver is not recommended. Linuxbrew's Qt6 is built with a DT_RPATH entry that forces its bundled Mesa libGL.so.1 to be loaded at runtime, bypassing the system libglvnd dispatcher. The app silently falls back to software rendering (llvmpipe) and then crashes in qtoglcontextfactory.cpp when creating an offscreen GL surface.

Prefer the distribution's Qt6 packages listed in the sections above. If Linuxbrew's Qt6 must be used, preload the system libGL at runtime:

LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGL.so.1 ./OrganicMaps   # Debian/Ubuntu
LD_PRELOAD=/usr/lib64/libGL.so.1 ./OrganicMaps                  # Fedora/RHEL

Windows

Native Windows builds are compiled and unit-tested by CI with MSVC (see the windows-2025-vs2026 in .github/workflows/build-cmake.yaml and ci-windows presets in CMakePresets.json). Contributions are welcome.

You'll need to have python3, cmake, ninja, and Qt 6 in the PATH, and Visual Studio 2022 or newer (or its Build Tools) installed. Use Visual Studio Developer Command Prompt or generate Visual Studio project files with CMake to build the project.

Alternatively, WSL (Windows Subsystem for Linux) can be used to run GUI applications.

Windows 11 (WSL)

To run Linux GUI apps, you'll need to install a driver matching your system. This enables a virtual GPU allowing hardware-accelerated OpenGL rendering.

Once a GPU driver is installed and you have built the app you should be able to run it without any additional steps.

Windows 10 (WSL)

For Windows 10 you should do these steps (taken from here, check this blog post if you have any problems):

  1. Download and install VcXsrv Windows X Server.
  2. Run XLaunch app to launch X Server. During settings make sure "Disable access control" checkbox is selected.
  3. (optionally) Click "Save configuration" and save configuration to some file (for example to config.xlaunch). With this you will be able to quickly run the desktop app in the future.
  4. When asked about firewall, allow access for both public and private networks.
  5. Add this line:
    export DISPLAY=$(ip route|awk '/^default/{print $3}'):0.0
    to /etc/bash.bashrc file.
  6. Restart WSL.

Now when you want to run the desktop app you just need to first launch the X Server on Windows (for example, by running previously saved config.xlaunch file) and then you should be able to build and run the app from WSL.

Running X Server is also required to run generate_symbols.sh script when you change icons for styles

Building

The recommended way to configure and build is with CMake presets, run from the repository root. List configure/build/test presets with cmake --list-presets=all; list only test presets with ctest --list-presets.

To configure and build the desktop app in Debug (binaries go into build/debug):

cmake --preset debug -DBUILD_DEV_SANDBOX=OFF
cmake --build --preset debug --target desktop

Use --preset release for an optimized build (binaries in build/release). Other presets include relwithdebinfo, debug-no-unity (disables Unity batching for lower peak memory), coverage, and xcode (macOS only; generates an Xcode project, needed for dev_sandbox and Metal shader development).

On macOS dev_sandbox also needs Xcode's separately downloaded Metal toolchain. Install it with xcodebuild -downloadComponent MetalToolchain, otherwise CMake skips the target with a warning and the rest of the build proceeds as usual.

Besides desktop there are other targets like generator_tool; pass them to --target, or omit --target to build everything.

Alternatively, the tools/unix/build_omim.sh wrapper builds into ../omim-build-<buildtype> (run with -h for options, -d/-r for Debug/Release):

tools/unix/build_omim.sh -r desktop

Build issues

  • If you get "not enough memory" errors during builds, you may disable CMake Unity Builds by passing -DCMAKE_UNITY_BUILD=OFF option to cmake invocation. Or you can reduce Unity build batch size from the default 50 to a lower value (2-16) by passing -DCMAKE_UNITY_BUILD_BATCH_SIZE=8. Note that these changes may significantly increase the build time.

Running

A preset build puts binaries in build/<preset> (e.g. build/release); the build_omim.sh wrapper uses ../omim-build-<buildtype> instead.

A desktop app binary is OrganicMaps. To run e.g. a release version built with the release preset:

Linux:

build/release/OrganicMaps

macOS:

build/release/OrganicMaps.app/Contents/MacOS/OrganicMaps

On Linux, close older OMaps instances before the first OrganicMaps launch. It moves legacy directories under the XDG config and data roots to OrganicMaps. Populated destinations, symlinked legacy directories, and failed moves leave the old data intact for manual recovery.

Testing

Configure and compile all unit tests in Debug mode:

cmake --preset debug -DBUILD_DEV_SANDBOX=OFF
cmake --build --preset debug

Run the unit tests (the debug test preset filters to the omim-test label and excludes the suites that are known to be broken on CI):

ctest --preset debug

Rendering tests need offscreen GL, so they are run via a separate preset:

ctest --preset drape-debug

To run a limited set of tests, use -R <regex> flag. To exclude some tests, use -E <regex> flag:

cd build/debug
ctest -R "base_tests|coding_tests" --output-on-failure
ctest -L "omim-test" -E "base_tests|coding_tests" --output-on-failure

Some tests are known to be broken and disabled on CI.

To skip building tests, configure with -DBUILD_TESTING=OFF.

Test Coverage

To generate a test coverage report you'll need gcovr and gcov tools installed.

Platform gcovr gcov tools
Linux pip3 install gcovr GCC: sudo apt install gcc
Clang: sudo apt install llvm
macOS brew install gcovr Apple Clang: already included with Xcode Command Line Tools.
LLVM Clang: brew install llvm

Steps to generate coverage report:

  1. Configure with the coverage preset (enables COVERAGE_REPORT):
    cmake --preset coverage
  2. Compile unit tests: cmake --build --preset coverage.
  3. Run unit tests: ctest --preset coverage.
  4. Run coverage report generation:
    cmake --build --preset coverage --target omim_coverage
  5. Report can be found in the build/coverage/coverage_report folder.

Debug commands

Organic Maps has some "hidden" debug commands that you can trigger by entering them into the search box.

For example you can switch theme which is very useful for checking styles changes. To switch themes you can enter this commands:

  • ?light - Day theme
  • ?dark - Night theme
  • ?vlight - Day theme for vehicle navigation
  • ?vdark - Night theme for vehicle navigation
  • ?olight - Outdoors day theme
  • ?odark - Outdoors night theme

There are also other commands for turning on/off isolines, anti-aliasing, etc. Check DEBUG_COMMANDS.md to learn about them.

More options

To make the desktop app display maps in a different language add a -lang option, e.g. for the Russian language:

build/release/OrganicMaps -lang ru

By default OrganicMaps expects a repository's data folder to be present in the current working directory, add a -data_path option to override it.

Check OrganicMaps -help for a list of all run-time options.

When running the desktop app with lots of maps, increase the open files limit. In macOS the default value is only 256. Use ulimit -n 2000, put it into ~/.bash_profile to apply it to all new sessions. In macOS to increase this limit globally, add limit maxfiles 2048 2048 to /etc/launchd.conf and run

echo 'ulimit -n 2048' | sudo tee -a /etc/profile

If you have Qt installed in an unusual directory, use QT_PATH variable (SET (QT_PATH "your-path-to-qt")). You can skip building tests with -DBUILD_TESTING=OFF. You would need 1.5 GB of memory to compile the stats module.

The build_omim.sh script basically runs these commands:

    cmake <path_to_omim> -DCMAKE_BUILD_TYPE={Debug|Release}
    <make or ninja> [<target>] -j <number_of_processes>

Android app

Preparing

Linux, macOS, or Windows should work to build Organic Maps for Android.

Ensure that you have at least 30GB of free space and Python 3 installed.

Install Android Studio.

Run Android Studio and open the project in android/ directory! This is important, otherwise the following menus won't be visible.

Configure Android Studio:

  • Open "SDK Manager" (under "More Actions" in a welcome screen or a three-dot menu in a list of recent projects screen or "Tools" top menu item in an open project).
  • Switch to "SDK Tools" tab.
  • Check "Show Package Details" checkbox.
  • Select "CMake" version 3.22.1 or higher.
  • Click "Apply" and wait for downloads and installation to finish.
  • In the left pane menu select "Appearance & Behavior > System Settings > Memory Settings".
  • Set "IDE max heap size" to 2048MB or more (otherwise the Studio might get stuck on "Updating indexes" when opening the project).

Configure the repository with Android SDK paths. You can do it either by setting a global environment variable pointing at your Android SDK:

ANDROID_HOME=<here is the absolute path to the root folder of your Android SDK installation>

or by running the following script, that creates android/local.properties file with the line sdk.dir=<path to your Android SDK> in it:

Linux:

./tools/android/set_up_android.py --sdk $HOME/Android/Sdk

macOS:

./tools/android/set_up_android.py --sdk $HOME/Library/Android/Sdk

Windows 10: no action needed, should work out of the box.

Set up the emulator

Set up a virtual device to use emulator ("Tools > Device Manager") or use a hardware device for debugging. For the emulator its recommended to choose the latest supported API Level system image. Use ABI x86_64 for Intel-based processors and arm64-v8a for ARM-based processors (e.g. M1/M2 Macs).

Building

There is a matrix of different build variants:

  • Type:

    • Debug is a debug version with all checks enabled.
    • Beta is a manual pre-release build for testing.
    • Release is a fully optimized version for app stores.
  • Flavor:

    • Web is a light APK without any bundled maps.
    • Google is a full Google Play store version including a low-zoom overview world map.
    • Fdroid is a version for publishing on the F-Droid open source apps store (no bundled maps and no Google services).
    • ...and other flavors like Huawei.

You can choose a build variant in Android Studio's "Build > Select Build Variant..." menu. There you can also choose a target architecture (Active ABI) like x86_64 (for e.g. emulator) or arm64-v8a (many modern devices). In order to build the Google variant, you need a special key which only the core developers have. For community members who want to contribute, the best selection is "fdroidBeta" or "fdroidDebug" depending on the use case. The Active ABI can be set to "arm64-v8a".

To build and run the app in the emulator or on a hardware device use a "Run > Run (android)" menu item or press the Play / Debug button on the top right of the IDE.

To build a redistributable APK use a "Build > Build Bundle(s) / APK(s) > Build APK(s)" menu item. Generated APKs are stored in build/outputs/apk/.

See also https://developer.android.com/studio/run.

Debugging

To enable logging in case of crashes, after installing a debug version, run:

adb shell pm grant app.organicmaps.debug android.permission.READ_LOGS

Android Auto Development

Android Auto can be developed and tested without having a physical device by using Desktop Head Unit (DHU). Go to Android Studio > Tools -> SDK Manager -> SDK Tools and enable "Android Auto Desktop Head Unit".

Android Auto App is required for Auto functionality. The app should be installed from Google Play before connecting a phone to the Desktop Head Unit or a real car. Android Auto doesn't work on phones without Google Play Services.

To run Android Auto, connect the phone using USB cable and run the Desktop Head Unit with --usb flag:

~/Library/Android/sdk/extras/google/auto/desktop-head-unit --usb
[REDACTED]
[I]: Found device 'SAMSUNG SAMSUNG_Android XXXXXXXXX' in accessory mode (vid=18d1, pid=2d01).
[I]: Found accessory: ifnum: 0, rd_ep: 129, wr_ep: 1
[I]: Attaching to USB device...
[I]: Attached!

Organic Maps icon will appear in the application list in DHU.

More options

Building from the command line

First configure PATH to prefer cmake from the Android SDK instead of the default system install:

Linux:

export PATH=$HOME/Android/Sdk/cmake/3.22.1/bin:$PATH

macOS:

export PATH=$HOME/Library/Android/Sdk/cmake/3.22.1/bin:$PATH

Check if you have a system-wide Java Runtime Environment (JRE) installed:

java -version

If your system doesn't have a JRE installed or Java version is less than 17 (OpenJDK) or you want command line builds to use a JRE version bundled with the Studio then set the JAVA_HOME environment variable:

Linux:

export JAVA_HOME=<path-to-android-studio-installation>/android-studio/jre

macOS:

export JAVA_HOME=<path-to-android-studio-installation>/Contents/jre/Contents/Home

Run the builds from the android subdirectory of the repository:

cd android

To build, install and run e.g. a Web Debug version on your device/emulator:

./gradlew runWebDebug

Or to compile a redistributable Fdroid Beta APK for testing:

./gradlew assembleFdroidBeta

Or to build Beta APKs for all Flavors:

./gradlew assembleBeta

Run ./gradlew tasks to see all possible build variants.

Intermediate files for each build (Type + Flavor + target arch) take ~3-4.5Gb of space. To remove all intermediate build files run ./gradlew clean.

By default the build will run for all 3 target architectures: arm64-v8a, armeabi-v7a and x86_64. To speed up your build include only the arch you need by adding e.g. a -Parm64 option to the gradle build command (other options are -Parm32 for armeabi-v7a, -Px64 for x86_64 and -Px86 for x86).

To create separate APKs for all target arches add a -PsplitAPK option (by default all arches are combined in one "fat" APK).

Adding a -Ppch (use precompiled headers) option makes builds ~15% faster.

If building makes your computer slow and laggy, then try lowering the priority of the build process by adding a --priority=low option and/or add a -Pnjobs=<N> option to limit the number of parallel processes.

See also https://developer.android.com/studio/build/building-cmdline.

To add any of those options to in-studio builds list them in "Command-line Options" in "File > Settings... > Build, Execution, Deployment > Compiler"

Reduce resource usage

If you are low on RAM, disk space or traffic there are ways to reduce system requirements:

  • exclude the cpp folder from indexing - if you do not make any work on the C++ code, this will greatly improve the start-up performance and the ram usage of Android Studio; Click on the Project tab on the left, find the cpp folder (should be next to the java folder), right click on it and select Mark Directory as -> Excluded (red folder icon), then restart Android Studio;
  • in Android Studio enable "File > Power Save Mode";
  • disable the "Android NDK Support" plugin in "Settings -> Plugins" completely and use another IDE (Visual Studio Code, Qt Creator, etc.) for editing C++ code instead;
  • don't install Android Studio, run builds and emulator from command line (download command line tools first and then use the sdkmanager tool to install all required packages: platform-tools, build-tools, a right version of cmake, maybe emulator...; then set env vars);
  • build only for target arches you actually need, e.g. arm64;
  • for debugging use an older emulated device with low RAM and screen resolution, e.g. "Nexus S";
  • make sure the emulator uses hardware acceleration;
  • don't use emulator, debug on a hardware device instead.

Alternatives for working with C++ code

Android Studio has issues in parsing the C++ part of the project, please let us know if you know how to resolve it. As a workaround, for working C++ suggestions, you may use:

For Xcode, run cmake --preset xcode to generate the project (build/xcode/omim.xcodeproj); CLion and Qt Creator read CMakePresets.json directly (pick the debug preset).

Enable Vulkan Validation

  1. Download Vulkan Validation Layers
./tools/android/download_vulkan_validation_layers.py
  1. Set enableVulkanDiagnostics=ON in gradle.properties.

If you build the app from command line, the parameter can be passed via command line.

E.g.

./gradlew -Parm64 -PenableVulkanDiagnostics=ON runGoogleDebug

Enable tracing

  1. Set enableTrace=ON in gradle.properties.
  2. Follow the guide https://perfetto.dev/docs/quickstart/android-tracing to set-up Perfetto Example of command line for running system tracing:
./record_android_trace -a app.organicmaps.debug -o trace_file.perfetto-trace -t 30s -b 64mb sched freq idle am wm gfx view binder_driver hal dalvik camera input res memory

iOS app

Preparing

Building Organic Maps for iOS requires a Mac.

Ensure that you have at least 20GB of free space.

After getting all sources, please make sure that Command Line Tools are installed:

xcode-select --install

Then, install Xcode from the App Store.

Enroll in the Apple Developer Program (you can run Organic Maps in Simulator without this step).

Configuring Xcode

Set up your developer account and add certificates:

  • Open Xcode.
  • Click "Xcode" → "Preferences".
  • Open "Account" tab.
  • Enter account credentials from the previous step.
  • Click "Manage Certificates".
  • Click "+" and choose "Apple Development".
  • You may also need to register your Mac in your Apple Developer account.

Reconfigure the project to use your developer signing keys:

  • Open xcode/omim.xcworkspace in Xcode.
  • Click on "Maps" project.
  • Open "Signing & Capabilities" tab.
  • Choose a unique bundle identifier (not app.organicmaps.debug) and your team.
  • Select "Automatically manage signing".

If you want to run Organic Maps on a real device, you have to remove the CarPlay entitlement. Open iphone/Maps/OMaps-Debug.entitlements and remove the com.apple.developer.carplay-maps entry. Now you can sign your app again in the "Signing & Capabilities" tab. Testing CarPlay on a real device requires requesting entitlements from Apple.

Building and running

Open xcode/omim.xcworkspace in Xcode.

Select "OMaps" product scheme.

  • Choose "Your Mac (Designed for iPad)" to run on Mac without using Simulator.
  • Choose either "iPhone _" or "iPad _" to run in the Simulator.

Compile and run the project ("Product" → "Run").

Map data and styles

See readme for the map generator and styles if you need to customize the map files and styles.