Subject: Re: postgres 8.2.5 core dumps on 4.0 RC2 mipsel
To: Andy Ruhl <acruhl@gmail.com>
From: Markus W Kilbinger <mk@kilbi.de>
List: port-cobalt
Date: 10/18/2007 09:05:25
>>>>> "Andy" == Andy Ruhl <acruhl@gmail.com> writes:

    Andy> Sorry if I copied too many lists. I just built postgresql82
    Andy> from pkgsrc, which builds 8.2.5 now. I used CFLAGS -mips2,
    Andy> but I think this problem happens no matter if I do that or
    Andy> not. The system is a Cobalt Qube2 which previously ran
    Andy> postgresql
    Andy> 8.2.4 OK.

Hmm, strange I saw the same problem with 8.2.4...

    Andy> Here's what I see. I'm not a good debugger, so if someone
    Andy> wants to help me go through gdb I can get whatever is
    Andy> needed:

    Andy> /etc/rc.d # ./pgsql start

    Andy> Starting pgsql. [1] Segmentation fault "/usr/pkg/bin/po...

Anyway, it seems to be a linker alignment problem on cobalt/mipsel
(see thread around

  http://mail-index.netbsd.org/port-cobalt/2007/05/01/0002.html

). During postgresqlNN-server builds several SUBSYS.o are linked via
'ld -r' which are re-linked finally to the postgres server binary. At
least for one object the correct alignment is 'lost' leading to your
mentioned Segmentation fault.

As menitioned in the thread reference you can circumvent this problem
by adding '-d' to the linkers 'ld -r' actions. I did this (in
pkgsrc/databases/postgresqlNN-server) by

  make cleandir
  make configure

Then edit the Makefile.global in the extracted postgres source, search
for the '-r' option for the linker and extend it to '-r -d'. Then do

  make

... as usual. The resulting postgres binary should run fine.

Markus.