Skip to content

3. Builds

Gary Archer edited this page Sep 4, 2024 · 10 revisions

1. Linux Builds

Run these commands to build code into a dynamic module for all supported NGINX and Linux versions:

./buildall.sh

Shared libraries with a .so extension are produced for each Linux distro, in your local ./build folder:

alpine.ngx_curity_http_phantom_token_module_1.25.5.so
debian.buster.ngx_curity_http_phantom_token_module_1.25.5.so
ubuntu.20.04.ngx_curity_http_phantom_token_module_1.25.5.so

If required, build for a single platform like this:

export NGINX_VERSION='1.25.5'
export LINUX_DISTRO='alpine'
./build.sh

2. Compiler Settings

When the ./configure script is called, the main NGINX system's ./configure script is invoked.
This can accept custom parameters from this nginx page including these:

Option Description
--with-cc-opt Settings to add to the CFLAGS variable used by the linker
--with-ld-opt Settings to add to LDFLAGS variable used by the linker

The NGINX configure script uses automake to produce the build file at ./nginx-1.25.5/objs/Makefile.
Some CFLAGS settings, such as -std=c99, are dictated by the nginx system.

3. Troubleshoot Linux Build Failures

A multi-stage Docker build is used, to output built .so files to an nginx-module-builder image.
To troubleshoot failures, remote to the most recent Docker image in docker image list.
Build commands can then be run manually if required, to understand the failure cause:

docker run -it a77962ad4c52
cd /tmp
make
Clone this wiki locally