How to compile 3.3.3 web agents on Linux

Trying to build the web policy agents may be a little frustrating at times, especially because it is generally not that well documented. As part of the 3.3.3 agent release I had the joy of going through the build process of the Linux web agents, so here you go, here are the steps I’ve gone through to build the agents on a freshly installed CentOS 5.10 (32 & 64 bit). For the very keen, I’ve also aggregated all the commands into shell scripts, you can find them at the bottom of this post.


On an out of the box CentOS 5.10 installation gcc is already installed, but there are some other components you should make sure you have installed before attempting to compile the agents:

  • subversion: To check out the source code of the agents.
  • ant: To perform the build, the agents are using Ant scripts to define the build steps.
  • zlib-devel: Compilation time dependency.
  • gcc-c++: C++ compiler.
  • rpm-build: RPM packages are being generated as part of the build process.
  • gcc44: Building NSS requires a newer GCC than the default one.
  • java-1.6.0-openjdk-devel: JDK to be able to build the agent installers (and run the Ant scripts).

The agent dependencies

The agents rely on the following external libraries:

  • NSS 3.16.3 & NSPR 4.10.6
    On 32 bit the component should be built with:

    make BUILD_OPT=1 NS_USE_GCC=1 NSS_ENABLE_ECC=1 NSDISTMODE="copy" CC="/usr/bin/gcc44 -Wl,-R,'$$ORIGIN/../lib' -Wl,-R,'$$ORIGIN'" nss_build_all

    On 64 bit the command is:

    make USE_64=1 BUILD_OPT=1 NS_USE_GCC=1 NSS_ENABLE_ECC=1 NSDISTMODE="copy" CC="/usr/bin/gcc44 -Wl,-R,'$$ORIGIN/../lib' -Wl,-R,'$$ORIGIN'" nss_build_all
  • PCRE 8.31
    On 32 bit:

    ./configure --with-pic --enable-newline-is-anycrlf --disable-cpp

    On 64 bit:

    CC="gcc -m64" CXX="g++ -m64" ./configure --with-pic --enable-newline-is-anycrlf --disable-cpp
  • libxml2 2.9.1
    On either platform:

    ./configure --prefix=/opt/libxml2 --with-threads --with-pic --without-iconv --without-python --without-readline
  • The header files of various web containers

Once all the libraries are in place, you can run the build on 32 bit:

ant nightly

on 64 bit:

ant nightly -Dbuild.type=64

