Se rendre au contenu
CTech Digital
  • Accueil
  • Services Odoo
  • Services d'IA
  • Contactez-nous
  • 0
  • Nederlands (BE) English (UK) Français
CTech Digital
  • 0
    • Accueil
    • Services Odoo
    • Services d'IA
    • Contactez-nous
  • Nederlands (BE) English (UK) Français

Linux compile ObjectCommunicationLibrary

  • Tous les blogs
  • Daily blog
  • Linux compile ObjectCommunicationLibrary
  • 23 juillet 2025 par
    CTech Metrology, Luc Wens

    Get a password

    From here https://xenomatix.visualstudio.com/_usersSettings/tokens

    New token and copy it.

    On the linux system credential have to be entered every time when interacting with the remote repository. To prevent this you can use Git Credential manager

    wget https://github.com/GitCredentialManager/git-credential-manager/releases/latest/download/gcm-linux_amd64.2.0.935.deb
    sudo dpkg -i gcm-linux_amd64.2.0.935.deb
    
    git config --global credential.helper manager-core

    On a Jetson

    Go to 

    https://github.com/git-ecosystem/git-credential-manager/releases


    # Download the ARM64 version
    wget https://github.com/git-ecosystem/git-credential-manager/releases/latest/download/gcm-linux_arm64.2.5.1.tar.gz
    
    # Extract it
    tar -xzf gcm-linux_arm64.2.5.1.tar.gz
    
    # Move to a system directory
    sudo mv gcm-linux_arm64/* /usr/local/bin/
    
    # Make it executable
    sudo chmod +x /usr/local/bin/git-credential-manager
    
    # Configure Git to use it
    git config --global credential.helper manager
    
    

    Clone repository

    Clone from https://xenomatix.visualstudio.com/XenoWare/_git/ObjectCommunicationLibrary

    Use luc.wens@ctechmetrology.com  and the password from the previous step.

    Recurse vcpkg

    git submodule update --init --recursive

    Install dependencies via vcpkg

    ./vcpkg/bootstrap-vcpkg.sh 


    Full list of steps to build

    This guide walks through building a C++ project with vcpkg dependencies on Ubuntu from scratch.

    Prerequisites Setup

    Update System Package Manager

    sudo apt update
    

    Install Essential Development Tools

    # Install C++20 compiler and build tools
    sudo apt install build-essential
    sudo add-apt-repository ppa:ubuntu-toolchain-r/test
    sudo apt install gcc-13 g++-13
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100
    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 100
    
    # Install CMake
    sudo apt install cmake
    
    # Install Ninja build system
    sudo apt install ninja-build
    
    # Install system dependencies that might be needed
    sudo apt install libssl-dev zlib1g-dev pkg-config
    

    Project Setup

    Initialize vcpkg (if not already done)

    ./vcpkg/bootstrap-vcpkg.sh
    

    Build Process

    Configure with CMake

    rm -rf out/build/x64-Debug
    cmake -B out/build/x64-Debug -DCMAKE_TOOLCHAIN_FILE="./vcpkg/scripts/buildsystems/vcpkg.cmake"
    cmake --build out/build/x64-Debug

    On ARM

    rm -rf out/build/arm-Debug
    cmake -B out/build/arm-Debug -DCMAKE_TOOLCHAIN_FILE="./vcpkg/scripts/buildsystems/vcpkg.cmake"

    cmake --build out/build/arm-Debug

    Optional: Create CMakePresets.json for Future Builds

    Create a CMakePresets.json file in your project root to make vcpkg toolchain automatic:

    {
        "version": 3,
        "configurePresets": [
            {
                "name": "x64-Debug",
                "displayName": "x64 Debug",
                "description": "Debug build with vcpkg dependencies",
                "generator": "Ninja",
                "binaryDir": "${sourceDir}/out/build/${presetName}",
                "cacheVariables": {
                    "CMAKE_BUILD_TYPE": "Debug",
                    "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
                }
            },
            {
                "name": "x64-Release",
                "displayName": "x64 Release", 
                "description": "Release build with vcpkg dependencies",
                "generator": "Ninja",
                "binaryDir": "${sourceDir}/out/build/${presetName}",
                "cacheVariables": {
                    "CMAKE_BUILD_TYPE": "Release",
                    "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
                }
            }
        ]
    }
    

    With presets, you can simply use:

    cmake --preset x64-Debug
    cmake --build out/build/x64-Debug
    

    Troubleshooting

    Common Issues and Solutions

    Missing C++ Compiler:

    sudo apt install g++
    

    Missing CMake:

    sudo apt install cmake
    

    Missing Ninja:

    sudo apt install ninja-build
    

    Boost ASIO Issues: Always use the vcpkg toolchain file:

    cmake -B out/build/x64-Debug -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake
    

    Case Sensitivity Issues: Linux is case-sensitive. Ensure your source file names match exactly what's in CMakeLists.txt.

    vcpkg Manifest Mode: If using vcpkg with vcpkg.json, edit the JSON file to add dependencies rather than using command line:

    # Don't do this:
    ./vcpkg/vcpkg install boost-asio
    
    # Instead, edit vcpkg.json and run:
    ./vcpkg/vcpkg install
    

    Dependencies Installed by vcpkg

    Your project uses these dependencies (automatically managed by vcpkg):

    • Boost (system, asio, beast) - Version 1.86.0
    • OpenSSL - Version 3.4.1
    • GeographicLib - Version 2.5
    • nlohmann-json - Version 3.11.3
    • tomlplusplus - Version 3.4.0

    Summary Commands

    For a quick build from scratch:

    # 1. Install system dependencies
    sudo apt update
    sudo apt install g++ build-essential cmake ninja-build libssl-dev zlib1g-dev pkg-config
    
    # 2. Fix file names (if needed)
    mv source/Settings.cpp source/settings.cpp
    mv source/Print.cpp source/print.cpp
    
    # 3. Bootstrap vcpkg (if not done)
    ./vcpkg/bootstrap-vcpkg.sh
    
    # 4. Configure and build
    rm -rf out/build/x64-Debug
    cmake -B out/build/x64-Debug -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake
    cmake --build out/build/x64-Debug
    

    Final Notes

    • Always use the vcpkg toolchain file when configuring CMake
    • vcpkg will automatically download and build all dependencies
    • The first build may take longer as vcpkg compiles dependencies
    • Subsequent builds will be much faster as dependencies are cached


    in Daily blog
    # Linux Xenomatix
    Meeting day
    Droits d'auteur © CTech Solutions
    Nederlands (BE) | English (UK) | Français
    Généré par Odoo - Le #1 Open Source eCommerce