Re: Build universal binary on Mac OS X 10.6? - Mailing list pgsql-general

From Israel Brewster
Subject Re: Build universal binary on Mac OS X 10.6?
Date
Msg-id 171FBB42-E122-43E3-ACCF-F068CB474D96@frontierflying.com
Whole thread Raw
In response to Re: Build universal binary on Mac OS X 10.6?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Build universal binary on Mac OS X 10.6?
Re: Build universal binary on Mac OS X 10.6?
List pgsql-general
On Dec 3, 2009, at 10:54 AM, Tom Lane wrote:

> Israel Brewster <israel@frontierflying.com> writes:
>> 1) From the second paragraph of that post:
>>> If you add something like "-arch i386 -arch ppc" to CFLAGS and build
>>> normally, you get real working multiarch binaries and libraries.
>> Which is exactly the problem that started this whole thread - on
>> 10.6,
>> you DON'T (or at least I don't) get "real working multiarch binaries
>> and libraries". In fact, you don't get anything - the compile fails.
>> Already we see that this post does not address my issue in any form,
>
> The reason it's failing is that you continue to ignore the important
> point: you need arch-specific header files.

So it WAS just me being dense. Figures :P Your explanation makes
perfect sense now, thanks. Although in my defense, everything that I
read up till now implied that the compile should work, it would just
be the generated binaries that wouldn't (how else do you interpret
that quite I included?). However with your explanation, it makes sense
why the compile would fail. Again, my apologies.

So what it boils down to, if I now understand you correctly, is that
(since you obviously can only have one set of headers per build) the
only way to make this work is pretty much exactly what I ended up
doing: build for each architecture separately (even  if on the same
machine) and then lipo the results together. I can live with that.

Then the reason this is necessary on Postgres, and not with other
software I have dealt with is that Postgres has 64 bit specific code,
while the others don't? I know my code doesn't. Or maybe I was just
doing 32 bit builds of the others, and so never ran into this sort of
thing. Hmm. Oh well, it works. My profuse thanks for the explanations
and bearing with me.

> I don't really recall whether I hit this in the experiment I did
> last year.  It's possible, maybe even likely, that the code was
> different then and happened not to have any compiler-visible
> inconsistencies when the header was wrong for the target arch.

Or perhaps the 10.6 compiler has better error checking than the 10.5?
That would explain why the build would succeed on 10.5 (but give
unusable binaries for other platforms) but die on 10.6.

> That doesn't change the fact that it'd fail at runtime whether
> the compiler could detect a problem or not.

Well, the libraries I created in the past from the 8.2 code work just
fine on both PPC 32 bit and Intel 64 bit. But then, that was 8.2. The
code probably changed between 8.2 and 8.4 though :-D. Thanks again!

>
> There's really no way around building the correct header files
> if you want a usable multiarch library.
>
>             regards, tom lane

-----------------------------------------------
Israel Brewster
Computer Support Technician II
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------




Attachment

pgsql-general by date:

Previous
From: mrciken
Date:
Subject: Daily migration on Postgresql
Next
From: Dave Huber
Date:
Subject: Re: code example for PQgetCopyData