Compile And Install
This page is for users compiling OpenSIPS from source. Binary packages should be installed with the package manager provided by the operating system.
Configure the build
Section titled “Configure the build”Build settings are stored in Makefile.conf at the repository root. The first
make invocation creates it from Makefile.conf.template if it does not
already exist. To prepare it explicitly:
cp Makefile.conf.template Makefile.confEdit Makefile.conf before compiling. Keep this file for subsequent rebuilds;
it is intentionally not tracked by Git.
Select modules
Section titled “Select modules”exclude_modules lists modules omitted from the normal modules and all
targets. The default list primarily contains modules with external
dependencies. Remove a module from this list after installing its development
dependencies, or add it to include_modules to force it into the build without
rewriting the default exclusion list:
include_modules += db_mysql jsonYou may explicitly exclude additional modules:
exclude_modules += cachedb_redis event_rabbitmqinclude_modules takes precedence for the named modules. Module names are the
directory names under modules/.
For a one-off build, the same variables may be supplied on the command line:
make -j4 modules include_modules="db_mysql json"make -j4 modules skip_modules="cachedb_redis event_rabbitmq"Tune compiler and linker flags
Section titled “Tune compiler and linker flags”Use CC_EXTRA_OPTS and LD_EXTRA_OPTS for additional compiler and linker
options:
CC_EXTRA_OPTS += -O2 -march=nativeLD_EXTRA_OPTS += -Wl,--as-neededUse DEFS for OpenSIPS compile-time definitions. Makefile.conf.template
contains the supported definitions with short descriptions. Enable a disabled
definition by uncommenting it, or add a definition explicitly:
DEFS += -DEXTRA_DEBUGDEFS += -DSHM_EXTRA_STATSOnly enable flags whose behavior is understood. Some allocator and locking
definitions are mutually exclusive or materially affect runtime performance.
Run make proper before rebuilding after changing compiler flags or
compile-time definitions.
Configure the installation prefix
Section titled “Configure the installation prefix”Set PREFIX in Makefile.conf to change the default installation root:
PREFIX ?= /opt/opensips/Use the same prefix for compilation and installation because the default configuration path is compiled into the OpenSIPS binary.
Compile
Section titled “Compile”Build the core and selected modules:
make -j4 allUseful narrower targets are:
make -j1 # core binary onlymake -j4 modules # selected modules onlymake -j1 modules module=db_mysqlInstall
Section titled “Install”Install the core, selected modules, documentation, and database schemas using
the settings from Makefile.conf:
make installCommand-line variables override the corresponding configuration for a one-off operation. Pass the same values to both build and install steps.