This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LUA Cross Compiling



Hi all,

Me ne to the Lua and i want to port lua onto OMAP AM37 EVM .

And i want to call c functions from LUa.

How to run LUA programms on EVM..LEt me know if any things about LUA on OMAP to move fother..

  • Cross compile Lua like:

        $ make linux CC="path-to-arm-gcc" AR="path-to-arm-ar rcu" RANLIB="path-to-arm-ranlib"

    (Not sure why Lua authors were opposed to $(CROSS_COMPILE) in their makefile.)

    To call C functions from Lua, there are good references online:

    http://www.lua.org/pil/26.html

    or

    http://lua-users.org/wiki/SimpleLuaApiExample

    HTH 

  • Hi

    Thanks For u r support.

    I done following steps. Please assest me . How can i copy cross compiled Lua suite onto the tha target with our compiled image and target filesystem. 

    1. Compiled as per u r lines.

    2. Compilation does not give any error

    3. Next how to add these compiled Lus5.1.4(what am using) into the target. I mean porting.

    4. I have compiled kernel image and target file system

    Please Help us to make success.

    Thanks,

    -Gopi

  • Hi Below is the my comipilation command

    # sudo make linux CC=arm-arago-linux-gnueabi- AR=arm-arago-linux-gnueabi-ar RANLIB=arm-arago-linux-gnueabi-ranlib 

    Here cross tool chain env is already set.

    So could u plase help me to load it onto the Omap Target. and run lua scripts

    Thanks,

    -Gopi

  • I am unable to compile lua5.1.4 code on ubuntu 10.04 machine with crosscompiler commnd below:

    # sudo make linux CC=arm-arago-linux-gnueabi- AR=arm-arago-linux-gnueabi-ar RANLIB=arm-arago-linux-gnueabi-ranlib

     

    any one, Please help me to which lua source code to download , and how to compile that source code. and hot to load it onto OMap processor.

    Currently we are using OMap processors. It was urgent. Please guide me.

     

    Thanks,

    -Gopi

     

     

  • Here's a crazy thought ... maybe you should show people the compilation errors you are getting?  You might also want to think of an alternate plan, because copying executables to your target is fairly basic.  Maybe you need some consulting support.

  • I am compiling lua5.2.1 with folowing command. Then all .o files are created but it was struck up ar arm-arago-linux-gnueabi-ar rcu,

    Please tell me whats wrong wioth me.

     

    gpravada@ubuntu:~/Downloads/lua-5.2.1$ make linux CC=arm-arago-linux-gnueabi-gcc AR=arm-arago-linux-gnueabi-ar rcu RANLIB=arm-arago-linux-gnueabi-ranlib

    ...................

    ......................

    No emulation specific options

    arm-arago-linux-gnueabi-ar: supported targets: elf32-littlearm elf32-bigarm elf32-little elf32-big srec symbolsrec tekhex binary ihex

     make[2]: *** [liblua.a] Error 1

     make[2]: Leaving directory `/home/gpravada/Downloads/lua-5.2.1/src'

     make[1]: *** [linux] Error 2

    make[1]: Leaving directory `/home/gpravada/Downloads/lua-5.2.1/src' make: *** [linux] Error 2

    Please help me here

     

  • Try with quotes around your AR definition, i.e.: AR="arm-arago-linux-gnueabi-ar rcu" .  Otherwise, you will lose the "rcu".

  • Compilation report:

    gpravada@ubuntu:~/Downloads/lua-5.2.1$ make linux CC=arm-arago-linux-gnueabi-gcc AR="arm-arago-linux-gnueabi-ar rcu" RANLIB=arm-arago-linux-gnueabi-ranlib
    cd src && make linux
    make[1]: Entering directory `/home/gpravada/Downloads/lua-5.2.1/src'
    make all SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline -lncurses"
    make[2]: Entering directory `/home/gpravada/Downloads/lua-5.2.1/src'
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lapi.o lapi.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lcode.o lcode.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lctype.o lctype.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o ldebug.o ldebug.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o ldo.o ldo.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o ldump.o ldump.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lfunc.o lfunc.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lgc.o lgc.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o llex.o llex.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lmem.o lmem.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lobject.o lobject.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lopcodes.o lopcodes.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lparser.o lparser.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lstate.o lstate.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lstring.o lstring.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o ltable.o ltable.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o ltm.o ltm.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lundump.o lundump.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lvm.o lvm.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lzio.o lzio.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lauxlib.o lauxlib.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lbaselib.o lbaselib.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lbitlib.o lbitlib.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lcorolib.o lcorolib.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o ldblib.o ldblib.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o liolib.o liolib.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lmathlib.o lmathlib.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o loslib.o loslib.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lstrlib.o lstrlib.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o ltablib.o ltablib.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o loadlib.o loadlib.c
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o linit.o linit.c
    arm-arago-linux-gnueabi-ar rcu liblua.a lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o lmathlib.o loslib.o lstrlib.o ltablib.o loadlib.o linit.o
    arm-arago-linux-gnueabi-ranlib liblua.a
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lua.o lua.c
    arm-arago-linux-gnueabi-gcc -o lua   lua.o liblua.a -lm -Wl,-E -ldl -lreadline -lncurses
    arm-arago-linux-gnueabi-gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o luac.o luac.c
    arm-arago-linux-gnueabi-gcc -o luac   luac.o liblua.a -lm -Wl,-E -ldl -lreadline -lncurses
    make[2]: Leaving directory `/home/gpravada/Downloads/lua-5.2.1/src'
    make[1]: Leaving directory `/home/gpravada/Downloads/lua-5.2.1/src'

    Install Report:

    gpravada@ubuntu:~/Downloads/lua-5.2.1$ sudo make linux CC=arm-arago-linux-gnueabi-gcc AR="arm-arago-linux-gnueabi-ar rcu" RANLIB=arm-arago-linux-gnueabi-ranlib install
    cd src && make linux
    make[1]: Entering directory `/home/gpravada/Downloads/lua-5.2.1/src'
    make all SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline -lncurses"
    make[2]: Entering directory `/home/gpravada/Downloads/lua-5.2.1/src'
    make[2]: Nothing to be done for `all'.
    make[2]: Leaving directory `/home/gpravada/Downloads/lua-5.2.1/src'
    make[1]: Leaving directory `/home/gpravada/Downloads/lua-5.2.1/src'
    cd src && mkdir -p /usr/local/bin /usr/local/include /usr/local/lib /usr/local/man/man1 /usr/local/share/lua/5.2 /usr/local/lib/lua/5.2
    cd src && install -p -m 0755 lua luac /usr/local/bin
    cd src && install -p -m 0644 lua.h luaconf.h lualib.h lauxlib.h lua.hpp /usr/local/include
    cd src && install -p -m 0644 liblua.a /usr/local/lib
    cd doc && install -p -m 0644 lua.1 luac.1 /usr/local/man/man1

    Thanks FOr u r Help. above is my compilation an dinstallation ouput.

    Make sure me that this is corret or wrong. If it is wrong guide me if any other way is to do cross compiling lua.

    If compilation and instyallation output is OK then plaese tell me how to add this to our kernel image which is used to run on Omap Target alogn with lua.

    I want to load this cross compiled lua onto OMAP EVM so please guide me . I KNOW KERENL COMPILATION AND LOADNG ONTO THE TARGET(SUCCESSFULL).

    But i dont know how to add this to OMAP Target. Guide me please

    Thanks,

    -GOpi

  • Hello all,

    Ay one can help me please its delayed to my work i tried in above way

    .-Gopi

  • Hi,

    I cross compiled lua for arm architecture by doing folloing command. We use lua5.2.1 source code.

    1. Copied lua5.2.1 into path on ubuntu machine:  /home/gpravada/Downloads/lua-5.2.1,

    2. Went to  /home/gpravada/Downloads/lua-5.2.1,

    3. gpravada@ubuntu:~/Downloads/lua-5.2.1$ make linux  CC=arm-arago-linux-gnueabi-gcc AR="arm-arago-linux-gnueabi-ar rcu" RANLIB=arm-arago-linux-gnueabi-ranlib

    4. And  i copied liblua.a , lua and luac files into SD Card  file system  into /home/root folder.

    5. i inserted sd card which having immage and filesystem in it.

    6. After booting successfully . i went to the /home/root directory and executed following:

    7. root@dm37x-evm:/# cd home/root/

    8. root@dm37x-evm:~# cd lua-5.2.1/

    9. root@dm37x-evm:~/lua-5.2.1# ./lua

     

    I got belllow error:

    ./lua: error while loading shared libraries: libreadline.so.5: cannot open shared object file: No such file or directory

    Please tell me the solution to run lua engine on arm architeture . Currently i am using DM3737 Omap based EVM..

     

    Thanks & REgards,

    -Gopi

  • The error is telling you exactly what's wrong -- you don't have the readline library installed on the target.  It is optional, in src/luaconf.h comment out the lines that have "LUA_USE_READLINE" and in src/Makefile remove "-lreadline".

  • Hi,

    Thanks, I Got it. This is the small excerice  on OMAP Target.

     

    root@dm37x-evm:~# ./lua

    Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio

    > a = 10

    > b = 20

    > print(a+b)

     30

     > print(a+b)

    30

    > root@dm37x-evm:~# ./lua

    Lua 5.2.1  Copyright (C) 1994-2012 Lua.org, PUC-Rio

    > print(a+b) stdin:1: syntax error near char(8)

    > a=10

    > b=20

    > print(a/b)

    0.5

     > print(a+b)

    30

    >

     

    Now i will do some practices on Target. I will in touch with u if any probs.. Once agaon thanks....

    -Gop