Re: [HACKERS] libpq.a in a universal binary

2006-12-16 Thread Ted Petrosky

take a look at this link

http://www.entropy.ch/blog/Software/2006/02/04/PostgreSQL-Universal- 
Binary-Build-Tips.html


does this help?


Ted




On Dec 14, 2006, at 2:37 PM, Shane Ambler wrote:


Dave Page wrote:

Shane Ambler wrote:



# make distclean
# CFLAGS=-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc - 
arch
i386 LDFLAGS=-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk - 
arch ppc

-arch i386 ./configure --with-openssl --prefix=/usr/local
# make all


After reading the Apple tech doc on this http:// 
developer.apple.com/technotes/tn2005/tn2137.html
I am wondering if we can add Mac universal binary support to the  
TODO list.


I haven't tested this yet but from what I gather adding the -- 
disable-dependency-tracking option to configure will allow the  
option of setting the CFLAGS and LDFLAGS with -arch ppc -arch  
i386 and getting the universal binary build.
The PostgreSQL build doesn't use the dependency tracking (at least  
not by default) so that's not an issue. pgAdmin does on the other  
hand, and the build will fail loudly if you don't disable tracking  
when you configure.


Another possibility (the better option) would be to add an option  
to build universal binaries - such as --host=mac_universal or  
would that be --host=darwin_universal - to automate the CFLAGS  
and LDFLAGS settings. Adding --with-isysroot= should be added to  
support non-standard and future SDK setups as well.
In pgAdmin we figure out what to build for based on the wxWidgets  
installation. In PostgreSQL's case, I would imagine we'd need to  
list the architectures to include in the build per the example  
above however it was automated (you might want ppc and ppc64 but  
not intel for example).


You could have a few options -
--host=darwin-ppc-i386
--host=darwin-ppc-ppc64-i386-amd64
etc.

maybe this could be better setup by splitting the string after  
darwin_ instead of having many different single hosts as such.


If host starts with darwin and len(host)6
arch_string() = explode(-,ltrim(host,7))
CFLAGS=CFLAGS+ -arch +arch_string(x)
else
build for current cpu

Maybe the --host= options with all the different possibilities  
won't be taken in, but I think a TODO should at least be added (not  
a high priority) to support building universal binaries even if  
only fixing the current failure point so that one make command can  
be used to get the end product even if it is a partly manual  
configure.

And this would apply to the client libs more than the server itself.

FWIW, from memory the PostgreSQL build fails at the point at which  
it links all the SUBSYS.o's.


Actually now that I checked it on a clean source tree (8.2.0) and  
not a make/make clean'd source tree it does appear to get to the  
SUBSYS.o's

(when I make clean then set CFLAGS etc it stopped at the beginning)

As I said I hadn't looked into it much and my first impression of  
trying this gave me misleading thoughts of what was needed.



--

Shane Ambler
[EMAIL PROTECTED]

Get Sheeky @ http://Sheeky.Biz



---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

   http://www.postgresql.org/about/donate


Re: [HACKERS] libpq.a in a universal binary

2006-12-15 Thread Dave Page

Ted Petrosky wrote:

take a look at this link

http://www.entropy.ch/blog/Software/2006/02/04/PostgreSQL-Universal-Binary-Build-Tips.html 