And here are the shell scripts:
32 bit


  1. Hello Peter,
    I followed your steps to compile external libraries on 64 bit Oracle Linux 6.4, but when trying to build webagent with command “ant apache24 -Dbuild.type=64”, I’m getting the following error:

    [echo] Dispatch to compile of agent c code
    [exec] gmake[1]: Entering directory `/root/Install/webagent_3.3.3/sk.dcom.openam.git/opensso/products/webagents/am/source’
    [exec] g++ -O2 -DNDEBUG -I. -I../../extlib/Linux/nspr_64/include -I../../extlib/Linux/nss_64/include -I../../extlib/Linux/libxml2_64/include/libxml2 -I../../extlib/Linux/pcre_64/include -DLINUX -pthread -Wall -Wshadow -Woverloaded-virtual -fexceptions -DLINUX_64 -fPIC -DAM_BUILDING_LIB -D_CHAR_IS_UNSIGNED -c am_main.cpp -o am_main.o
    [exec] svn: ‘.’ is not a working copy
    [exec] svn: ‘.’ is not a working copy
    [exec] gmake[1]: Leaving directory `/root/Install/webagent_3.3.3/sk.dcom.openam.git/opensso/products/webagents/am/source’
    [exec] am_main.cpp: In function ‘am_status_t am_shutdown_nss()’:
    [exec] am_main.cpp:154: error: ‘NSS_IsInitialized’ was not declared in this scope
    [exec] gmake[1]: *** [am_main.o] Error 1
    [exec] gmake: *** [all_subdirs] Error 2


    DO you have any idea what’s wrong?
    Thank you.

  2. Make sure you follow the shell scripts added at the bottom of the post. Those should tell you how exactly to put the compiled dependencies into the extlib structure for the agents.

  3. Hi aldaris, thank you for your reply.
    When used your 64 bit script, I get the error:

    [exec] Checking for unpackaged file(s): /usr/lib/rpm/check-files /tmp/root/agent-buildroot
    [exec] Wrote: /tmp/root/agent-buildroot/RPMS/x86_64/common-3.0-0.x86_64.rpm
    [exec] Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.n1gtSP
    [exec] + umask 022
    [exec] + cd /tmp/root/agent-buildroot/BUILD
    [exec] + /bin/rm -rf /tmp/root/agent-buildroot
    [exec] + exit 0
    [exec] rm -f /root/.rpmmacros
    [exec] if [ -f /root/.rpmmacros.agent ] ; then mv /root/.rpmmacros.agent /root/.rpmmacros ; fi
    [exec] mv -f /tmp/root/agent-buildroot/RPMS/x86_64/common-3.0-0.x86_64.rpm ../../../built/Linux/packages.scratch/RPMS/x86_64
    [exec] gmake[2]: Leaving directory `/root/Install/agent_compile/agent/webagents/agents/source/common’
    [exec] gmake[1]: Leaving directory `/root/Install/agent_compile/agent/webagents/agents/source’
    [exec] mv: cannot stat `/tmp/root/agent-buildroot/RPMS/x86_64/common-3.0-0.x86_64.rpm’: No such file or directory
    [exec] gmake[2]: *** [../../../built/Linux/packages.scratch/RPMS/x86_64/common-3.0-0.x86_64.rpm] Error 1
    [exec] gmake[1]: *** [all_subdirs] Error 2
    [exec] gmake: *** [all_subdirs] Error 2

    Can you explain mi please what is the container file at the end of the script:

    cd Linux
    scp aldaris@ .
    tar xf containers_64.tar.gz

    Thank you

  4. I found an issue about this error, here is a workaround:

    One more thing I had to resolve for building the agent for apache 2.4:
    1. create the directory extlib/Linux/apache24/include
    2. build httpd-2.4, apr-1.5.0, apr-util-1.5.3 from source
    3. copy the content of httpd, apr and apr-util include directories to the extlib/Linux/apache24/include directory

  5. The containers*.tar.gz contains the container header files. Depending on the agent you want to build, you will need to collect the header files for said container to be able to build the agent for that container.

  6. Hi,
    first i want to thank you for this very helpful documentation. I’ve been able to build my apache22 agent on a centOS 6.5 64bits system.
    I’ve been through all the process and could build it with ‘ant apache22’ command

    But I encountered an error while trying to execute the installer on this same system :
    “ Failed to execute encrypt utility located in this bin dir. Make sure that right agent binary is used on this OS platform.”

    Would you have any idea why this error occurs ?

    Thanks in advance,

  7. Ok I found where the problem was located :
    by default , the execution right is not given on the binaries (I think the error message is very misleading in my case).

    chmod +x /openam/bin/* did the trick

  8. Just sharing a note that caught me off guard..l The build will happen from the ~/agents/webagents/ directory, not the top level agent directory.

  9. Hello aldaris,

    I tried but I think your scp site is not up anymore to download the container.tar.gz.

    I am building for Apache22. I downloaded the httpd-2.2.15.tar.bz2 and untar under webagents/extlib/Linux as agent22. But then it starts complaining about apr dependencies. downloaded those as well but still not able to satisfy all the dependencies and see lots of error while building.

    I will appreciate if you can share steps or container.tar itself for these header file dependencies.

  10. I got that working. I followed the steps documented under one of the steps to create extlib/Linux/apache24/include directory and copy the header files there. Thanks.

Join the Conversation

Your email address will not be published. Required fields are marked *