Building the Apache Web server on AIX is generally a straightforward enterprise in which you: obtain the code, run a few simple commands (configure, make, and make install) and then stop by your boss's cube to ask if she's got anything she'd like you to take off her plate.
You don't know us very well yet, so we'll be frank: we say "straightforward" with tongue firmly planted in cheek. A quick Google search on the topic will return a plethora of issues users encounter while building the code if they try anything beyond straight vanilla. In other words, if you need an install with any additional modules or capabilities, expect some issues.We've already covered the vanilla installation, in the first installment of the Building Apache on AIX. This second part of the tutorial takes you beyond those basics. Before attempting any of these work-arounds, we recommend that you have met all the requirements for a "basic" build.
Follow the setup from the first installment of this guide, Building Apache 2.2.X on AIX 5.3 platforms.
Neglecting to clean between failed builds (or builds with numerous, particular errors)
During compilation phase of the build, if any errors are encountered, the subsequent buildmust be preceded by a make clean. As Joe Biden would say "Let me repeat that", make clean.It is important that your build runs from start to finish without errors and that there isnot any artifacts from previous build attempts giving you false positive or false negative results.Environment Issues
The most frequent issues with a build are ones that are encountered because the build environment is not set up correctly. Incorrect gcc version, gcc library version, and not adding the math library (libm.a) are the most common. Setup of these environment elements are covered in the first installment of this guide.
The latest versions of Apache Web server have over 160 configuration options and flags, making for millions potential combinations. These options control exactly how the Web server is going to build and, more importantly, how it is going to run. On AIX, there are several options that we have found are either required, or particularly beneficial to complete the build.
--prefix=PATHSetting this option is required. PATH is the exact path where the Web server will be installed and run from post compilation.
--with-included-aprapr and apr-util are bundled with the Apache Web server source releases, and will be used without any problems in almost all circumstances. However, if apr or apr-util versions 1.0 or 1.1, are installed on your system (as is the case if you are using AIX 5.3), you must either upgrade your apr/apr-util installations to 1.2 and force the use of the bundled libraries, or have httpd use separate builds.
To use the bundled apr/apr-util sources, specify the --with-included-apr option added in version 2.2.3 of Apache Web server.
--enable-ssl=sharedIf you choose to add ssl capabilities to your Web server, you must enable this option. This also means that you must have OpenSSL installed on your system. On AIX systems a typical install will litter OpenSSL elements across your file system, and this will cause issues as you compile. For instance, we have found complete or portions of OpenSSL installed in the following directories : /usr , /usr/bin, /opt/freeware/bin, /usr/include, /usr/linux. Most often, the correct OpenSSL to use is the libraries found in /usr. To specify using this one, you must set the following options:
--with-ssl=/usr This tells the configuration step to bind to libraries found in and under /usr.
--enable-mods-shared=ssl This tells the system to create the ssl module as a shared object.
Other important configuration options include:
--enable-so: This configures apache for later installation of shared objects (modules). Apache httpd can be built either with static, built-in modules, or be built so that modules can be stored outside of the httpd binary file, and may be compiled and added at a later time. Having the ability to add modules after the main build is accomplished using the Apache Extention Tool (apxs). This dynamic build is enabled by the --enable-so option. The modules that are built as extentions to the main binary are called Dynamic Shared Objects (DSO).
Finally, here are a few optional modules you may include during your configuration:
ProxyRequests OnProxyVia On<Proxy *> Order deny,allowDeny from allAllow from internal.example.com </Proxy>
ProxyRequests Off<Proxy *> Order deny,allowAllow from all </Proxy>ProxyPass /path http://domainname.com/thingProxyPassReverse /path http://domainname.com/thing
<Proxy *> Order Deny,AllowDeny from allAllow from 192.168.0 </Proxy>
Openssl compilation error. Sample error: /usr/include/openssl/pq_compat.h:1:3: error: invalid preprocessing directive #IBM_PROLOG_BEGIN_TAGOn AIX, it is not uncommon to encounter errors during compilation if ssl is enabled. This is becauseIBM's OpenSSL package contains a number of include files in /usr/include/openssl where a special "IBM Prolog" include line has been added, making the header files incompatible with gcc.The fix is to edit pq_compat.h, and comment out any lines with IBM_PROLOG_BEGIN_TAG, as well as any associated lines with the Prolog include tag.Linker errorsSample error: 0711-317 ERROR: Undefined symbol: .BIO_clear_flagsOn AIX, once you have satisfied the gcc requirements to build Apache two linkers will existon your system. Linker errors, like the one seen above, are a result of the pathing to libraries beingdifferent for the compiler and the linker, and can be resolved by setting environment flags.Now, on all UNIX systems there is a library path that is to be used during link phase, and runtime,and on all UNIX systems this path is set via the LD_LIBRARY_PATH variable. All Unix systems, that is, except AIX. For this reason, we usually set the path using both the standard and the AIX variable as a safety precaution. The native AIX linker should use LIBPATH, while LD_LIBRARY_PATH will be used by the Gnu linker.Example library path setup looks like this:
/usr/include/openssl/pq_compat.h:1:3: error: invalid preprocessing directive #IBM_PROLOG_BEGIN_TAG
0711-317 ERROR: Undefined symbol: .BIO_clear_flags
set LIBPATH=/usr/lib:/libset LD_LIBRARY_PATH=/usr/lib:/libexport LIBPATH LD_LIBRARY_PATH
Augmenting the basic build with additional modules will add complexity to the build process, but by following this tutorial and properly setting up your environment, most errors can be avoided. Of course, each system can have other libraries and packages installed that can cause additional error messages, or warnings. While we have built Apache on AIX many times, on many different systems, this guide does not claim to, and can't possibly, anticipate every situation. Should you encounter other errors, please email them to us, and we'll include them in a future revision.We wish you good luck, and happy compiling.
Allowed tags: <a> link, <b> bold, <i> italics