Postgres will not compile on Mac 10.8 with contrib/uuid-ossp

From: Steven Schlansker <steven(at)likeness(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Postgres will not compile on Mac 10.8 with contrib/uuid-ossp
Date: 2012-07-31 01:07:15
Message-ID: 05843630-E25D-442A-A6B0-5CA63622A400@likeness.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It is not possible to compile Postgres contrib/uuid-ossp on the newest release of Mac OS X, 10.8

The specific compile error:

make -C uuid-ossp install

/bin/sh ../../config/install-sh -c -d '/usr/local/Cellar/postgresql/9.1.3/lib'
/usr/bin/clang -Os -w -pipe -march=native -Qunused-arguments -I/usr/local/Cellar/ossp-uuid/1.6.2/include -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -I. -I. -I../../src/include -I/usr/local/Cellar/readline/6.2.2/include -I/usr/include/libxml2 -I/usr/include/libxml2 -c -o uuid-ossp.o uuid-ossp.c

In file included from uuid-ossp.c:27:
In file included from /usr/local/Cellar/ossp-uuid/1.6.2/include/uuid.h:38:
/usr/include/unistd.h:689:26: error: expected identifier
int gethostuuid(uuid_t, const struct timespec *) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
^
In file included from uuid-ossp.c:27:
/usr/local/Cellar/ossp-uuid/1.6.2/include/uuid.h:94:24: error: typedef redefinition with different types ('struct uuid_st' vs '__darwin_uuid_t' (aka 'unsigned char [16]'))
typedef struct uuid_st uuid_t;
^
/usr/include/uuid/uuid.h:42:25: note: previous definition is here
typedef __darwin_uuid_t uuid_t;
^
In file included from uuid-ossp.c:27:
/usr/local/Cellar/ossp-uuid/1.6.2/include/uuid.h:107:22: error: conflicting types for 'uuid_compare'
extern uuid_rc_t uuid_compare (const uuid_t *_uuid, const uuid_t *_uuid2, int *_result);
^
/usr/include/uuid/uuid.h:59:5: note: previous declaration is here
int uuid_compare(const uuid_t uu1, const uuid_t uu2);
^
3 errors generated.
make[2]: *** [uuid-ossp.o] Error 1
make[1]: *** [install-uuid-ossp-recurse] Error 2
make[1]: *** Waiting for unfinished jobs….

Full log available here (not mine, but I have the exact same problem):
https://gist.github.com/2287209

There is a workaround (disable uuid-ossp) but obviously this does not help those of us who require UUID support.

There are a number of bugs open:
https://github.com/mxcl/homebrew/issues/13639
https://trac.macports.org/ticket/35153

and a proposed fix which does fix the problem for me:

> This is caused by the inclusion of the system uuid.h in pwd.h. Just add the line :
>
> #define _XOPEN_SOURCE
>
> at the first line of uuid-ossp.c, and it should compile fine.

I am not sure what the "correct" fix is, but adding the above definition does fix the issue.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2012-07-31 02:14:18 Re: 9.1.4: pg_restore: couldn't uncompress data?
Previous Message Ondrej Ivanič 2012-07-30 23:27:54 new material for "Postgres for MySQL users" presentation