FAQ
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);

Search Discussions

  • Tom Lane at Jul 29, 2002 at 2:56 pm

    Drew Wilson writes:
    I found a problem and a workaround to get 7.2.1 compiling on Mac OS X
    10.2, soon to be released.
    At this point, changes for 7.2.* aren't especially interesting; could
    you check out the portability issue using our CVS tip or a recent
    nightly snapshot? (Since the Darwin semaphore support has been
    completely replaced in CVS tip, I'm not expecting that your patch
    will apply directly.)

    Also, diff -c format is preferred for patches.

    I assume from your address that you work on OS X, so if you don't mind,
    I'd like to rag on you a little about known issues in the Darwin kernel.
    Does 10.2 fix the postmaster-shutdown-failure problem? Does it provide
    a less painful way of increasing the SHMMAX limit than rebuilding the
    kernel from scratch? (Failing that, could we at least get the stock
    SHMMAX limit raised to something reasonable, say a few hundred meg?)

    regards, tom lane
  • Drew Wilson at Jul 30, 2002 at 7:15 am

    On Monday, July 29, 2002, at 07:56 AM, Tom Lane wrote:
    At this point, changes for 7.2.* aren't especially interesting; could
    you check out the portability issue using our CVS tip or a recent
    nightly snapshot? (Since the Darwin semaphore support has been
    completely replaced in CVS tip, I'm not expecting that your patch
    will apply directly.)
    Oops! My bad - I should have thought to look at the latest sources...

    Yes, the latest top-of-tree sources compile just fine on Mac OS X 10.1 and
    10.2.

    I regret to have wasted my time and yours.

    I assume from your address that you work on OS X, so if you don't mind,
    I'd like to rag on you a little about known issues in the Darwin kernel.
    Does 10.2 fix the postmaster-shutdown-failure problem? Does it provide
    a less painful way of increasing the SHMMAX limit than rebuilding the
    kernel from scratch? (Failing that, could we at least get the stock
    SHMMAX limit raised to something reasonable, say a few hundred meg?)
    I don't work on the kernel, nor even the OS proper, but rather tools for
    Apple's localization process. However, I asked around and was able to get
    an answer.

    Yes, 10.2 now adds sysctl support for System 5's shared memory.

    There is a setting in
    /System/Library/StartupItems/SystemTuning/SystemTuning which has what you
    want. Change this line:
    ./SystemTuning/SystemTuning: sysctl -w kern.sysv.shmmax=4194304

    Thanks for your help,

    Drew
  • Tom Lane at Jul 30, 2002 at 1:39 pm

    Drew Wilson writes:
    Yes, 10.2 now adds sysctl support for System 5's shared memory.
    There is a setting in
    /System/Library/StartupItems/SystemTuning/SystemTuning which has what you
    want. Change this line:
    ./SystemTuning/SystemTuning: sysctl -w kern.sysv.shmmax=4194304
    Excellent --- I'll put something in our docs. Thanks for the tip!

    regards, tom lane

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-ports @
categoriespostgresql
postedJul 26, '02 at 10:07p
activeJul 30, '02 at 1:39p
posts4
users2
websitepostgresql.org
irc#postgresql

2 users in discussion

Tom Lane: 2 posts Drew Wilson: 2 posts

People

Translate

site design / logo © 2022 Grokbase