postgres 7.2.1 fails to build on Mac OS X 10.2

From: Drew Wilson <amw(at)apple(dot)com>
To: pgsql-ports(at)postgresql(dot)org
Subject: postgres 7.2.1 fails to build on Mac OS X 10.2
Date: 2002-07-26 22:07:25
Message-ID: 112934F4-A0E4-11D6-AAAF-00039342B2CE@apple.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-ports

I found a problem and a workaround to get 7.2.1 compiling on Mac OS X
10.2, soon to be released.

In case someone hasn't already fixed this problem, I include my diffs
below for my workaround.

If you'd like any testing on OS X, please let me know. I'd be happy to
help out.

Please keep up the excellent work,

Drew

========================================================================
====
POSTGRESQL BUG REPORT TEMPLATE
========================================================================
====

Your name :Drew Wilson
Your email address : amw(at)apple(dot)com

System Configuration
---------------------
Architecture (example: Intel Pentium) : PowerPC

Operating System (example: Linux 2.0.26 ELF) : Mac OS X 10.2

PostgreSQL version (example: PostgreSQL-7.2.1): PostgreSQL-7.2.1

Compiler used (example: gcc 2.95.2) : gcc 3.1 20020420

Please enter a FULL description of your problem:
------------------------------------------------

The next release of Mac OS X, 10.2, now contains sys/sem.h, which
wasn't included in
previous releases. Unfortunately, this conflicts w/
src/include/port/darwin/sem.h.

The two files have different definitions for the same data structures,
leading to
compilation errors.

Please describe a way to repeat the problem. Please try to provide a
concise reproducible example, if at all possible:
----------------------------------------------------------------------

If you know how this problem might be fixed, list the solution below:
---------------------------------------------------------------------

I was able to work around this problem by only including
src/include/port/darwin/sem.h if the system does not have a sem.h
(using the HAVE_SYS_SEM_H conditional.)

I also changed semop()'s third argument type to unsigned (instead of
size_t),
to match the semop defined in sem.h in 10.2.

I was able to build this on 10.2 w/ gcc 3.1 and on 10.1 w/ gcc 2.95.2.

Here are the patches from diff:

src/backend/storage/ipc/ipc.c
38a39,42
> #else
> #if defined(__darwin__)
> #include "port/darwin/sem.h"
> #endif
39a44
>
45,48d49
< #endif
<
< #if defined(__darwin__)
< #include "port/darwin/sem.h"

-dhcp17:~/tools] drew% diff
postgresql-7.2.1/src/backend/storage/lmgr/proc.c
postgresql-7.2.1_mymods/src/backend/storage/lmgr/proc.c
57a58,61
> #else
> #if defined(__darwin__)
> #include "port/darwin/sem.h"
> #endif
60,62d63
< #if defined(__darwin__)
< #include "port/darwin/sem.h"
< #endif

diff postgresql-7.2.1/src/backend/storage/lmgr/spin.c
postgresql-7.2.1_mymods/src/backend/storage/lmgr/spin.c
30,31c30
< #endif
<
---
> #else
33a33
> #endif

diff postgresql-7.2.1/src/backend/storage/lmgr/proc.c
postgresql-7.2.1_mymods/src/backend/storage/lmgr/proc.c
57a58,61
> #else
> #if defined(__darwin__)
> #include "port/darwin/sem.h"
> #endif
60,62d63
< #if defined(__darwin__)
< #include "port/darwin/sem.h"
< #endif

src/backend/port/darwin/sem.c
30c30,36
< #include "port/darwin/sem.h"
---
> #ifdef HAVE_SYS_SEM_H
> #include <sys/sem.h>
> #else
> #if defined(__darwin__)
> #include "port/darwin/sem.h"
> #endif
> #endif
283c289
< semop(int semid, struct sembuf * sops, size_t nsops)
---
> semop(int semid, struct sembuf * sops, unsigned nsops)

src/include/port/darwin/sem.h
68c68
< extern int semop(int semid, struct sembuf * sops, size_t nsops);
---
> extern int semop(int semid, struct sembuf * sops, unsigned nsops);

Responses

Browse pgsql-ports by date

  From Date Subject
Next Message Tom Lane 2002-07-29 14:56:21 Re: postgres 7.2.1 fails to build on Mac OS X 10.2
Previous Message stefan 2002-07-26 09:32:18 Re: [GENERAL] regression test