arm linux lua移植

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013420428/article/details/82872674

lua:
lua home

1.下载lua源码
lua下载
lua-5.3.4.tar.gz

2.解压:
tar xvf lua-5.3.4.tar.gz

3.修改makefile and luaconf.h
$修改 lua-5.3.4/Makefile
#INSTALL_TOP= /usr/local
INSTALL_TOP= $(shell pwd)/out #修改安装目录(当前目录/out)

$修改 lua-5.3.4/src/Makefile
TOOLSCHAIN= $(shell pwd)/…/…/…/prebuilts/toolschain/usr/bin/arm-linux- #添加此行指向编译连所在目录/arm-linx-
#CC= gcc -std=gnu99
改为
CC= $(TOOLSCHAIN)gcc -std=gnu99

#LIBS= -lm $(SYSLIBS) $(MYLIBS)
改为
LIBS= -lm $(SYSLIBS) -static

#AR= ar rcu
改为
AR= $(TOOLSCHAIN)ar rcu

#RANLIB= ranlib
改为
RANLIB= $(TOOLSCHAIN)ranlib

注意有linux标志
linux:
$(MAKE) KaTeX parse error: Expected 'EOF', got '#' at position 62: …,-E -ldl" 改为 #̲(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"

$修改 src/luaconf.h
//#define LUA_USE_READLINE /* needs some extra libraries */ 注释掉此行

4.编译
cd lua-5.3.4/
$make linux #for linux
$make install #安装到 lua-5.3.4/out
$tree lua-5.3.4/out

├── bin
│   ├── lua   #拷贝到arm开发板即可运行 ; $lua  test.lua
│   └── luac
├── include
│   ├── lauxlib.h
│   ├── luaconf.h
│   ├── lua.h
│   ├── lua.hpp
│   └── lualib.h
├── lib
│   ├── liblua.a
│   └── lua
│       └── 5.3
├── man
│   └── man1
│       ├── lua.1
│       └── luac.1
└── share
    └── lua
        └── 5.3

lua-5.3.4
├── doc
│   ├── contents.html
│   ├── index.css
│   ├── logo.gif
│   ├── lua.1
│   ├── luac.1
│   ├── lua.css
│   ├── manual.css
│   ├── manual.html
│   ├── osi-certified-72x60.png
│   └── readme.html
├── Makefile
├── README
└── src
    ├── lapi.c
    ├── lapi.h
    ├── lauxlib.c
    ├── lauxlib.h
    ├── lbaselib.c
    ├── lbitlib.c
    ├── lcode.c
    ├── lcode.h
    ├── lcorolib.c
    ├── lctype.c
    ├── lctype.h
    ├── ldblib.c
    ├── ldebug.c
    ├── ldebug.h
    ├── ldo.c
    ├── ldo.h
    ├── ldump.c
    ├── lfunc.c
    ├── lfunc.h
    ├── lgc.c
    ├── lgc.h
    ├── linit.c
    ├── liolib.c
    ├── llex.c
    ├── llex.h
    ├── llimits.h
    ├── lmathlib.c
    ├── lmem.c
    ├── lmem.h
    ├── loadlib.c
    ├── lobject.c
    ├── lobject.h
    ├── lopcodes.c
    ├── lopcodes.h
    ├── loslib.c
    ├── lparser.c
    ├── lparser.h
    ├── lprefix.h
    ├── lstate.c
    ├── lstate.h
    ├── lstring.c
    ├── lstring.h
    ├── lstrlib.c
    ├── ltable.c
    ├── ltable.h
    ├── ltablib.c
    ├── ltm.c
    ├── ltm.h
    ├── lua.c
    ├── luac.c
    ├── luaconf.h
    ├── lua.h
    ├── lua.hpp
    ├── lualib.h
    ├── lundump.c
    ├── lundump.h
    ├── lutf8lib.c
    ├── lvm.c
    ├── lvm.h
    ├── lzio.c
    ├── lzio.h
    └── Makefile

2 directories, 74 files

猜你喜欢

转载自blog.csdn.net/u013420428/article/details/82872674