I've seen links to there before, but it always times out for me. As it 
is now :-(


I've got your followup email though, so I'll try a build as soon a I can 
 - thanks!


Regards, Dave.

---(end of broadcast)---
TIP 3: Have you checked our extensive FAQ?

  http://www.postgresql.org/docs/faq


Re: [HACKERS] libpq.a in a universal binary

2006-12-14 Thread Ted Petrosky
Thanks for the reply at last nights cocoahead meeting in NYC I  
asked and found a solution for libpq.a.


1. config and make on a ppc
2. config and make on intel

copy and rename the libpq.a from each system to a common directory  
and run 'lipo' on them:


lipo libpqppc.a libpqintel.a -output libpq.a

lipo will create the universal binary

man lipo:

LIPO 
(1) 
LIPO(1)


NAME
   lipo - create or operate on universal files

SYNOPSIS
   lipo  [-info]  [-detailed_info]  [-arch  arch_type   
input_file]  ...  [
   input_file] ...  [-arch_blank arch_type]  [-create]  [-thin   
arch_type]
   [-replace  arch_type  filename] ...  [-remove arch_type] ...   
[-extract
   arch_type] ...  [-extract_family arch_type] ...  [-output   
output_file]

   [-segalign arch_type value] ...

DESCRIPTION
   The  lipo command creates or operates on ``universal'' (multi- 
architec-
   ture) files.  It only ever produces one output file, and   
never  alters
   the  input  file.   The  operations that lipo performs are:  
listing the
   architecture types in a universal file;  creating  a  single   
universal
   file from one or more input files; thinning out a single  
universal file
   to one specified architecture type; and extracting,   
replacing,  and/or
   removing architectures types from the input file to create a  
single new

   universal output file.

On Dec 13, 2006, at 3:33 AM, Dave Page wrote:


Ted Petrosky wrote:
I am trying to create the libpq.a as a universal binary (both ppc  
and intel macs). Does anyone have any information on this process?


I use the following notes to build libpq and the bin/ tools to ship  
with pgAdmin. I know it is possible to build the entire server, as  
a Universal binary, but I could never make it work and haven't had  
time to spend on it. Comments welcome :-)


==
Building the entire server as a Universal binary doesn't seem to  
work at

present, so, we build the backend as an architecture specific build,
then create libpq and the tools as Universal binaries over the top.

# ./configure --with-openssl --prefix=/usr/local/
# make all; make install

# make distclean
# CFLAGS=-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch
i386 LDFLAGS=-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk - 
arch ppc

-arch i386 ./configure --with-openssl --prefix=/usr/local
# make all

Note - this step will fail, but is required to complete the build  
of the tools.


# cd src/interface/libpq
# make all; make install
# cd ../../bin
# make all; make install
==

Regards, Dave



---(end of broadcast)---
TIP 4: Have you searched our list archives?

  http://archives.postgresql.org


Re: [HACKERS] libpq.a in a universal binary

2006-12-14 Thread Dave Page

Shane Ambler wrote:



# make distclean
# CFLAGS=-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch
i386 LDFLAGS=-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc
-arch i386 ./configure --with-openssl --prefix=/usr/local
# make all


After reading the Apple tech doc on this 
http://developer.apple.com/technotes/tn2005/tn2137.html

I am wondering if we can add Mac universal binary support to the TODO list.

I haven't tested this yet but from what I gather adding the 
--disable-dependency-tracking option to configure will allow the option 
of setting the CFLAGS and LDFLAGS with -arch ppc -arch i386 and 
getting the universal binary build.


The PostgreSQL build doesn't use the dependency tracking (at least not 
by default) so that's not an issue. pgAdmin does on the other hand, and 
the build will fail loudly if you don't disable tracking when you configure.


Another possibility (the better option) would be to add an option to 
build universal binaries - such as --host=mac_universal or would that be 
--host=darwin_universal - to automate the CFLAGS and LDFLAGS settings. 
Adding --with-isysroot= should be added to support non-standard and 
future SDK setups as well.


In pgAdmin we figure out what to build for based on the wxWidgets 
installation. In PostgreSQL's case, I would imagine we'd need to list 
the architectures to include in the build per the example above however 
it was automated (you might want ppc and ppc64 but not intel for example).


FWIW, from memory the PostgreSQL build fails at the point at which it 
links all the SUBSYS.o's.


Regards, Dave



---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [HACKERS] libpq.a in a universal binary

2006-12-14 Thread Shane Ambler

Dave Page wrote:

Shane Ambler wrote:



# make distclean
# CFLAGS=-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch
i386 LDFLAGS=-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch 
ppc

-arch i386 ./configure --with-openssl --prefix=/usr/local
# make all


After reading the Apple tech doc on this 
http://developer.apple.com/technotes/tn2005/tn2137.html
I am wondering if we can add Mac universal binary support to the TODO 
list.


