Dependencies
Required
| Dependency | Source | Purpose |
|---|---|---|
| C++17 compiler (g++ >= 7) | System | Compilation |
| CMake | System | Build system |
| DAQ | GitHub | Packet I/O abstraction |
| dnet | GitHub | Network utility functions |
| hwloc | open-mpi.org | CPU affinity management |
| LuaJIT | luajit.org | Configuration and scripting |
| OpenSSL | openssl.org | SHA/MD5 signatures, protected_content rule option, SSL detection |
| pcap | tcpdump.org | Packet capture and tcpdump-style logging |
| PCRE2 | pcre.org | Regular expression pattern matching |
| pkgconfig | freedesktop.org | Locates build dependencies |
| zlib >= 1.2.8 | zlib.net | Decompression |
Optional
| Dependency | Source | Purpose |
|---|---|---|
| hyperscan >= 4.4.0 | GitHub | High-performance regex via regex and sd_pattern rule options and Hyperscan search engine |
| cpputest | cpputest.github.io | Additional unit tests (make check) |
| libml | GitHub | Snort ML — neural network-based exploit detection |
| libunwind | nongnu.org | Readable backtraces on fatal signals |
| lzma >= 5.1.2 | tukaani.org | Decompression of SWF and PDF files |
| safec >= 3.5 | GitHub | Runtime bounds checks on legacy C-library calls |
| iconv | gnu.org | UTF16-LE to UTF8 filename conversion (usually in glibc) |
| uuid (uuid-dev) | System | Unique identifiers |
| asciidoc | asciidoc.org | Build the HTML manual |
| dblatex | sourceforge.net | Build the PDF manual (requires asciidoc) |
| w3m | sourceforge.net | Build the plain text manual |
| source-highlight | gnu.org | Generate the developer guide |
Hyperscan is large. Follow the Hyperscan build instructions and build it as a shared library before enabling it in Snort.
Setting Up
Before building, set your install prefix and create the directory:PKG_CONFIG_PATH so cmake can find it:
Build Methods
- configure_cmake.sh (Recommended)
- ccmake (Interactive)
- Xcode (macOS)
The Verify the build:If
configure_cmake.sh script is the simplest approach. It automatically creates and populates a build/ subdirectory.src/snort -V succeeds, the build is complete.Passing cmake options via configure_cmake.sh:You can pass cmake-style arguments directly:cmake Options
The following cmake options can be passed toconfigure_cmake.sh or directly to cmake/ccmake:
| Option | Description |
|---|---|
--prefix=<path> | Set the installation prefix |
--enable-shell | Enable the local and remote command line shell |
--enable-unit-tests | Configure unit tests; run with snort --catch-test [tags]|all |
--enable-benchmark-tests | Configure benchmark tests; run with snort --catch-test [tags]|all or as a separate executable |
--generator=<gen> | Specify a cmake project generator (e.g. Xcode, Eclipse CDT4 - Unix Makefiles) |
Benchmark tests run best on a non-debug build with optimizations enabled. Avoid debug builds when measuring performance.
Verifying the Build
After installation, confirm the binary works:Common Build Issues
Hyperscan: dyld library not loaded on macOS
Hyperscan: dyld library not loaded on macOS
If you build with Hyperscan on macOS and see the following error when running Workaround 1 — export Workaround 2 — fix the rpath in the binary directly:
src/snort:DYLD_LIBRARY_PATH with the path to libhs:tcmalloc crash on Ubuntu 17.04 / 18.04
tcmalloc crash on Ubuntu 17.04 / 18.04
Snort built with tcmalloc support (
--enable-tcmalloc) crashes immediately on Ubuntu 17.04 and 18.04 due to a bug in gperftools 2.5 provided by those distributions.Workaround — uninstall the distribution’s gperftools and install gperftools 2.7 before building Snort:DAQ not found by cmake
DAQ not found by cmake
If cmake cannot find LibDAQ, it means the library is not in a standard system path.Set
PKG_CONFIG_PATH to point to the DAQ pkgconfig directory before running cmake:dump DAQ fails with multiple threads
dump DAQ fails with multiple threads
The dump DAQ does not work correctly with multiple packet threads.Workaround — disable dump output when using multiple threads:

