-
Notifications
You must be signed in to change notification settings - Fork 96
Building From Source
This page provides a developer-friendly introduction to building and running the MTConnect C++ Agent. It covers the essential setup steps, explains what each step does, and outlines platform-specific installation instructions.
The Quick Start section gives you the fastest possible path to running a working MTConnect Agent instance. It assumes no prior knowledge of MTConnect, Conan, or the agent architecture.
Clone the official MTConnect C++ Agent repository and navigate into it:
git clone https://github.com/mtconnect/cppagent.git
cd cppagent
The agent uses Conan to automatically download and configure dependencies such as Boost, libxml2, and libcurl. This keeps builds consistent across platforms. Run:
conan create . --build=missing
This command will:
- resolve all required third-party libraries,
- compile the agent and its components,
- bundle everything into a runnable package.
If this is your first time using Conan, it may take several minutes to download packages.
Create a file named agent.cfg in the project root directory.
Example:
Devices = Devices.xml
Port = 5000
Adapters {
MyCNC {
Host = localhost
Port = 7878
}
}
- Devices – Points to the Device XML file that describes the machine’s structure and DataItems.
- Port – Defines the HTTP port where the agent will serve MTConnect responses.
- Adapters – Lists one or more SHDR inputs that provide real-time machine data to the agent.
If you don’t already have a Device XML file, you can use one from the /samples directory.
To start the agent using your configuration file:
./agent run agent.cfg
If the configuration is valid, the agent will:
- load the Device XML
- initialize the internal data buffer
- connect to the adapter
- start listening for HTTP requests
- begin serving MTConnect XML/JSON
You can verify the agent from any browser, cURL, or REST client.
| Endpoint | Description |
|---|---|
| /probe | Shows device metadata and structural information |
| /current | Returns the latest value of every DataItem |
| /sample | Returns time-series sample data |
Example:
curl http://localhost:5000/probe
You should see a valid MTConnect XML document.
This section covers detailed installation and build steps for Linux, Windows, and macOS. Because the agent uses CMake + Conan, the process is consistent, but dependencies vary by platform.
Use your system package manager to install C/C++ build tools:
sudo apt-get install build-essential cmake libssl-dev libcurl4-openssl-dev
From the repository root:
conan install . --build=missing
cmake --preset conan-release
cmake --build build-release
This will produce an agent executable in the build folder.
Windows is widely used in machine-shop environments, especially when connecting directly to CNC controllers or industrial PCs.
- Visual Studio 2022 with the Desktop C++ workload
- CMake
- Conan (Python-based package manager)
conan install . --build=missing
cmake --preset conan-release
cmake --build build-release --config Release
This will produce agent.exe.
macOS is ideal for development, training, and testing because it provides a Unix environment with simpler toolchains.
brew install cmake openssl conan
conan install . --build=missing
cmake --preset conan-release
cmake --build build-release