[CentOS] Problems compiling PostgreSQL package from FC8 on CentOS 5

Mon Dec 15 13:08:53 UTC 2008
Peter Hopfgartner <peter.hopfgartner at r3-gis.com>

Dear CentOS list

we are a small software company making mostly web driven GIS software. 
We started to simplify out sysadmin life  making RPM packages of most of 
the GIS software stack. For a dependency issue we had to abandon the 
upstream 8.1 PostgreSQL and install at least a 8.2 version. Taking the 
package from Fedora 8 and rebuilding it for x86_64 went smoothly. 
Unfortunatly the same is not true for i386. It stops with:

 checking for collateindex.pl... no
checking for sgmlspl... no
checking thread safety of required library functions... no
configure: error: thread test program failed
This platform is not thread-safe.  Check the file 'config.log' for the
exact reason.

You can use the configure option --enable-thread-safety-force to force
threads to be enabled.  But you must then run the program in
src/test/thread and add locking function calls to your applications to
guarantee thread safety.
error: Bad exit status from 
/home/peter.hopfgartner/rpmbuild/tmp/rpm-tmp.77591 (%build)


RPM build errors:
    Bad exit status from 
/home/peter.hopfgartner/rpmbuild/tmp/rpm-tmp.77591 (%build)


The temporary file is:

#!/bin/sh

  RPM_SOURCE_DIR="/home/peter.hopfgartner/rpmbuild/SOURCES"
  RPM_BUILD_DIR="/home/peter.hopfgartner/rpmbuild/BUILD"
  RPM_OPT_FLAGS="-O2 -g -march=i386 -mcpu=i686"
  RPM_ARCH="i386"
  RPM_OS="linux"
  export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS
  RPM_DOC_DIR="/usr/share/doc"
  export RPM_DOC_DIR
  RPM_PACKAGE_NAME="postgresql"
  RPM_PACKAGE_VERSION="8.2.11"
  RPM_PACKAGE_RELEASE="1"
  export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
  
RPM_BUILD_ROOT="/home/peter.hopfgartner/rpmbuild/tmp/postgresql-8.2.11-1-root"
  export RPM_BUILD_ROOT
 
 
  set -x
  umask 022
  cd /home/peter.hopfgartner/rpmbuild/BUILD
cd postgresql-8.2.11

CFLAGS="${CFLAGS:--O2 -g -march=i386 -mcpu=i686}" ; export CFLAGS
CXXFLAGS="${CXXFLAGS:--O2 -g -march=i386 -mcpu=i686}" ; export CXXFLAGS

# Strip out -ffast-math from CFLAGS....
CFLAGS=`echo $CFLAGS|xargs -n 1|grep -v ffast-math|xargs -n 100`


  CFLAGS="${CFLAGS:--O2 -g -march=i386 -mcpu=i686}" ; export CFLAGS ;
  CXXFLAGS="${CXXFLAGS:--O2 -g -march=i386 -mcpu=i686}" ; export CXXFLAGS ;
  FFLAGS="${FFLAGS:--O2 -g -march=i386 -mcpu=i686}" ; export FFLAGS ;
  ./configure --host=i686-redhat-linux-gnu --build=i686-redhat-linux-gnu \
    --target=i386-redhat-linux \
    --program-prefix= \
     --prefix=/usr \
    --exec-prefix=/usr \
    --bindir=/usr/bin \
    --sbindir=/usr/sbin \
    --sysconfdir=/etc \
    --datadir=/usr/share \
    --includedir=/usr/include \
    --libdir=/usr/lib \
    --libexecdir=/usr/libexec \
    --localstatedir=/var \
    --sharedstatedir=/usr/com \
    --mandir=/usr/share/man \
    --infodir=/usr/share/info --disable-rpath \
    --with-perl \
    --with-tcl \
    --with-tclconfig=/usr/lib \
    --with-python \
    --with-openssl \
    --with-pam \
    --with-krb5 \
    --enable-nls \
    --enable-thread-safety \
    --sysconfdir=/etc/sysconfig/pgsql \
    --datadir=/usr/share/pgsql \
    --with-docdir=/usr/share/doc

make  all
make  -C contrib all
make  -C contrib/xml2 all

# Have to hack makefile to put correct path into tutorial scripts
sed "s|C=\`pwd\`;|C=/usr/lib/pgsql/tutorial;|" < src/tutorial/Makefile > 
src/tutorial/GNUmakefile
make  -C src/tutorial NO_PGXS=1 all
rm -f src/tutorial/GNUmakefile

    pushd src/test/regress
    make all
    make MAX_CONNECTIONS=5 check
    make clean
    popd

    pushd src/test/regress
    make RPMTESTING=1 all
    popd

   PYTHON=/usr/bin/python
   python_version=`${PYTHON} -c "import sys; print sys.version[:3]"`
   python_prefix=`${PYTHON} -c "import sys; print sys.prefix"`
   python_includespec="-I${python_prefix}/include/python${python_version}"

   pushd PyGreSQL

   gcc $CFLAGS -fpic -shared -o _pgmodule.so ${python_includespec} 
-I../src/interfaces/libpq -I../src/include -L../src/interfaces/libpq 
-lpq pgmodule.c

   popd

   pushd Pgtcl
   # pgtcl's configure only handles one include directory :-(
   ./configure --prefix=/usr \
     --libdir=/usr/lib \
     --with-tcl=/usr/lib \
     --with-postgres-include="../src/interfaces/libpq -I../src/include" \
     --with-postgres-lib=../src/interfaces/libpq
   # note: as of pgtcl 1.5.2, its makefile is not parallel-safe
   make all
   popd

exit 0

Does anybody have any hint how to proceed?

Regards,

Peter

-- 
 
Dott. Peter Hopfgartner
 
R3 GIS Srl - GmbH
Via Johann Kravogl-Str. 2
I-39012 Meran/Merano (BZ)
Email: peter.hopfgartner at r3-gis.com
Tel. : +39 0473 494949
Fax  : +39 0473 069902
www  : http://www.r3-gis.com