Including Apache 2.2.6 with Solaris
Stefan Teleman <Stefan.Teleman at Sun.COM>
19 September 2007
Addressing the 32- vs. 64- bitness issue.
1. Summary, Motivation and Problem Domain
PSARC 2007/169 [ Including Apache 2.2.4 with Solaris ] [1]
established the filesystem object structure, and the Interface
Stability commitment level for the Apache 2.2.x releases.
However, PSARC 2007/169 did not address the coexistence of
32- and 64- bit deliveries of Apache.
Traditionally, Solaris has supported 32- and 64- bitness for
executables and shared libraries only. Header files, and other
configuration scripts or ancillary objects have always been
assumed to be portable across different pointer sizes. The
current delivery of 32- and 64- bit objects is achieved via
separation of enclosing directories [ for any 32- bit directory
there exists a corresponding 64- bit directory whose name
reflects the ISA: 'sparcv9' or 'amd64' ].
Apache software poses an interesting challenge to this coexistence
requirement, which will be described in detail below.
1.1. Apache relies on the autotools mechanism for the
discovery of its compilation environment [ the ./configure
script ]. During the configuration phase, several APR typedefs
and macros are defined in a few header files. Depending on
the bitness [32 vs. 64] of the build, these typedefs will
reference Solaris datatypes whose size is bitness dependent.
For example [ apr.h ]:
--- apr.h.32 2007-03-16 01:04:16.000000000 -0400
+++ apr.h.64 2007-03-13 23:36:57.000000000 -0400
@@ -262,15 +262,15 @@
typedef int apr_int32_t;
typedef unsigned int apr_uint32_t;
-typedef long long apr_int64_t;
-typedef unsigned long long apr_uint64_t;
+typedef long apr_int64_t;
+typedef unsigned long apr_uint64_t;
typedef size_t apr_size_t;
typedef ssize_t apr_ssize_t;
typedef off_t apr_off_t;
typedef socklen_t apr_socklen_t;
-#define APR_SIZEOF_VOIDP 4
+#define APR_SIZEOF_VOIDP 8
/* Are we big endian? */
#define APR_IS_BIGENDIAN 0
@@ -344,25 +344,25 @@
* to find the logic for this definition search for "ssize_t_fmt" in
* configure.in.
*/
-#define APR_SSIZE_T_FMT "d"
+#define APR_SSIZE_T_FMT "ld"
/* And APR_SIZE_T_FMT */
-#define APR_SIZE_T_FMT "d"
+#define APR_SIZE_T_FMT "ld"
/* And APR_OFF_T_FMT */
-#define APR_OFF_T_FMT APR_INT64_T_FMT
+#define APR_OFF_T_FMT "ld"
/* And APR_PID_T_FMT */
#define APR_PID_T_FMT "ld"
/* And APR_INT64_T_FMT */
-#define APR_INT64_T_FMT "lld"
+#define APR_INT64_T_FMT "ld"
/* And APR_UINT64_T_FMT */
-#define APR_UINT64_T_FMT "llu"
+#define APR_UINT64_T_FMT "lu"
/* And APR_UINT64_T_HEX_FMT */
-#define APR_UINT64_T_HEX_FMT "llx"
+#define APR_UINT64_T_HEX_FMT "lx"
The size difference of SIZEOF_VOID_P and the formatting
differences for APR typedefs make the default configured apr.h
file unsuitable for inclusion without modifications.
1.2. Apache provides a set of filesystem objects which
assist in the compilation of 3rd party Apache modules. These
filesystem objects are:
- The 'apxs' script
- The supporting 'build' directory
- The supporting makefile includes [ *.mk ] files
1.3. The 'apxs' script is a Perl script which contains
hardcoded information about a particular Apache distribution
build. apxs' information delivery mechanism relies on reading
the makefile includes files from the appropriate 'build'
directory:
##
## Configuration
##
my %config_vars = ();
my $installbuilddir = "/var/apache2.2/build";
get_config_vars("$installbuilddir/config_vars.mk",\%config_vars);
# read the configuration variables once
my $prefix = get_vars("prefix");
my $CFG_PREFIX = $prefix;
my $exec_prefix = get_vars("exec_prefix");
my $datadir = get_vars("datadir");
my $localstatedir = get_vars("localstatedir");
my $CFG_TARGET = get_vars("progname");
my $CFG_SYSCONFDIR = get_vars("sysconfdir");
my $CFG_CFLAGS = join ' ', map { get_vars($_) }
qw(SHLTCFLAGS CFLAGS NOTEST_CPPFLAGS EXTRA_CPPFLAGS
EXTRA_CFLAGS);
my $includedir = get_vars("includedir");
my $CFG_INCLUDEDIR = eval qq("$includedir");
my $CFG_CC = get_vars("CC");
my $libexecdir = get_vars("libexecdir");
my $CFG_LIBEXECDIR = eval qq("$libexecdir");
my $sbindir = get_vars("sbindir");
my $CFG_SBINDIR = eval qq("$sbindir");
my $ltflags = $ENV{'LTFLAGS'};
$ltflags or $ltflags = "--silent";
my %internal_vars = map {$_ => 1}
qw(TARGET CC CFLAGS CFLAGS_SHLIB LD_SHLIB LDFLAGS_SHLIB
LIBS_SHLIB PREFIX
SBINDIR INCLUDEDIR LIBEXECDIR SYSCONFDIR);
[ ... ]
The Apache configuration phase will populate the supporting
'build' directory with the appropriate supporting makefile
includes, and with a copy of libtool. These supporting objects
will reflect the compilation environment at the time of
configuration, and are not portable across different bitness-es.
The 'apxs' script is used in the compilation of 3rd party
Apache modules, including PHP. The accuracy and correctness
of the information delievered by apxs determines the correctness
of the 3rd party module build.
1.4. SMF Manifests
The current delivery of Apache in Solaris assumes a 32-bit Apache
only. As such, Solaris delivers SMF Manifests for 32-bit Apache
only. The coexistence of 32- and 64- bit Apache deliveries in
Solaris requires the separate SMF Apache Manifests, accomodating
32- and 64- bit Apache software.
2. Proposed Approach
We are proposing the following approach to solving this problem:
2.1. Executables and shared libraries:
Apache will deliver bitness dependent directories following the
established Solaris conventions for such deliveries. Assuming an
Apache distribution located at ${APACHE_ROOT}, the following
filesystem structure will be delivered:
${APACHE_ROOT}/bin/
${APACHE_ROOT}/bin/${MACH64}/
${APACHE_ROOT}/lib/
${APACHE_ROOT}/lib/${MACH64}/
${APACHE_ROOT}/sbin/
${APACHE_ROOT}/sbin/${MACH64}/
${APACHE_ROOT}/libexec/
${APACHE_ROOT}/libexec/${MACH64}/
2.2. Include [ header ] files.
All Apache header files which are generated at ./configure time
will be patched to accomodate 32- and 64- bit Apache installations.
The appropriate differences between 32- and 64- bit datatypes
will be guarded either via the _LP64 macro, or via the appropriate
ISA definition builtin macros:
#if defined(_LP64)
#define APR_SIZEOF_VOIDP 8
#else
#define APR_SIZEOF_VOIDP 4
#endif
#if defined(__sparc) || defined(__sparcv9)
#define APR_IS_BIGENDIAN 1
#else
#define APR_IS_BIGENDIAN 0
#endif
The Solaris distribution of Apache will not deliver bitness
separate directories for header files.
2.3. Supporting build directories and scripts [ apxs ].
Given the complexity and the number of ancillary support
objects delivered by Apache, and the difficulty in maintaining
a patch train for all the affected objects, the Solaris Apache
distribution will deliver a bitness separate path for the
supporting 'build' directory, and bitness separate 'apxs'
scripts. These directories will follow the Solaris naming
and location convention already in existence [ for any
32- bit object these will be a corresponding 64-bit
object located in an appropriately named subdirectory ]:
/var/${APACHE_DIR}/build/
/var/${APACHE_DIR}/build/${MACH64}/
The correct location of these supporting ancillary objects
is hardcoded at Apache configuration time by editing the
appropriate 'config.layout' files delivered by the Apache
distribution. Separate versions of the 'config.layout' files
will have to be maintained.
2.3. SMF Manifests.
The current distribution of Apache in Solaris delivers the
following SMF Manifests:
/lib/svc/method/http-apache2
/var/svc/manifest/network/http-apache2.xml
We are proposing the replacement of these objects with
corresponding bitness aware manifests:
/lib/svc/method/http-apache2-32
/lib/svc/method/http-apache2-64
/var/svc/manifest/network/http-apache2-32.xml
/var/svc/manifest/network/http-apache2-64.xml
2.4. Documentation.
Only one set of documentation objects [ man pages and html
documentation ] will be delivered by Solaris Apache.
3. References
[1] PSARC 2007/169 [ /shared/sac/PSARC/2007/169 ]
--Stefan
--
Stefan Teleman
Sun Microsystems, Inc.
Stefan.Teleman at Sun.COM