|
On 9 October 2013 09:01, Journeyer J. Joh <oosaprogrammer@gmail.com> wrote:>> 23 CC = "",
> Hello,
>
> I am now cross-compiling orbit and its dependent rocks.
>
> Cross compiling those rocks usually can be accomplished by 2 teps.
> 1. Changing the install prefix
> 2. Specifying cross compile toolchain
>
> I did step 1. via luarocks configure script as shown below.
>
> ./configure --prefix=/home/gc/rootfs_luarocks
> --rocks-tree=/home/gc/rootfs_orbit
> --with-lua-include=/home/gc/rootfs_orbit/include
> --with-lua-lib=/home/gc/rootfs_orbit/lib
>
> And now I need to find a way to specify cross tool chain into the build
> system.
> When I didn't use luarocks I was able to do this directly on the Makefils or
> config files for each rocks. But Now I use luarocks. When it comes to
> luarocks, most build variables seem to be applied via rockspec file.
>
> So I tried this way below for luasocket rock.
>
>> 20 build = {
>> 21 type = "make",
>> 22 build_variables = {
>> 24 CFLAGS = "$(CFLAGS) -DLUASOCKET_DEBUG -I$(LUA_INCDIR)",I have successfully cross-compiled rocks to ARM with LuaRocks. Instead
>> 25 LDFLAGS = "$(LIBFLAG) -O -fpic",
>> 26 LD = "$(CC)"
>> 27 },
>
>
> Please note I specified CC and LD there.
> But this doesn't produce arm library.
>
> Question #1. How can I specify cross toolchain (macro variables like CC, LD,
> ..)?
> Question #2. Is there any know method to cross compile lua rocks?
of editing the rockspecs themselves, edit your luarocks/config.lua
file and add something like the following:
variables = {
CC = [[/opt/arm-2007q1/bin/arm-none-linux-gnueabi-gcc]],
LD = [[/opt/arm-2007q1/bin/arm-none-linux-gnueabi-gcc]],
CFLAGS = [[-L/opt/arm-2007q1/lib -I/opt/arm-2007q1/include]],
}
Just type luarocks with no arguments to see the "System configuration
file" and "User configuration file" paths in your system shown at the
bottom; you can use either.
You may also need to set the external_deps_dirs so your cross compiler
can find any ARM libraries your rocks need, and rocks_trees to specify
where your ARM rocks should be installed.
external_deps_dirs = { [[/opt/cross/build/usr]] } -- tree where your
ARM libs are
rocks_tree = { [[/opt/cross/build/usr]] } -- tree where your ARM rocks should go
Please let us know in the luarocks mailing list if any rocks don't
cross-compile correctly.
Also, if you want to pack .rock files you may also want to edit
site_config.lua to put the proper value in LUAROCKS_UNAME_M.
Yes, you should cross compile rocks running a native Lua and then you
> I think I need to use lua JIT compiler natively installed in the system when
> I cross compile lua rocks. But After I cross compiled all rocks, I need to
> cross compile lua JIT compiler also.
>
> Question #3. Am I wrong with this thought?
should cross-compile Lua (or LuaJIT) to your system.
-- Hisham