lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello Hisham,

I checked my compilation again.

Previously I said using luarocks to cross compile rocks(packages) is not convenient or problematic.
Because determining what macro variables is difficult and moreover even it can easily conflicted with different rocks.

But with my tonight's test, I found I am wrong!

I tried to cross compile luafilesystem and lpeg with luarocks.
Firstly, for luafilesystem :
I set /home/gc/rootfs_orbit/etc/luarocks/config-5.1.lua as shown below.

  1 rocks_trees = {
  2    home..[[/.luarocks]],
  3    [[/home/gc/rootfs_orbit]]
  4 }
  5 
  6 variables = {
  7    CC = [[/opt/arm-2007q1/bin/arm-none-linux-gnueabi-gcc]],
  8    LD = [[/opt/arm-2007q1/bin/arm-none-linux-gnueabi-gcc]],
  9    CFLAGS = [[-v -L/opt/arm-2007q1/lib -I/opt/arm-2007q1/include -O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -pedantic]],
 10 }

and cross compiled with

luarocks install luafilesystem-1.6.2-1.rockspec

And the result was correct cross compiled arm binary!
Previously I wasn't.
The difference stems from the CFLAGS settings difference between I used previously and now.
Previously I didn't specify "-O2 -Wall -fPIC -W -Waggregate-return -Wcast-align -Wmissing-prototypes -Wnested-externs -Wshadow -Wwrite-strings -pedantic"

This time I looked the Makefile(config) of luafilesystem and found correct build options and set it to luafilesystem. And I tried to compile only luafilesystem with luarocks.

And after I got the correct lfs.so I tried for lpeg.so. And also I was able to get the correct arm binary.

For lpeg I looked into it's makefile. And found correct build options and put it into the file, /home/gc/rootfs_orbit/etc/luarocks/config-5.1.lua.
It was :

  1 rocks_trees = {
  2    home..[[/.luarocks]],
  3    [[/home/gc/rootfs_orbit]]
  4 }
  5 
  6 variables = {
  7    CC = [[/opt/arm-2007q1/bin/arm-none-linux-gnueabi-gcc]],
  8    LD = [[/opt/arm-2007q1/bin/arm-none-linux-gnueabi-gcc]],
  9    CFLAGS = [[-v -L/opt/arm-2007q1/lib -I/opt/arm-2007q1/include -shared -fPIC -O2]],
 10 }

This time also the CFLAGS are searched and placed from the lpeg makefile.


Previously, I thought /home/gc/rootfs_orbit/etc/luarocks/config-5.1.lua has to be used for all rocks in a shared-manner. With this manner I didn't try to search correct build options for each library. But this is wrong.

Crosscompile has to be done for particular rocks for each. One must write /home/gc/rootfs_orbit/etc/luarocks/config-5.1.lua for only one rock. It cannot be shared for any two different rocks, which has c or cpp source file to be compiled by toolchain.

/home/gc/rootfs_orbit/etc/luarocks/config-5.1.lua can be shared pure lua rocks but not c or cpp rocks.

This is tonight's result of my experiment.

Maybe Hisham, this is what you wanted me to achieve to night.

Thank you very much.

I am sorry for the wrong record of mine in the past few days.
I hope people don't get confused by my posting.

Thank you Hisham and people on this list.

Good night!
Journeyer

----------------------------------------
Journeyer J. Joh
o o s a p r o g r a m m e r
a t
g m a i l  d o t  c o m
----------------------------------------


2013/10/12 Journeyer J. Joh <oosaprogrammer@gmail.com>
Hi Hisham,

OK, I will check those on Monday night at my office.

See you on Tuesday.

Good Weekend!
Journeyer
----------------------------------------
Journeyer J. Joh
o o s a p r o g r a m m e r
a t
g m a i l  d o t  c o m
----------------------------------------


2013/10/12 Hisham <h@hisham.hm>
On 11 October 2013 11:22, Journeyer J. Joh <oosaprogrammer@gmail.com> wrote:
> Hi Hisham
>
> I am sorry I didn't specify about exact problem of loading of lpeg.so and
> lfs.so.
>
> lfs.so achieved by luarocks failed to loaded with the message below.
>
>> "undefined reference to stat64"
>
> So I checked with '-H' and '-v' option and found that cross linker invoked
> was different than the one invoked by cross compiling with Makefile (the
> latter). When luarocks is used bin/ld of my toolchain is used. When luarocks
> is not used bin/collect2 is used directly. But I am not sure if this is the
> critical difference. And I remember options for assembler was also different
> between those two.
>
> I can say that using the latter method, using Makefile has a competitive
> benefit.
> Makefiles of lpeg and luafilesystem specify the make macro variables that
> need to specify on theirselves. So I was easily test with specifying those
> variables to my cross toolchain easily. But when it comes to luarocks it's
> uncertain what make macro I need to specify. Do I need to specify assembler?
> linker? or Do I need to specify special CFLAGS ? -L path? -I path?... is not
> given. I can check lpeg's Makefile to decide these. But what if one variable
> conflicts between two different rocks? For example lpeg' Makefile specifies
> CFLAG with something and somthing but luafilesystem specifies with different
> CFLAG like otherthing and otherthing...
>
> I am sorry I didn't try to find out what caused this differences and what
> difference caused the former failed and the latter succeeded. I stopped
> investigation right after I found the latter worked. And I think the latter
> is not that 'enough method'. the former and the latter together worked in
> my case. So I'd better say that both ways are needed.
>
> I am sorry for unclear statement. I am home now and all my work is at my
> office.

When you get back at work, could you check precisely what changes you
made to the makefiles? It could be useful for improving the rockspec
files.

Thank you!

-- Hisham