[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: compiling LUA for uClinux
- From: Mike Pall <mikelu-0503@...>
- Date: Thu, 31 Mar 2005 17:10:47 +0200
Hi,
Julien MARBACH wrote:
> DC a écrit :
> >CC = arm-elf-gcc
> >AR = arm-elf-ar rcu
> >RANLIB = arm-elf-ranlib
>
> I'm working on lua-5.0.2 and the sources & makefiles are differently
> organised but I've changed CC, AR & RANLIB like you did (except that I
> build for coldfire so I use the m68k-elf toolchain). I also customised
> the CFLAGS and LAFLAGS to meet the needs of my taget platform. The
> compilation succeded and lua runs flawlessly on my project board.
I have one recommendation for those of you that regularly cross-compile:
Don't change the Makefiles by hand, rather change your path with
a wrapper and symlink the cross-compiler toolchain there.
Here's an example with the above toolchain names:
mkdir -p /usr/local/cross-arm-elf/bin
cd /usr/local/cross-arm-elf/bin
ln -s `which arm-elf-gcc` gcc
ln -s `which arm-elf-gcc` cc
ln -s `which arm-elf-ar` ar
ln -s `which arm-elf-ranlib` ranlib
... and so on for the whole toolchain (ld, strip, as, size, nm, ...)
Then create /usr/local/bin/aerun:
#!/bin/sh
PATH="/usr/local/cross-arm-elf/bin:$PATH"
export PATH
exec "$@"
Use it like 'aerun gcc -c ...'.
And for convenience create /usr/local/bin/aemake:
#!/bin/sh
PATH="/usr/local/cross-arm-elf/bin:$PATH"
export PATH
# Set extra environment variables here or pass them to make.
exec make "$@"
Now you only need to type 'aemake' whenever you have a reasonably
portable Makefile (such as Lua) and you get a cross-compiled binary.
Simple, huh?
[Yes, you still need to take care of the lua_Number stuff by hand.
But then, since there are only three reasonable variants ...
maybe this should be part of the standard luaconf.h, anyway?]
You can even do this with 'configure' by passing the --target,
--host and --build options (you may want to use a different --cache
file, too). Makes cross-compiling a real snap.
Bye,
Mike