I haven't tested this yet but from what I gather adding the 
--disable-dependency-tracking option to configure will allow the 
option of setting the CFLAGS and LDFLAGS with -arch ppc -arch i386 
and getting the universal binary build.


The PostgreSQL build doesn't use the dependency tracking (at least not 
by default) so that's not an issue. pgAdmin does on the other hand, and 
the build will fail loudly if you don't disable tracking when you 
configure.


Another possibility (the better option) would be to add an option to 
build universal binaries - such as --host=mac_universal or would that 
be --host=darwin_universal - to automate the CFLAGS and LDFLAGS 
settings. Adding --with-isysroot= should be added to support 
non-standard and future SDK setups as well.


In pgAdmin we figure out what to build for based on the wxWidgets 
installation. In PostgreSQL's case, I would imagine we'd need to list 
the architectures to include in the build per the example above however 
it was automated (you might want ppc and ppc64 but not intel for example).


You could have a few options -
--host=darwin-ppc-i386
--host=darwin-ppc-ppc64-i386-amd64
etc.

maybe this could be better setup by splitting the string after darwin_ 
instead of having many different single hosts as such.


If host starts with darwin and len(host)6
arch_string() = explode(-,ltrim(host,7))
CFLAGS=CFLAGS+ -arch +arch_string(x)
else
build for current cpu

Maybe the --host= options with all the different possibilities won't be 
taken in, but I think a TODO should at least be added (not a high 
priority) to support building universal binaries even if only fixing the 
current failure point so that one make command can be used to get the 
end product even if it is a partly manual configure.

And this would apply to the client libs more than the server itself.

FWIW, from memory the PostgreSQL build fails at the point at which it 
links all the SUBSYS.o's.




Actually now that I checked it on a clean source tree (8.2.0) and not a 
make/make clean'd source tree it does appear to get to the SUBSYS.o's

(when I make clean then set CFLAGS etc it stopped at the beginning)

As I said I hadn't looked into it much and my first impression of trying 
this gave me misleading thoughts of what was needed.



--

Shane Ambler
[EMAIL PROTECTED]

Get Sheeky @ http://Sheeky.Biz

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


Re: [HACKERS] libpq.a in a universal binary

2006-12-13 Thread Dave Page

Ted Petrosky wrote:
I am trying to create the libpq.a as a universal binary (both ppc and 
intel macs). Does anyone have any information on this process?


I use the following notes to build libpq and the bin/ tools to ship with 
pgAdmin. I know it is possible to build the entire server, as a 
Universal binary, but I could never make it work and haven't had time to 
spend on it. Comments welcome :-)


==
Building the entire server as a Universal binary doesn't seem to work at
present, so, we build the backend as an architecture specific build,
then create libpq and the tools as Universal binaries over the top.

# ./configure --with-openssl --prefix=/usr/local/
# make all; make install

# make distclean
# CFLAGS=-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch
i386 LDFLAGS=-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc
-arch i386 ./configure --with-openssl --prefix=/usr/local
# make all

Note - this step will fail, but is required to complete the build of the 
tools.


# cd src/interface/libpq
# make all; make install
# cd ../../bin
# make all; make install
==

Regards, Dave

---(end of broadcast)---
TIP 9: In versions below 8.0, the planner will ignore your desire to
  choose an index scan if your joining column's datatypes do not
  match


Re: [HACKERS] libpq.a in a universal binary

2006-12-13 Thread Dave Page

Ted Petrosky wrote:
Thanks for the reply at last nights cocoahead meeting in NYC I asked 
and found a solution for libpq.a.


1. config and make on a ppc
2. config and make on intel

copy and rename the libpq.a from each system to a common directory and 
run 'lipo' on them:


lipo libpqppc.a libpqintel.a -output libpq.a

lipo will create the universal binary


Yeah - I looked at that option, but as I only have a G4 Powerbook at 
present I'd need to cross compile the intel version, and I couldn't get 
that to work at all!


The method I gave, while a little hacky, does work well and is pretty 
straightforward. It's also probably the only way that would be practical 
to build and install the whole tarball in a vaguely normal way (assuming 
there weren't other issues preventing the build completing).


Regards, Dave

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly