Thread: cross compiling postgresql 8.0.1 -- suggestion

cross compiling postgresql 8.0.1 -- suggestion

From
Vladimir Bychkovsky
Date:
I have cross compiled PostgreSQL 8.0.1 on i386-linux system for
i386-linux-ulibc. Compilation went through smoothly for the most part.

I had a minor issue with the timezone libary (src/timezone). During
installation of this library it tries to runs zic (seem
src/timezone/Makefile). However, since zic binary is included as a
(cross)compilation target (make all), zic ends up being cross
compiled. And, therefore, can not be used on the host system to
perform installation.

A simple solution to this problem is to remove target zic from 'all'
and add it to 'install' target. see attached patch.

Please let me know if there is a better way to solve this problem.

Vlad.

Attachment

Re: cross compiling postgresql 8.0.1 -- suggestion

From
Tom Lane
Date:
Vladimir Bychkovsky <vladimir.bychkovsky@gmail.com> writes:
> A simple solution to this problem is to remove target zic from 'all'
> and add it to 'install' target. see attached patch.

This is no solution at all, surely.  Why would you assume that make
install is going to be done by the target architecture, or that the
target even has a compiler (much less the same compiler that the build
tree has been configured for)?  Besides, the problem isn't *building*
zic, it is *running* it.

> Please let me know if there is a better way to solve this problem.

There is prior discussion of this problem in the archives, but AFAIR
we didn't yet find a solution that people liked.

            regards, tom lane

Re: cross compiling postgresql 8.0.1 -- suggestion

From
Vladimir Bychkovsky
Date:
On Sat, 05 Mar 2005 15:00:38 -0500, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> This is no solution at all, surely.  Why would you assume that make
> install is going to be done by the target architecture, or that the
> target even has a compiler (much less the same compiler that the build
> tree has been configured for)?  Besides, the problem isn't *building*
> zic, it is *running* it.

I apologize for being unclear. I assume that build system has a native
and a cross compiler. I don't assume anything about the target (In my
case target does not have a compiler). Installation happens on the
build system with DISTDIR pointing to an image root directory. Later
image is transfered to the target system.

> There is prior discussion of this problem in the archives, but AFAIR
> we didn't yet find a solution that people liked.

I'd appreciate it if you could send me a pointer to that discussion.
My search was fruitless.

Thanks,
Vlad.

Re: cross compiling postgresql 8.0.1 -- suggestion

From
Peter Eisentraut
Date:
Vladimir Bychkovsky wrote:
> > There is prior discussion of this problem in the archives, but
> > AFAIR we didn't yet find a solution that people liked.
>
> I'd appreciate it if you could send me a pointer to that discussion.
> My search was fruitless.

The usual approach to this situation (to the extent that cross
compilation is usual) is to set up two different compilers, CC for
cross compiling and CC_FOR_BUILD for native compilation.  Then the
makefiles have to be adjusted to use the right one as the case may be.

Earlier, an argument against that arrangement was made on the grounds
that we can't know whether CC and CC_FOR_BUILD are similar enough to
support the same set of flags, but I say that this is a reasonable
assumption to make.

It could be instructive to look at some other packages where some setup
like this was necessary.  A long time ago, Kaffe was one such instance
but I don't know what they do today.

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

Re: cross compiling postgresql 8.0.1 -- suggestion

From
Bruce Momjian
Date:
Tom Lane wrote:
> Vladimir Bychkovsky <vladimir.bychkovsky@gmail.com> writes:
> > A simple solution to this problem is to remove target zic from 'all'
> > and add it to 'install' target. see attached patch.
>
> This is no solution at all, surely.  Why would you assume that make
> install is going to be done by the target architecture, or that the
> target even has a compiler (much less the same compiler that the build
> tree has been configured for)?  Besides, the problem isn't *building*
> zic, it is *running* it.
>
> > Please let me know if there is a better way to solve this problem.
>
> There is prior discussion of this problem in the archives, but AFAIR
> we didn't yet find a solution that people liked.

Added to TODO:

    * Fix cross-compiling of time zone database via 'zic'

I am open to better wording.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073