apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Igor Galić <i.ga...@brainsware.org>
Subject 64 and 32 bit compile
Date Fri, 25 Jun 2010 23:31:35 GMT

Hi folks,

today I experienced a bit of a trouble getting httpd (latest 2.2)
with it's included APR to compile for 64 and 32 bit on the same system.
(Solaris 10, u5 in this case on Intel)

With a ./configure as this:

CC="cc"; export CC
CFLAGS="-s -xO3 -native -mt -I/opt/bawebstack/include -m32"; export CFLAGS
LDFLAGS="-mt -L/opt/bawebstack/lib -R/opt/bawebstack/lib"; export LDFLAGS
"./configure" \
"--prefix=/opt/bawebstack" \
"--bindir=/opt/bawebstack/bin" \
"--sbindir=/opt/bawebstack/sbin" \
"--libdir=/opt/bawebstack/lib" \
"--datadir=/opt/bawebstack/share/apache2" \
"--sysconfdir=/opt/bawebstack/etc/apache2" \
"--localstatedir=/var/bawebstack/apache2" \
"--with-included-apr" \
"--enable-nonportable-atomics" \
"--disable-libtool-lock" \
"--with-devrandom=/dev/urandom" \
"--libexecdir=/opt/bawebstack/lib/apache2" \
"--with-ldap-include=/opt/bawebstack/include" \
"--with-ldap-lib=/opt/bawebstack/lib" \
"--with-ldap=ldap_r" \
"--with-sqlite3" \
"--with-mysql=/opt/bawebstack/bin/mysql_config" \
"--with-berkeley-db=/opt/bawebstack" \
"--with-expat=/opt/bawebstack" \
"--with-pcre=/opt/bawebstack/bin/pcre-config" \
"--with-ssl=/opt/bawebstack" \
"--with-z=/usr" \
"--enable-exception-hook" \
"--with-program-name=httpd.prefork" \
"--with-mpm=prefork" \
"--enable-mods-shared=all ssl ldap cache proxy authn_alias mem_cache file_cache authnz_ldap
charset_lite dav_lock disk_cache" \
"CC=cc" \
"CFLAGS=-s -xO3 -native -mt -I/opt/bawebstack/include -m32" \
"LDFLAGS=-mt -L/opt/bawebstack/lib -R/opt/bawebstack/lib" \

The 32bit compile would fail, after I had already compiled
and installed the 64bit libs and headers (and httpd):

cc -s -xO3 -native -mt -I/opt/bawebstack/include -m32 -DHAVE_CONFIG_H \
 -I./include -I/tmp/bawebuild/httpd.prefork/httpd-2.2.15/srclib/apr/include/arch/unix \
 -I./include/arch/unix -I/tmp/bawebuild/httpd.prefork/httpd-2.2.15/srclib/apr/include/arch/unix
 -I/tmp/bawebuild/httpd.prefork/httpd-2.2.15/srclib/apr/include \
 -c strings/apr_snprintf.c -KPIC -DPIC
"strings/apr_snprintf.c", line 500: duplicate case in switch: 4
"strings/apr_snprintf.c", line 671: duplicate case in switch: 4
cc: acomp failed for strings/apr_snprintf.c
gmake[5]: *** [strings/apr_snprintf.lo] Error 1

(If you google the exact error, you'll see folks on OS X reporting
trouble with universal binary builds)

It fails because my -I/opt/bawebstack/include (needed to see things
like OpenSSL) takes precedence over the build-local include files.
But it's good it failed this early, otherwise I wouldn't have found
out that with -m64 -DSOLARIS2=10 long is 8 byte,
but with -m32 -DSOLARIS2=10 it's just 4 byte.

The sanest way to work around this would be to actually use the
included stdint.h's int32_t and int64_t, if configure determines
it exists.

What's left to deal with then are the FMTs, but there's inttypes.h
to take care of that.
Well, not without a catch, of course:

(On my Linux box) it says:

/* The ISO C99 standard specifies that these macros must only be
   defined if explicitly requested.  */
#if !defined __cplusplus || defined __STDC_FORMAT_MACROS

On Solaris the finaly destination of inttypes.h is int_fmtio.h:

So far I haven't dared to venture too close into the m4 that generates
apr.h, sooner or later I suppose I'll have to ;)

Until then,
Igor Galić

Tel: +43 (0) 699 122 96 338
Fax: +43(0) 1 91 333 41
Mail: i.galic@brainsware.org
URL: http://brainsware.org/

View raw message