Re: Fix for cross compilation

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fix for cross compilation
Date: 2005-05-30 18:04:52
Message-ID: 200505301804.j4UI4q127072@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


What about our threading configure test? That doesn't allow cross
compilation either, does it?

---------------------------------------------------------------------------

Peter Eisentraut wrote:
> In 8.0, PostgreSQL lost its previously postulated ability to be
> cross-compiled and it turns out some people actually used that, so
> here's an attempt to fix it.
>
> The problem is that the program zic in src/timezone/ is built and run
> during the build process, which doesn't work if it's compiled by a
> cross-compiler.
>
> The standard way to go about this in autotools land (references: gcc,
> binutils) is to introduce a second variable CC_FOR_BUILD that is set to
> a native compiler. There is no particular way to determine this
> variable; it's passed by the user or defaults to $CC. This variable is
> then used in place of CC to build programs that are compiled and run
> during the build.
>
> The problem is that native compilations cannot rely on things that the
> build system normally provides because the tests are run for the target
> system, not the build system. It can be assumed that the compilers are
> of the same kind, so using CFLAGS etc. is OK. But one cannot rely on
> libraries for example without entering a world of pain. Since most
> programs that need native compilation are usually some small conversion
> programs, this generally works out well anyway.
>
> Attached is a patch that implements that principle for zic. zic can no
> longer use libpgport, but the only thing it seems to use from there is
> strerror() and I like to think that we can get away with that.
>
> I haven't actually tried this out with a cross compilation since I'm not
> set up for it, so if someone has an environment available, please give
> this a try.
>
> Comments?
>
> --
> Peter Eisentraut
> http://developer.postgresql.org/~petere/

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-05-30 18:11:01 Re: Fix for cross compilation
Previous Message Peter Eisentraut 2005-05-30 17:41:35 Autoconf update?