Customizing the compilation process
The Passenger compilation process can be customized with environment variables. You can learn more about environment variables in About environment variables.
Table of contents
- Loading...
Setting the compiler
You can force the Passenger build system to use a specific C or C++ compiler by setting the CC
and CXX
environment variables. These may be set to any arbitrary shell commands.
For example, contributors who want to hack on Passenger may want to use Clang for faster compilation and ccache for faster recompilation, and may want to enable more error-catching compilation flags:
export CC='ccache clang -fcolor-diagnostics -Qunused-arguments -fcatch-undefined-behavior -ftrapv'
export CXX='ccache clang++ -fcolor-diagnostics -Qunused-arguments -fcatch-undefined-behavior -ftrapv'
sudo
then environment variables may not be passed properly. Learn more at Environment variables and sudo.
Adding additional compiler or linker flags
On some systems, C/C++ libraries and headers that Passenger requires may be located in a non-standard directory. You can force the Passenger build system to look in those locations by injecting compiler and linker flags using the following environment variables:
EXTRA_PRE_CFLAGS
- These flags are injected into all C compiler invocations that involve compiling C source files. This also covers compiler invocations that compile and link. The flags are injected at the beginning of the command string, even before
EXTRA_PRE_LDFLAGS
. EXTRA_CFLAGS
- Similar to
EXTRA_PRE_CFLAGS
, but injected at the end of the command string, beforeEXTRA_LDFLAGS
. EXTRA_PRE_CXXFLAGS
- Similar to
EXTRA_PRE_CFLAGS
, but for C++ compiler invocations. EXTRA_CXXFLAGS
- Similar to
EXTRA_CFLAGS
, but for C++ compiler invocations. EXTRA_PRE_LDFLAGS
- These flags are injected into all C/C++ compiler invocations that involve linking. This includes compiler invocations that compile and link. The flags are injected at the beginning of the command string, but after
EXTRA_PRE_CFLAGS
/EXTRA_PRE_CXXFLAGS
. EXTRA_PRE_C_LDFLAGS
- These flags are injected into all C compiler invocations that involve linking, right after
EXTRA_PRE_LDFLAGS
. EXTRA_PRE_CXX_LDFLAGS
- Similar to
EXTRA_PRE_CXX_LDFLAGS
, but for C++ compiler invocations. EXTRA_LDFLAGS
- Similar to
EXTRA_PRE_LDFLAGS
, but injected at the very end of the command string, even afterEXTRA_CFLAGS
andEXTRA_CXXFLAGS
. EXTRA_C_LDFLAGS
- Similar to
EXTRA_LDFLAGS
, but only injected for C executable linking commands. Injected right afterEXTRA_LDFLAGS
. EXTRA_CXX_LDFLAGS
- Similar to
EXTRA_LDFLAGS
, but only injected for C++ executable linking commands. Injected right afterEXTRA_LDFLAGS
. PASSENGER_THREAD_LOCAL_STORAGE
- Setting this to 1 will enable the
PASSENGER_THREAD_LOCAL_STORAGE
macro, which forcefully disables the use of thread-local storage inside the Passenger codebase. Setting this environment variable is useful on systems that have broken support for thread-local storage, despite passing our build system's check for proper thread-local storage support. At the time of writing, one user has reported that Ubuntu 12.04 32-bit has broken thread-local storage report although neither the reporter nor us were able to reproduce the problem on any other systems running Ubuntu 12.04 32-bit. Note that this flag has no effect on non-Passenger code.
sudo
then environment variables may not be passed properly. Learn more at Environment variables and sudo.
Forcing location of command line tools and dependencies
The Passenger build system attempts to autodetect many things by locating relevant helper tools. For example, to find out which compiler flags it should use for libcurl, it queries the curl-config
command. These commands may not be in $PATH
, or even when they are you may want to use a different one.
You can force the build to find certain command line tools at certain locations by using the following environment variables:
MAKE
- The location of a
make
tool. It does not matter which implementation ofmake
this is. GMAKE
- The location of the GNU-compatible
make
tool.
sudo
then environment variables may not be passed properly. Learn more at Environment variables and sudo.