Thread: PostgreSQL 7.1.3 vs. gcc 2.95.4 and GNU libc 2.2.4

PostgreSQL 7.1.3 vs. gcc 2.95.4 and GNU libc 2.2.4

From
tomas@fabula.de
Date:
Hi,

trying to compile PostgreSQL 7.1.3 (my system: Linux Debian-ish,
fairly new Gnu libc (where I think the problem resides):
gcc 2.95.4 and GNU libc 2.2.4 bails out at:

|  input.c: In function `initializeInput':
|  input.c:157: warning: passing arg 1 of `on_exit' from incompatible pointer type
|  input.c:157: too few arguments to function `on_exit'
|  make[3]: *** [input.o] Error 1
|  make[3]: Leaving directory `/usr/local/src/postgresql-7.1.3/src/bin/psql'
|  make[2]: *** [all] Error 2

Here's input.c around line 157:


|  #ifdef HAVE_ATEXIT
|          atexit(finishInput);
|  #else
|          on_exit(finishInput);
|  #endif


and here's the prototype from my man(3) on_exit:

| int on_exit(void (*function)(int , void *), void *arg);


Modifying the call in input.c in the obvious way(1) solves the problem
for me, but I'm not an Autoconfiguru and besides I have no clue about
how portable or universal on_exit() is -- so I have no intelligent
patch to submit (I'd like to).

---
(1) on_exit(finishInput, NULL); it complains about incompatible pointer
    type, because of the different function prototype of finishInput, but
    it works.

Cheers
-- tomas

Re: PostgreSQL 7.1.3 vs. gcc 2.95.4 and GNU libc 2.2.4

From
Peter Eisentraut
Date:
tomas@fabula.de writes:

> trying to compile PostgreSQL 7.1.3 (my system: Linux Debian-ish,
> fairly new Gnu libc (where I think the problem resides):
> gcc 2.95.4 and GNU libc 2.2.4 bails out at:
>
> |  input.c: In function `initializeInput':
> |  input.c:157: warning: passing arg 1 of `on_exit' from incompatible pointer type
> |  input.c:157: too few arguments to function `on_exit'
> |  make[3]: *** [input.o] Error 1
> |  make[3]: Leaving directory `/usr/local/src/postgresql-7.1.3/src/bin/psql'
> |  make[2]: *** [all] Error 2

I have installed a fix for this in the development sources; I understand
that you were able to fix this yourself.

The more interesting question is why it's trying to use on_exit() when it
should be using atexit().  If you're interested, you can try to look
through config.log to see what's happening with the atexit test.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter

Re: PostgreSQL 7.1.3 vs. gcc 2.95.4 and GNU libc 2.2.4

From
tomas@fabula.de
Date:
On Wed, Sep 12, 2001 at 01:16:17AM +0200, Peter Eisentraut wrote:
> tomas@fabula.de writes:
>
> > trying to compile PostgreSQL 7.1.3 (my system: Linux Debian-ish,
> > fairly new Gnu libc (where I think the problem resides):
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For once, my gut feeling was right.

> I have installed a fix for this in the development sources; I understand
> that you were able to fix this yourself.

Yes, I'm a happy camper.

> The more interesting question is why it's trying to use on_exit() when it
> should be using atexit().  If you're interested, you can try to look
> through config.log to see what's happening with the atexit test.

Stupid as it may sound, I lost my atexit()  ;-)

Watch this:

|  slon:/home/spu > vim blub.c
|
|  --( blub.c )---------------------------
|  #include <stdio.h>
|  #include <stdlib.h>
|
|  void scream(void)
|  {
|    fprintf(stderr, "AAAARRRGH!\n");
|  }
|
|  int main(int argc, char *argv[])
|  {
|    atexit(scream);
|  }
|  ---------------------------------------
|
|  slon:/home/spu > make blub
|  cc     blub.c   -o blub
|  /tmp/ccmhreih.o: In function `main':
|  /tmp/ccmhreih.o(.text+0x2f): undefined reference to `atexit'
|  collect2: ld returned 1 exit status
|  make: *** [blub] Error 1
|  slon:/home/spu >

So I think PostgreSQL's configure is not to blame for not finding it;
I think it's rather my gcc/libc combination. I guess it's a lesson
to distribution packagers: upgrading a libc is harder than it even
looks.

Do you think I should file a bug with Debian?
They seem to have noticed already (the proposed fix was to upgrade
gcc/cpp, which I did. Before that compile didn't work at all --
I guess I hadn't either atexit() nor on_exit() then).

Thanks a lot
-- tomas