[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [patch] help for cross compiling lua
- From: John E Hein <jhein@...>
- Date: Wed, 5 Mar 2008 12:26:09 -0700
Dirk Feytons wrote at 14:42 +0100 on Mar 5, 2008:
> On Wed, Mar 5, 2008 at 5:05 AM, John Hein <email@example.com> wrote:
> > A classic way to cross compile tools is override
> > things like CC and RANLIB and AR. When trying to build
> > lua for an arm-based platform, I employed this technique.
> > Unfortunately the src/Makefile has 'AR= ar rcu'. So when one
> > overrides AR (with the cross platform version, arm-ar), building
> > liblua.a fails because the 'rcu' is missing.
> > I'd like to submit the following patch to fix that issue.
> > If there is a better place to submit this, please let me know.
> Another classic way is the use of a CROSS_COMPILE variable.
> The Makefile then looks something like this:
> By just setting CROSS_COMPILE to e.g. "mips-linux-uclibc-" you can do
> cross compilation while not setting the variable uses your host
> compiler (provided your toolchains are appropriately named).
I like the idea from a simplicity standpoint (just set one variable
and be done with it).
Unfortunately, it's not very standard _as far as I know_. For
instance, autoconf doesn't generate support cross compiling that way.
It just defines CC, etc., which you can override. However... it does
support --host=<prefix> which is basically the same as your
CROSS_COMPILE suggestion... except lua doesn't have a 'configure'
stage before calling make - i.e., there's no "lua way" to configure
the makefile before running make (again, as far as I know).
autoconf is not a standard, you say? Well it's a bit of a de facto
standard, unfortunately. But I agree. Basing Makefile support for
cross compiles on what autoconf does is only one factor one might
If lua adds something like the prefix above, it won't bother me. I'll
just add CROSS_COMPILE to my cross build environment in addition to
AR, CC, RANLIB, STRIP, etc. What's one more variable?
If lua does go that route, as far as naming the prefix, I don't know
of anything that uses that exact name, CROSS_COMPILE. Indeed I
don't know of any software off the top of my head which uses
the prefix method. But there's lots of software out there.
Does anyone have any good examples of software packages that use
such a prefix method?
> In any case, adding ARFLAGS is certainly useful.
Indeed. Applying the ARFLAGS patch is a good fix regardless, I think.