Re: Compiling PostgreSQL 8.1.5 with 64-bit on a G5 SOLVED

Lists: pgsql-ports
From: Brian Wipf <brian(at)clickspace(dot)com>
To: pgsql-ports(at)postgresql(dot)org
Cc: Brendan Duddridge <brendan(at)clickspace(dot)com>, Guido Neitzer <lists(at)event-s(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Compiling PostgreSQL 8.1.5 with 64-bit on a G5
Date: 2006-11-27 19:53:31
Message-ID: AB6F2081-C828-43EF-88DD-641196C61F33@clickspace.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-ports

I'm having difficulty compiling PostgreSQL 8.1.5 with 64-bit
instructions on a G5 running Mac OS X Server 10.4.8.

./configure --prefix=/usr/local/pgsql --enable-thread-safety CFLAGS='-
O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-
after-statement -Wendif-labels -fno-strict-aliasing -mcpu=970 -
mtune=970 -mpowerpc64 -mpowerpc-gpopt -arch ppc64' --without-readline
--without-zlib

I had to specify --without-readline and --without-zlib, because they
are presumably 32-bit on the system. The following error occurs when
calling configure as above:

checking thread safety of required library functions... no
configure: error:
*** Thread test program failed. Your platform is not thread-safe.
*** Check the file 'config.log'for the exact reason.

And the config.log has the following:

configure:22595: gcc -no-cpp-precomp -o conftest -O2 -Wall -Wmissing-
prototypes -Wpointer-arith -Winline -Wdeclaration-after-statement -
Wendif-labels -fno-strict-aliasing -mcpu=970 -mtune=970 -mpo
werpc64 -mpowerpc-gpopt -arch ppc64 -Wall -Wmissing-prototypes -
Wpointer-arith -Winline -Wdeclaration-after-statement -Wendif-labels -
fno-strict-aliasing -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHR
EAD_SEMANTICS -DIN_CONFIGURE conftest.c -lresolv -ldl -lm >&5
In file included from conftest.c:131:
./src/tools/thread/thread_test.c:141: error: parse error before
'platform_is_threadsafe'
./src/tools/thread/thread_test.c:141: warning: type defaults to 'int'
in declaration of 'platform_is_threadsafe'
...

and line 141 of thread_test.c is:
static bool platform_is_threadsafe = true;

So I changed thread_test.c (lines 27 - 29) from

#ifndef bool
typedef char bool;
#endif

to

#undef bool
#ifndef bool
typedef char bool;
#endif

and then the configure went through successfully.

On to make. When I tried to make, I got the following errors:

In file included from ../../src/include/postgres.h:48,
from copydir.c:19:
../../src/include/c.h:194: error: parse error before '*' token
../../src/include/c.h:194: warning: type defaults to 'int' in
declaration of 'BoolPtr'
../../src/include/c.h:194: warning: data definition has no type or
storage class

So, then I made a similar change to c.h as I did to thread_test.c by
adding #undef bool before #ifndef bool.

and then make goes a lot further and comes up with a ton of "warning:
type defaults to 'int' in declaration of ..." errors. A full log of
the errors follow below. Any PostgreSQL developer have access to a G5
OS X box where they can specify 'arch ppc64' in the CFLAGS? Or, any
ideas I can try to get PostgreSQL 8.1.5 compiled with 64-bit
instructions on a G5 running OS X Tiger with the 'arch ppc64' flag?

I'd appreciate any suggestions.

Brian Wipf
<brian(at)clickspace(dot)com>

Errors trying to make:
In file included from ../../../../src/include/storage/spin.h:60,
from xlog.c:44:
../../../../src/include/storage/s_lock.h:806:2: error: #error
PostgreSQL does not have native spinlock support on this platform. To
continue the compilation, rerun configure using --disable-spinlocks.
However, performance will be poor. Please report this to pgsql-
bugs(at)postgresql(dot)org(dot)
In file included from ../../../../src/include/storage/spin.h:60,
from xlog.c:44:
../../../../src/include/storage/s_lock.h:863: warning: type defaults
to 'int' in declaration of 'slock_t'
../../../../src/include/storage/s_lock.h:863: error: parse error
before '*' token
../../../../src/include/storage/s_lock.h:873: warning: type defaults
to 'int' in declaration of 'slock_t'
../../../../src/include/storage/s_lock.h:873: error: parse error
before '*' token
xlog.c:382: error: parse error before 'slock_t'
xlog.c:382: warning: no semicolon at end of struct or union
xlog.c:383: warning: type defaults to 'int' in declaration of
'XLogCtlData'
xlog.c:383: warning: data definition has no type or storage class
xlog.c:385: error: parse error before '*' token
xlog.c:385: warning: type defaults to 'int' in declaration of 'XLogCtl'
xlog.c:385: warning: data definition has no type or storage class
xlog.c: In function 'XLogInsert':
xlog.c:525: error: request for member 'Insert' in something not a
structure or union
xlog.c:696: error: nested functions are disabled, use -fnested-
functions to re-enable
xlog.c:696: error: syntax error before '*' token
xlog.c:698: error: 'xlogctl' undeclared (first use in this function)
xlog.c:698: error: (Each undeclared identifier is reported only once
xlog.c:698: error: for each function it appears in.)
xlog.c:701: error: parse error before 'slock_t'
xlog.c:711: error: request for member 'XLogCacheByte' in something
not a structure or union
xlog.c:723: error: request for member 'Write' in something not a
structure or union
xlog.c:850: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:850: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:850: warning: statement with no effect
xlog.c:926: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:926: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:926: warning: statement with no effect
xlog.c:933: error: request for member 'XLogCacheBlck' in something
not a structure or union
xlog.c:934: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:941: error: nested functions are disabled, use -fnested-
functions to re-enable
xlog.c:941: error: syntax error before '*' token
xlog.c:949: error: parse error before 'slock_t'
xlog.c: In function 'AdvanceXLInsertBuffer':
xlog.c:1152: error: request for member 'Insert' in something not a
structure or union
xlog.c:1153: error: request for member 'Write' in something not a
structure or union
xlog.c:1154: error: request for member 'XLogCacheBlck' in something
not a structure or union
xlog.c:1170: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:1176: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:1181: error: nested functions are disabled, use -fnested-
functions to re-enable
xlog.c:1181: error: syntax error before '*' token
xlog.c:1183: error: 'xlogctl' undeclared (first use in this function)
xlog.c:1187: error: parse error before 'slock_t'
xlog.c:1228: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:1237: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:1238: error: request for member 'pages' in something not a
structure or union
xlog.c: In function 'XLogWrite':
xlog.c:1291: error: request for member 'Write' in something not a
structure or union
xlog.c:1337: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:1337: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:1337: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:1340: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:1341: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:1344: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:1447: error: request for member 'XLogCacheBlck' in something
not a structure or union
xlog.c:1466: error: request for member 'pages' in something not a
structure or union
xlog.c:1484: error: request for member 'XLogCacheBlck' in something
not a structure or union
xlog.c:1513: error: request for member 'XLogCacheBlck' in something
not a structure or union
xlog.c:1566: error: nested functions are disabled, use -fnested-
functions to re-enable
xlog.c:1566: error: syntax error before '*' token
xlog.c:1568: error: 'xlogctl' undeclared (first use in this function)
xlog.c:1574: error: parse error before 'slock_t'
xlog.c: In function 'XLogFlush':
xlog.c:1624: error: nested functions are disabled, use -fnested-
functions to re-enable
xlog.c:1624: error: syntax error before '*' token
xlog.c:1626: error: 'xlogctl' undeclared (first use in this function)
xlog.c:1630: error: parse error before 'slock_t'
xlog.c:1638: error: request for member 'Write' in something not a
structure or union
xlog.c:1644: error: request for member 'Insert' in something not a
structure or union
xlog.c:1648: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:1651: error: request for member 'xlblocks' in something not a
structure or union
xlog.c: In function 'XLOGShmemInit':
xlog.c:3721: error: parse error before ')' token
xlog.c:3739: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:3740: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:3747: error: request for member 'pages' in something not a
structure or union
xlog.c:3748: error: request for member 'pages' in something not a
structure or union
xlog.c:3754: error: request for member 'XLogCacheByte' in something
not a structure or union
xlog.c:3756: error: request for member 'XLogCacheBlck' in something
not a structure or union
xlog.c:3757: error: request for member 'Insert' in something not a
structure or union
xlog.c:3757: error: request for member 'pages' in something not a
structure or union
xlog.c:3758: error: parse error before 'slock_t'
xlog.c:3758: error: request for member 'info_lck' in something not a
structure or union
xlog.c: In function 'StartupXLOG':
xlog.c:4491: error: request for member 'Insert' in something not a
structure or union
xlog.c:4678: error: request for member 'ThisTimeLineID' in something
not a structure or union
xlog.c:4700: error: request for member 'Insert' in something not a
structure or union
xlog.c:4702: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:4703: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:4714: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:4718: error: request for member 'Write' in something not a
structure or union
xlog.c:4720: error: request for member 'LogwrtResult' in something
not a structure or union
xlog.c:4722: error: request for member 'LogwrtRqst' in something not
a structure or union
xlog.c:4723: error: request for member 'LogwrtRqst' in something not
a structure or union
xlog.c:4730: error: request for member 'Write' in something not a
structure or union
xlog.c:4742: error: request for member 'Write' in something not a
structure or union
xlog.c:4742: error: request for member 'XLogCacheBlck' in something
not a structure or union
xlog.c: In function 'InitXLOGAccess':
xlog.c:4970: error: request for member 'ThisTimeLineID' in something
not a structure or union
xlog.c: In function 'GetRedoRecPtr':
xlog.c:4984: error: nested functions are disabled, use -fnested-
functions to re-enable
xlog.c:4984: error: syntax error before '*' token
xlog.c:4986: error: 'xlogctl' undeclared (first use in this function)
xlog.c:4989: error: parse error before 'slock_t'
xlog.c: In function 'CreateCheckPoint':
xlog.c:5055: error: request for member 'Insert' in something not a
structure or union
xlog.c:5118: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:5118: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:5118: warning: statement with no effect
xlog.c:5150: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:5150: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:5150: warning: statement with no effect
xlog.c:5165: error: nested functions are disabled, use -fnested-
functions to re-enable
xlog.c:5165: error: syntax error before '*' token
xlog.c:5167: error: 'xlogctl' undeclared (first use in this function)
xlog.c:5169: error: parse error before 'slock_t'
xlog.c: In function 'pg_stop_backup':
xlog.c:5718: error: request for member 'Insert' in something not a
structure or union
xlog.c:5743: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:5743: error: request for member 'xlblocks' in something not a
structure or union
xlog.c:5743: warning: statement with no effect
make[4]: *** [xlog.o] Error 1
make[3]: *** [transam-recursive] Error 2
make[2]: *** [access-recursive] Error 2
make[1]: *** [all] Error 2
make: *** [all] Error 2


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brian Wipf <brian(at)clickspace(dot)com>
Cc: pgsql-ports(at)postgresql(dot)org, Brendan Duddridge <brendan(at)clickspace(dot)com>, Guido Neitzer <lists(at)event-s(dot)net>
Subject: Re: Compiling PostgreSQL 8.1.5 with 64-bit on a G5
Date: 2006-11-27 20:48:55
Message-ID: 24175.1164660535@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-ports

Brian Wipf <brian(at)clickspace(dot)com> writes:
> I'm having difficulty compiling PostgreSQL 8.1.5 with 64-bit
> instructions on a G5 running Mac OS X Server 10.4.8.

Hmm. This looks a *whole* lot like the problems in this thread:
http://archives.postgresql.org/pgsql-hackers/2005-11/msg00066.php
specifically
http://archives.postgresql.org/pgsql-hackers/2005-11/msg00104.php

So my suggestion is to get rid of that -mcpu=970, and maybe some more of
the -m flags too, until you don't get any definition of "bool" in the
output from
$ echo >foo.c
$ gcc -E -dM <<all your other CFLAGS>> foo.c

regards, tom lane


From: Brian Wipf <brian(at)clickspace(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-ports(at)postgresql(dot)org, Brendan Duddridge <brendan(at)clickspace(dot)com>, Guido Neitzer <lists(at)event-s(dot)net>
Subject: Re: Compiling PostgreSQL 8.1.5 with 64-bit on a G5
Date: 2006-11-28 00:38:58
Message-ID: D4E50A09-DE45-4244-BC93-0529A10A2A56@clickspace.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-ports

On 27-Nov-06, at 1:48 PM, Tom Lane wrote:
> So my suggestion is to get rid of that -mcpu=970, and maybe some
> more of
> the -m flags too, until you don't get any definition of "bool" in the
> output from
> $ echo >foo.c
> $ gcc -E -dM <<all your other CFLAGS>> foo.c
Removing -mcpu=970 got rid of the #define bool bool, among other
things, which allowed the configure to go through without modifying
any code. The make still fails with what looks like identical errors.
The only flag I'm now specifying in addition to a vanilla configure,
is the -arch ppc64, which I believe is required for 64-bit.

./configure --prefix=/usr/local/pgsql --enable-thread-safety CFLAGS='-
O2 -Wall -Wmissing-prototypes -Wpointer-arith -Winline -Wdeclaration-
after-statement -Wendif-labels -fno-strict-aliasing -arch ppc64' --
without-readline --without-zlib

Errors are, again, the same as before:
../../../../src/include/storage/s_lock.h:806:2: error: #error
PostgreSQL does not have native spinlock support on this platform. To
continue the compilation, rerun configure using --disable-spinlocks.
However, performance will be poor. Please report this to pgsql-
bugs(at)postgresql(dot)org(dot)
In file included from ../../../../src/include/storage/spin.h:60,
from xlog.c:44:
../../../../src/include/storage/s_lock.h:863: warning: type defaults
to 'int' in declaration of 'slock_t'
../../../../src/include/storage/s_lock.h:863: error: parse error
before '*' token
../../../../src/include/storage/s_lock.h:873: warning: type defaults
to 'int' in declaration of 'slock_t'
../../../../src/include/storage/s_lock.h:873: error: parse error
before '*' token
...
...

Here's a diff of the ouput of $ gcc -E -dM -arch ppc64 foo.c and $
gcc -E -dm foo.c:

< #define __UINTMAX_TYPE__ long unsigned int
---
> #define __UINTMAX_TYPE__ long long unsigned int
21a22
> #define __ppc__ 1
36d36
< #define __LP64__ 1
39d38
< #define __ppc64__ 1
51c50
< #define __LONG_MAX__ 9223372036854775807L
---
> #define __LONG_MAX__ 2147483647L
66,67c65
< #define _LP64 1
< #define __INTMAX_MAX__ 9223372036854775807L
---
> #define __INTMAX_MAX__ 9223372036854775807LL
72c70
< #define __INTMAX_TYPE__ long int
---
> #define __INTMAX_TYPE__ long long int
76,77c74
< #define __PTRDIFF_TYPE__ long int
< #define _ARCH_PPC64 1
---
> #define __PTRDIFF_TYPE__ int


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brian Wipf <brian(at)clickspace(dot)com>
Cc: pgsql-ports(at)postgresql(dot)org, Brendan Duddridge <brendan(at)clickspace(dot)com>, Guido Neitzer <lists(at)event-s(dot)net>
Subject: Re: Compiling PostgreSQL 8.1.5 with 64-bit on a G5
Date: 2006-11-28 00:48:22
Message-ID: 26231.1164674902@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-ports

Brian Wipf <brian(at)clickspace(dot)com> writes:
> Removing -mcpu=970 got rid of the #define bool bool, among other
> things, which allowed the configure to go through without modifying
> any code. The make still fails with what looks like identical errors.

> ../../../../src/include/storage/s_lock.h:806:2: error: #error
> PostgreSQL does not have native spinlock support on this platform. To
> continue the compilation, rerun configure using --disable-spinlocks.
> However, performance will be poor. Please report this to pgsql-
> bugs(at)postgresql(dot)org(dot)

Ah. For that you need this patch:
http://archives.postgresql.org/pgsql-committers/2006-04/msg00217.php
which is in HEAD (8.2) but not any older branch.

regards, tom lane


From: Brian Wipf <brian(at)clickspace(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-ports(at)postgresql(dot)org, Brendan Duddridge <brendan(at)clickspace(dot)com>, Guido Neitzer <lists(at)event-s(dot)net>
Subject: Re: Compiling PostgreSQL 8.1.5 with 64-bit on a G5 SOLVED
Date: 2006-11-28 01:16:20
Message-ID: 418CDBAD-CF9C-4A87-BB68-8DEF5F2912E0@clickspace.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-ports

Thanks for your help, Tom!

I applied that patch to s_lock.h in our PostgreSQL 8.1.5 source, and
the 64-bit compile went through without a hitch.

On 27-Nov-06, at 5:48 PM, Tom Lane wrote:

> Brian Wipf <brian(at)clickspace(dot)com> writes:
>> Removing -mcpu=970 got rid of the #define bool bool, among other
>> things, which allowed the configure to go through without modifying
>> any code. The make still fails with what looks like identical errors.
>
>> ../../../../src/include/storage/s_lock.h:806:2: error: #error
>> PostgreSQL does not have native spinlock support on this platform. To
>> continue the compilation, rerun configure using --disable-spinlocks.
>> However, performance will be poor. Please report this to pgsql-
>> bugs(at)postgresql(dot)org(dot)
>
> Ah. For that you need this patch:
> http://archives.postgresql.org/pgsql-committers/2006-04/msg00217.php
> which is in HEAD (8.2) but not any older branch.
>
> regards, tom lane
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brian Wipf <brian(at)clickspace(dot)com>
Cc: pgsql-ports(at)postgresql(dot)org, Brendan Duddridge <brendan(at)clickspace(dot)com>, Guido Neitzer <lists(at)event-s(dot)net>
Subject: Re: Compiling PostgreSQL 8.1.5 with 64-bit on a G5 SOLVED
Date: 2006-11-28 01:17:58
Message-ID: 26575.1164676678@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-ports

Brian Wipf <brian(at)clickspace(dot)com> writes:
> I applied that patch to s_lock.h in our PostgreSQL 8.1.5 source, and
> the 64-bit compile went through without a hitch.

Does it pass "make check"?

regards, tom lane


From: Brian Wipf <brian(at)clickspace(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-ports(at)postgresql(dot)org, Brendan Duddridge <brendan(at)clickspace(dot)com>, Guido Neitzer <lists(at)event-s(dot)net>
Subject: Re: Compiling PostgreSQL 8.1.5 with 64-bit on a G5 SOLVED
Date: 2006-11-28 01:32:35
Message-ID: B4C37758-D690-473F-9E21-B659EF150F24@clickspace.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-ports

On 27-Nov-06, at 6:17 PM, Tom Lane wrote:
> Brian Wipf <brian(at)clickspace(dot)com> writes:
>> I applied that patch to s_lock.h in our PostgreSQL 8.1.5 source, and
>> the 64-bit compile went through without a hitch.
>
> Does it pass "make check"?

Umm, no. Maybe we should wait for 8.2 before going 64-bit in production?

test create_function_1 ... FAILED
...
triggers ... FAILED
...

=======================
2 of 98 tests failed.
=======================

start of regression.out:

*** ./expected/create_function_1.out Tue Nov 28 01:20:45 2006
--- ./results/create_function_1.out Tue Nov 28 01:21:16 2006
***************
*** 27,40 ****
--- 27,43 ----
RETURNS trigger
AS '/Users/admin/Downloads/postgresql-8.1.5/src/test/
regress/../../../contrib/spi/refint.so'
LANGUAGE 'C';
+ ERROR: could not load library "/Users/admin/Downloads/
postgresql-8.1.5/src/test/regress/../../../contrib/spi/refint.so":
inappropriate object file
CREATE FUNCTION check_foreign_key ()
RETURNS trigger
AS '/Users/admin/Downloads/postgresql-8.1.5/src/test/
regress/../../../contrib/spi/refint.so'
LANGUAGE 'C';
+ ERROR: could not load library "/Users/admin/Downloads/
postgresql-8.1.5/src/test/regress/../../../contrib/spi/refint.so":
inappropriate object file
CREATE FUNCTION autoinc ()
RETURNS trigger
AS '/Users/admin/Downloads/postgresql-8.1.5/src/test/
regress/../../../contrib/spi/autoinc.so'
LANGUAGE 'C';
+ ERROR: could not load library "/Users/admin/Downloads/
postgresql-8.1.5/src/test/regress/../../../contrib/spi/autoinc.so":
inappropriate object file
CREATE FUNCTION funny_dup17 ()
RETURNS trigger
AS '/Users/admin/Downloads/postgresql-8.1.5/src/test/
regress/regress.so'

======================================================================

*** ./expected/triggers.out Tue Aug 30 19:57:48 2005
--- ./results/triggers.out Tue Nov 28 01:21:19 2006
***************
*** 24,33 ****
--- 24,35 ----
for each row
execute procedure
check_primary_key ('fkey1', 'fkey2', 'pkeys', 'pkey1',
'pkey2');
+ ERROR: function check_primary_key() does not exist
...


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brian Wipf <brian(at)clickspace(dot)com>
Cc: pgsql-ports(at)postgresql(dot)org, Brendan Duddridge <brendan(at)clickspace(dot)com>, Guido Neitzer <lists(at)event-s(dot)net>
Subject: Re: Compiling PostgreSQL 8.1.5 with 64-bit on a G5 SOLVED
Date: 2006-11-28 01:39:07
Message-ID: 26816.1164677947@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-ports

Brian Wipf <brian(at)clickspace(dot)com> writes:
> On 27-Nov-06, at 6:17 PM, Tom Lane wrote:
>> Does it pass "make check"?

> Umm, no. Maybe we should wait for 8.2 before going 64-bit in production?

If you don't help us debug it then 8.2 won't be any better.

> RETURNS trigger
> AS '/Users/admin/Downloads/postgresql-8.1.5/src/test/
> regress/../../../contrib/spi/refint.so'
> LANGUAGE 'C';
> + ERROR: could not load library "/Users/admin/Downloads/
> postgresql-8.1.5/src/test/regress/../../../contrib/spi/refint.so":
> inappropriate object file

Try "make clean; make all" in src/test/regress and watch the make output
to see exactly how refint.so is getting built. I suspect your 64-bit
CFLAGS are not getting propagated there for some reason.

regards, tom lane


From: Brian Wipf <brian(at)clickspace(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-ports(at)postgresql(dot)org, Brendan Duddridge <brendan(at)clickspace(dot)com>, Guido Neitzer <lists(at)event-s(dot)net>
Subject: Re: Compiling PostgreSQL 8.1.5 with 64-bit on a G5 SOLVED
Date: 2006-11-28 02:21:48
Message-ID: CADD371E-2F1C-47F0-A492-A24D8273AF5D@clickspace.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-ports

On 27-Nov-06, at 6:39 PM, Tom Lane wrote:
> If you don't help us debug it then 8.2 won't be any better.
I thought maybe this worked for 8.2. I'm glad to be able to help.
>
>> RETURNS trigger
>> AS '/Users/admin/Downloads/postgresql-8.1.5/src/test/
>> regress/../../../contrib/spi/refint.so'
>> LANGUAGE 'C';
>> + ERROR: could not load library "/Users/admin/Downloads/
>> postgresql-8.1.5/src/test/regress/../../../contrib/spi/refint.so":
>> inappropriate object file
>
> Try "make clean; make all" in src/test/regress and watch the make
> output
> to see exactly how refint.so is getting built. I suspect your 64-bit
> CFLAGS are not getting propagated there for some reason.

Here's a complete dump of make all, after doing a make clean, from
src/test/regress:

$ make all
sed -e 's,@bindir@,/usr/local/pgsql/bin,g' \
-e 's,@libdir@,/usr/local/pgsql/lib,g' \
-e 's,@pkglibdir@,/usr/local/pgsql/lib,g' \
-e 's,@datadir@,/usr/local/pgsql/share,g' \
-e 's/@VERSION@/8.1.5/g' \
-e 's/@host_tuple@/powerpc-apple-darwin8.8.0/g' \
-e 's,@GMAKE@,make,g' \
-e 's/@enable_shared@/yes/g' \
-e 's/@GCC@/yes/g' \
pg_regress.sh >pg_regress
chmod a+x pg_regress
gcc -no-cpp-precomp -O2 -Wall -Wmissing-prototypes -Wpointer-arith -
Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-
aliasing -arch ppc64 -Wall -Wmissing-prototypes -Wpointer-arith -
Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-
aliasing -I../../../src/include -c -o regress.o regress.c
gcc -no-cpp-precomp -O2 -Wall -Wmissing-prototypes -Wpointer-arith -
Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-
aliasing -arch ppc64 -Wall -Wmissing-prototypes -Wpointer-arith -
Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-
aliasing -bundle regress.o -L../../../src/port -
bundle_loader ../../../src/backend/postgres -o libregress.0.0.so
rm -f libregress.0.so
ln -s libregress.0.0.so libregress.0.so
rm -f libregress.so
ln -s libregress.0.0.so libregress.so
rm -f regress.so
ln -s libregress.0.0.so regress.so
sed -e 's,@abs_srcdir@,/Users/admin/Downloads/postgresql-8.1.5/src/
test/regress,g' -e 's,@abs_builddir@,/Users/admin/Downloads/
postgresql-8.1.5/src/test/regress,g' -e 's,@testtablespace@,/Users/
admin/Downloads/postgresql-8.1.5/src/test/regress/testtablespace,g' -
e 's/@DLSUFFIX@/.so/g' input/copy.source >sql/copy.sql
sed -e 's,@abs_srcdir@,/Users/admin/Downloads/postgresql-8.1.5/src/
test/regress,g' -e 's,@abs_builddir@,/Users/admin/Downloads/
postgresql-8.1.5/src/test/regress,g' -e 's,@testtablespace@,/Users/
admin/Downloads/postgresql-8.1.5/src/test/regress/testtablespace,g' -
e 's/@DLSUFFIX@/.so/g' input/create_function_1.source >sql/
create_function_1.sql
sed -e 's,@abs_srcdir@,/Users/admin/Downloads/postgresql-8.1.5/src/
test/regress,g' -e 's,@abs_builddir@,/Users/admin/Downloads/
postgresql-8.1.5/src/test/regress,g' -e 's,@testtablespace@,/Users/
admin/Downloads/postgresql-8.1.5/src/test/regress/testtablespace,g' -
e 's/@DLSUFFIX@/.so/g' input/create_function_2.source >sql/
create_function_2.sql
sed -e 's,@abs_srcdir@,/Users/admin/Downloads/postgresql-8.1.5/src/
test/regress,g' -e 's,@abs_builddir@,/Users/admin/Downloads/
postgresql-8.1.5/src/test/regress,g' -e 's,@testtablespace@,/Users/
admin/Downloads/postgresql-8.1.5/src/test/regress/testtablespace,g' -
e 's/@DLSUFFIX@/.so/g' input/misc.source >sql/misc.sql
sed -e 's,@abs_srcdir@,/Users/admin/Downloads/postgresql-8.1.5/src/
test/regress,g' -e 's,@abs_builddir@,/Users/admin/Downloads/
postgresql-8.1.5/src/test/regress,g' -e 's,@testtablespace@,/Users/
admin/Downloads/postgresql-8.1.5/src/test/regress/testtablespace,g' -
e 's/@DLSUFFIX@/.so/g' input/constraints.source >sql/constraints.sql
sed -e 's,@abs_srcdir@,/Users/admin/Downloads/postgresql-8.1.5/src/
test/regress,g' -e 's,@abs_builddir@,/Users/admin/Downloads/
postgresql-8.1.5/src/test/regress,g' -e 's,@testtablespace@,/Users/
admin/Downloads/postgresql-8.1.5/src/test/regress/testtablespace,g' -
e 's/@DLSUFFIX@/.so/g' input/tablespace.source >sql/tablespace.sql
sed -e 's,@abs_srcdir@,/Users/admin/Downloads/postgresql-8.1.5/src/
test/regress,g' -e 's,@abs_builddir@,/Users/admin/Downloads/
postgresql-8.1.5/src/test/regress,g' -e 's,@testtablespace@,/Users/
admin/Downloads/postgresql-8.1.5/src/test/regress/testtablespace,g' -
e 's/@DLSUFFIX@/.so/g' output/copy.source >expected/copy.out
sed -e 's,@abs_srcdir@,/Users/admin/Downloads/postgresql-8.1.5/src/
test/regress,g' -e 's,@abs_builddir@,/Users/admin/Downloads/
postgresql-8.1.5/src/test/regress,g' -e 's,@testtablespace@,/Users/
admin/Downloads/postgresql-8.1.5/src/test/regress/testtablespace,g' -
e 's/@DLSUFFIX@/.so/g' output/create_function_1.source >expected/
create_function_1.out
sed -e 's,@abs_srcdir@,/Users/admin/Downloads/postgresql-8.1.5/src/
test/regress,g' -e 's,@abs_builddir@,/Users/admin/Downloads/
postgresql-8.1.5/src/test/regress,g' -e 's,@testtablespace@,/Users/
admin/Downloads/postgresql-8.1.5/src/test/regress/testtablespace,g' -
e 's/@DLSUFFIX@/.so/g' output/create_function_2.source >expected/
create_function_2.out
sed -e 's,@abs_srcdir@,/Users/admin/Downloads/postgresql-8.1.5/src/
test/regress,g' -e 's,@abs_builddir@,/Users/admin/Downloads/
postgresql-8.1.5/src/test/regress,g' -e 's,@testtablespace@,/Users/
admin/Downloads/postgresql-8.1.5/src/test/regress/testtablespace,g' -
e 's/@DLSUFFIX@/.so/g' output/misc.source >expected/misc.out
sed -e 's,@abs_srcdir@,/Users/admin/Downloads/postgresql-8.1.5/src/
test/regress,g' -e 's,@abs_builddir@,/Users/admin/Downloads/
postgresql-8.1.5/src/test/regress,g' -e 's,@testtablespace@,/Users/
admin/Downloads/postgresql-8.1.5/src/test/regress/testtablespace,g' -
e 's/@DLSUFFIX@/.so/g' output/constraints.source >expected/
constraints.out
sed -e 's,@abs_srcdir@,/Users/admin/Downloads/postgresql-8.1.5/src/
test/regress,g' -e 's,@abs_builddir@,/Users/admin/Downloads/
postgresql-8.1.5/src/test/regress,g' -e 's,@testtablespace@,/Users/
admin/Downloads/postgresql-8.1.5/src/test/regress/testtablespace,g' -
e 's/@DLSUFFIX@/.so/g' output/tablespace.source >expected/tablespace.out
make -C ../../../contrib/spi refint.so autoinc.so
gcc -no-cpp-precomp -O2 -Wall -Wmissing-prototypes -Wpointer-arith -
Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-
aliasing -arch ppc64 -Wall -Wmissing-prototypes -Wpointer-arith -
Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-
aliasing -DREFINT_VERBOSE -I. -I../../src/include -c -o refint.o
refint.c
gcc -no-cpp-precomp -bundle -o refint.so refint.o -
bundle_loader ../../src/backend/postgres
gcc -no-cpp-precomp -O2 -Wall -Wmissing-prototypes -Wpointer-arith -
Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-
aliasing -arch ppc64 -Wall -Wmissing-prototypes -Wpointer-arith -
Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-
aliasing -DREFINT_VERBOSE -I. -I../../src/include -c -o autoinc.o
autoinc.c
gcc -no-cpp-precomp -bundle -o autoinc.so autoinc.o -
bundle_loader ../../src/backend/postgres
rm refint.o autoinc.o


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brian Wipf <brian(at)clickspace(dot)com>
Cc: pgsql-ports(at)postgresql(dot)org, Brendan Duddridge <brendan(at)clickspace(dot)com>, Guido Neitzer <lists(at)event-s(dot)net>
Subject: Re: Compiling PostgreSQL 8.1.5 with 64-bit on a G5 SOLVED
Date: 2006-11-28 02:46:10
Message-ID: 27491.1164681970@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-ports

Brian Wipf <brian(at)clickspace(dot)com> writes:
> On 27-Nov-06, at 6:39 PM, Tom Lane wrote:
>> Try "make clean; make all" in src/test/regress and watch the make output
>> to see exactly how refint.so is getting built. I suspect your 64-bit
>> CFLAGS are not getting propagated there for some reason.

> make -C ../../../contrib/spi refint.so autoinc.so
> gcc -no-cpp-precomp -O2 -Wall -Wmissing-prototypes -Wpointer-arith -
> Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-
> aliasing -arch ppc64 -Wall -Wmissing-prototypes -Wpointer-arith -
> Winline -Wdeclaration-after-statement -Wendif-labels -fno-strict-
> aliasing -DREFINT_VERBOSE -I. -I../../src/include -c -o refint.o
> refint.c
> gcc -no-cpp-precomp -bundle -o refint.so refint.o -
> bundle_loader ../../src/backend/postgres

Hm, well the -arch flag is getting to the gcc -c step OK, but I wonder
whether it is needed in the gcc -bundle (ie, link) step as well?

Please try this patch and see if it makes it better. Also, please check
how file(1) describes refint.so now, and whether it changes after
re-making with the patch. I get
refint.so: Mach-O bundle ppc
on a regular PPC Mac, and I bet you need it to say "ppc64".

Index: Makefile.darwin
===================================================================
RCS file: /cvsroot/pgsql/src/makefiles/Makefile.darwin,v
retrieving revision 1.9
diff -c -r1.9 Makefile.darwin
*** Makefile.darwin 19 Jan 2006 21:19:12 -0000 1.9
--- Makefile.darwin 28 Nov 2006 02:41:21 -0000
***************
*** 13,18 ****
# Rule for building shared libs (currently used only for regression test
# shlib ... should go away, since this is not really enough knowledge)
%.so: %.o
! $(CC) -bundle -o $@ $< $(BE_DLLLIBS)

sqlmansect = 7
--- 13,18 ----
# Rule for building shared libs (currently used only for regression test
# shlib ... should go away, since this is not really enough knowledge)
%.so: %.o
! $(CC) $(CFLAGS) -bundle -o $@ $< $(BE_DLLLIBS)

sqlmansect = 7

regards, tom lane


From: Brian Wipf <brian(at)clickspace(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-ports(at)postgresql(dot)org, Brendan Duddridge <brendan(at)clickspace(dot)com>, Guido Neitzer <lists(at)event-s(dot)net>
Subject: Re: Compiling PostgreSQL 8.1.5 with 64-bit on a G5 SOLVED
Date: 2006-11-28 05:16:52
Message-ID: B7E9F6B0-5095-419B-8276-3EEBE2564565@clickspace.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-ports

Applied Makefile.darwin patch and recompiled.

Output from make check now:
======================
All 98 tests passed.
======================

> Also, please check
> how file(1) describes refint.so now, and whether it changes after
> re-making with the patch. I get
> refint.so: Mach-O bundle ppc

Before patch:
$ file ./contrib/spi/refint.so
./contrib/spi/refint.so: Mach-O bundle ppc

After patch:
$ file ./contrib/spi/refint.so
./contrib/spi/refint.so: Mach-O 64-bit bundle ppc64

Thanks for all of your help, Tom. It is greatly appreciated.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Brian Wipf <brian(at)clickspace(dot)com>
Cc: pgsql-ports(at)postgresql(dot)org, Brendan Duddridge <brendan(at)clickspace(dot)com>, Guido Neitzer <lists(at)event-s(dot)net>
Subject: Re: Compiling PostgreSQL 8.1.5 with 64-bit on a G5 SOLVED
Date: 2006-11-28 05:56:21
Message-ID: 29062.1164693381@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-ports

Brian Wipf <brian(at)clickspace(dot)com> writes:
> Applied Makefile.darwin patch and recompiled.

> Output from make check now:
> ======================
> All 98 tests passed.
> ======================

Cool. I've applied these updates to HEAD and 8.1 branch --- possibly
they'd work further back, but in the absence of testing I'm not going
to assume that 8.0 would work on Darwin64 without additional fixes.

regards, tom lane