postgres 7.2.1 fails to build on Mac OS X 10.2

Поиск
Список
Период
Сортировка
От Drew Wilson
Тема postgres 7.2.1 fails to build on Mac OS X 10.2
Дата
Msg-id 112934F4-A0E4-11D6-AAAF-00039342B2CE@apple.com
обсуждение исходный текст
Ответы Re: postgres 7.2.1 fails to build on Mac OS X 10.2  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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@apple.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);


В списке pgsql-ports по дате отправления:

Предыдущее
От: Lamar Owen
Дата:
Сообщение: Re: [GENERAL] regression test
Следующее
От: Tom Lane
Дата:
Сообщение: Re: postgres 7.2.1 fails to build on Mac OS X 10.2