docs/dev/build-sources.md
This guide describes how to build Wazuh components from source code.
Before building Wazuh from sources, ensure you have the required toolchain installed as described in the Development Environment Setup guide.
To build the Wazuh server (manager) components, first install the dependencies, then compile:
make -C src TARGET=server deps
make -C src TARGET=server
You can customize the build with the following options:
make -C src TARGET=server DEBUG=1 # Build with debug symbols
make -C src TARGET=server TEST=1 # Build in testing mode
make -C src TARGET=server -j4 # Parallel build with 4 jobs
make -C src TARGET=server INSTALLDIR=/custom # Install to custom directory
To build the Wazuh agent for UNIX-like systems (Linux, macOS, BSD, etc.):
make -C src TARGET=agent deps
make -C src TARGET=agent
Similar to the server build, you can use:
make -C src TARGET=agent DEBUG=1 # Build with debug symbols
make -C src TARGET=agent TEST=1 # Build in testing mode
make -C src TARGET=agent -j4 # Parallel build with 4 jobs
make -C src TARGET=agent INSTALLDIR=/custom # Install to custom directory
To build the Wazuh agent for Windows, you must first install the Windows build requirements (MinGW, Wine, CMocka) as described in the setup guide.
make -C src TARGET=winagent deps
make -C src TARGET=winagent
After a successful build, binaries are located in:
src/ directorysrc/win32/ directoryThe build system provides several clean targets for different purposes:
make -C src clean # Clean all compiled code including external dependencies
make -C src clean-deps # Clean external dependencies only
make -C src clean-internals # Clean compiled code, but keep external dependencies
make -C src clean-windows # Clean Windows resource files
Clean target descriptions:
clean - Removes all build artifacts including external dependencies. Use this for a complete clean build.clean-deps - Removes only external dependencies (e.g., libraries downloaded during make deps).clean-internals - Removes compiled binaries and object files but preserves external dependencies. Useful for quick rebuilds.clean-windows - Removes Windows-specific compiled resource files.If the build fails due to missing dependencies, ensure you've run the deps target first:
make -C src deps