Skip site navigation (1) Skip section navigation (2)

Re: [PORTS] Core dump with initdb on Irix 6.2

From: Remi Lehn <Remi(dot)Lehn(at)irin(dot)univ-nantes(dot)fr>
To: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: PostGres SQL <postgres(at)kittyhawk(dot)aero(dot)rmit(dot)edu(dot)au>, pgsql-ports(at)postgreSQL(dot)org
Subject: Re: [PORTS] Core dump with initdb on Irix 6.2
Date: 1999-05-04 14:36:58
Message-ID: 14126.63337.706213.655820@kir.performanse.com (view raw or flat)
Thread:
Lists: pgsql-ports
You must take care of a bug with gcc-2.8.1 on irix: there is a wrong
padding of 4 bytes structures when calling MipsPro C compiled
functions (such as the whole irix libc) by gcc-compiled functions (see
http://reality.sgi.com/ariel/freeware/gcc-2.8.1-notes.html
paragraph "Known bugs"). You will run into this bug when the
postgres backend call semctl(), (in src/backend/storage/ipc/).

As a quick and dirty workaround (please tell me if you find a better
solution), I modified my /usr/include/sys/sem.h and
/usr/include/arpa/inet.h :

/usr/include/sys/sem.h :

#ifndef _KERNEL
#if defined(sgi) && defined(__GNUC__) && defined(_ABIN32)
#define semctl gnu_semctl
#else
extern int      semctl (int, int, int, ...);
#endif
extern int      semget (key_t, int, int);
extern int      semop  (int, struct sembuf *, size_t);
#endif

/usr/include/arpa/inet.h :

#if defined(sgi) && defined(__GNUC__) && defined(_ABIN32)
#define inet_lnaof gnu_inet_lnaof
#define inet_netof gnu_inet_netof
#define inet_ntoa gnu_inet_ntoa
#else
extern in_addr_t        inet_lnaof(struct in_addr);
extern in_addr_t        inet_netof(struct in_addr);
extern char *           inet_ntoa(struct in_addr);
#endif

and I (gcc-) compiled a library with :

workaround.h :

#if !defined(sgi) || !defined(__GNUC__) || !defined(_ABIN32)
ERROR !defined(sgi) || !defined(GNUC) || !defined(_ABIN32)
#endif

char *gnu_inet_ntoa(struct in_addr in);
unsigned long int gnu_inet_lnaof(struct in_addr in);
unsigned long int gnu_inet_netof(struct in_addr in);
int gnu_semctl(int semid, int semnun, int cmd, union semun arg);

workaround.c :

#if !defined(sgi) || !defined(__GNUC__) || !defined(_ABIN32)
ERROR !defined(sgi) || !defined(GNUC) || !defined(_ABIN32)
#endif

#include <sys/types.h>

struct in_addr {

        unsigned long int s_addr;
};

char *gnu_inet_ntoa(struct in_addr in) {

        return inet_ntoa( (int64_t)in.s_addr << 32 );
}

unsigned long int gnu_inet_lnaof(struct in_addr in) {

        return inet_lnaof( (int64_t)in.s_addr << 32 );

}

unsigned long int gnu_inet_lnaof(struct in_addr in) {

        return inet_lnaof( (int64_t)in.s_addr << 32 );

}

unsigned long int gnu_inet_netof(struct in_addr in) {

        return inet_netof( (int64_t)in.s_addr << 32 );

}

union semun {
        int val; /* used for SETVAL only */
        struct semid_ds *buf; /* for IPC_STAT and IPC_SET */
        ushort *array;  /* used for GETALL and SETALL */
};

int gnu_semctl(int semid, int semnun, int cmd, union semun arg) {

        return semctl(semid, semnun, cmd, (int64_t)arg.val << 32 );

}

Then, when compiling with gcc-2.8.1 in n32 binary with irix,
semctl() is changed in gnu_semctl(), and, of course, the final
link must include the workaround library.

PostgreSQL doesn't use inet_xtoy (does it ?). These functions
(semctl() and inet_xtoy) seem to be the only ones in the irix
libc that make problems.

I hope this will help,

RĂ©mi.

Thomas Lockhart writes:
 > > After switching to gcc 2.8.1 (thanks to Remi), I've managed to get 
 > > initdb and postmaster running now - woo who!!
 > > However, my excitement was short live. After examining make log, I 
 > > find that psql doesn't compile. Hence createdb will stall.
 > > Here's the message
 > > ld32: FATAL 12: Expecting n32 objects:
 > >                /usr/local/lib/libreadline.a(readline.o) is o32.
 > > How shouild I fix this? I'm now using gcc 2.8.1  My environment 
 > > variable SGI_ABI is set to -n32.
 > 
 > It looks like libreadline (which you installed earlier) was built
 > using o32, whatever that is, and that is different from n32. Try
 > rebuilding libreadline or build all of postgres with using o32.
 > 
 > Another option is to explicitly disable using readline; look in
 > config.h or figure out how to disable it using configure.
 > 
 > Good luck.
 > 
 >                      - Tom
 > 
 > -- 
 > Thomas Lockhart				lockhart(at)alumni(dot)caltech(dot)edu
 > South Pasadena, California
 > 

In response to

pgsql-ports by date

Next:From: Unprivileged userDate: 1999-05-04 21:05:54
Subject: Port Bug Report: libncurses.so.4 not found
Previous:From: Chris HowellDate: 1999-05-04 14:26:38
Subject: Postgres installation problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group