安装 wgethttp://www.lua.org/ftp/lua-5.2.1.tar.gz

tar -zvxf lua-5.2.1.tar.gz

make linux

错误:gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX -c -o lua.o lua.clua.c:67:31: error: readline/readline.h: No such file or directorylua.c:68:30: error: readline/history.h: No such file or directorylua.c: In function ‘pushline’:lua.c:271: warning: implicit declaration of function ‘readline’lua.c:271: warning: assignment makes pointer from integer without a castlua.c: In function ‘loadline’:lua.c:301: warning: implicit declaration of function ‘add_history’make[2]: *** [lua.o] Error 1make[2]: Leaving directory `/root/lua-5.2.0/src'make[1]: *** [linux] Error 2make[1]: Leaving directory `/root/lua-5.2.0/src'make: *** [linux] Error 2

解决:yum install -y readline-devel ncurses-devel

#include

#include"lua.h"

#include"lauxlib.h"

#include"lualib.h"

#include "luaconf.h"

int main(){ lua_State *L; L = luaL_newstate(); luaL_openlibs(L); luaL_dofile(L,"test.lua"); lua_close(L);}

运行: gcc -o test tes.c -I/usr/local/lua/include/ -L/usr/local/lua/lib/ /usr/local/lua/lib/liblua.a -llua -lm -ldl

错误1:没有引用liblua.a

/tmp/cckH9huG.o: In function `main':tes.c:(.text+0x12): undefined reference to `luaL_newstate'tes.c:(.text+0x20): undefined reference to `luaL_openlibs'tes.c:(.text+0x33): undefined reference to `luaL_loadfile'tes.c:(.text+0x5a): undefined reference to `lua_pcall'tes.c:(.text+0x65): undefined reference to `lua_close'collect2: ld returned 1 exit status

错误2:没有引用数学库 -llua -lm

/usr/local/lua/lib/liblua.a(lvm.o): In function `Arith':lvm.c:(.text+0xbdb): undefined reference to `pow'/usr/local/lua/lib/liblua.a(lvm.o): In function `luaV_execute':lvm.c:(.text+0x20b7): undefined reference to `pow'/usr/local/lua/lib/liblua.a(lcode.o): In function `codearith':lcode.c:(.text+0x11ec): undefined reference to `pow'/usr/local/lua/lib/liblua.a(lmathlib.o): In function `math_tan':lmathlib.c:(.text+0x1ee): undefined reference to `tan'/usr/local/lua/lib/liblua.a(lmathlib.o): In function `math_tanh':lmathlib.c:(.text+0x22e): undefined reference to `tanh'/usr/local/lua/lib/liblua.a(lmathlib.o): In function `math_sqrt':lmathlib.c:(.text+0x27d): undefined reference to `sqrt'/usr/local/lua/lib/liblua.a(lmathlib.o): In function `math_sin':lmathlib.c:(.text+0x2be): undefined reference to `sin'/usr/local/lua/lib/liblua.a(lmathlib.o): In function `math_sinh':lmathlib.c:(.text+0x2fe): undefined reference to `sinh'/usr/local/lua/lib/liblua.a(lmathlib.o): In function `math_pow':lmathlib.c:(.text+0x488): undefined reference to `pow'/usr/local/lua/lib/liblua.a(lmathlib.o): In function `math_log':lmathlib.c:(.text+0x52e): undefined reference to `log'/usr/local/lua/lib/liblua.a(lmathlib.o): In function `math_log10':lmathlib.c:(.text+0x56e): undefined reference to `log10'/usr/local/lua/lib/liblua.a(lmathlib.o): In function `math_fmod':lmathlib.c:(.text+0x678): undefined reference to `fmod'/usr/local/lua/lib/liblua.a(lmathlib.o): In function `math_exp':lmathlib.c:(.text+0x6be): undefined reference to `exp'/usr/local/lua/lib/liblua.a(lmathlib.o): In function `math_cos':lmathlib.c:(.text+0x6fe): undefined reference to `cos'/usr/local/lua/lib/liblua.a(lmathlib.o): In function `math_cosh':lmathlib.c:(.text+0x73e): undefined reference to `cosh'/usr/local/lua/lib/liblua.a(lmathlib.o): In function `math_atan':lmathlib.c:(.text+0x77e): undefined reference to `atan'/usr/local/lua/lib/liblua.a(lmathlib.o): In function `math_atan2':lmathlib.c:(.text+0x7d8): undefined reference to `atan2'/usr/local/lua/lib/liblua.a(lmathlib.o): In function `math_asin':lmathlib.c:(.text+0x81e): undefined reference to `asin'/usr/local/lua/lib/liblua.a(lmathlib.o): In function `math_acos':lmathlib.c:(.text+0x85e): undefined reference to `acos'/usr/local/lua/lib/liblua.a(loadlib.o): In function `ll_loadfunc':loadlib.c:(.text+0x947): undefined reference to `dlsym'loadlib.c:(.text+0x954): undefined reference to `dlerror'loadlib.c:(.text+0xa2c): undefined reference to `dlopen'loadlib.c:(.text+0xa41): undefined reference to `dlerror'/usr/local/lua/lib/liblua.a(loadlib.o): In function `gctm':loadlib.c:(.text+0x104e): undefined reference to `dlclose'collect2: ld returned 1 exit status

错误3:没有用-ldl 没找着这个是干什么用的,看起来像device

/usr/local/lua/lib/liblua.a(loadlib.o): In function `ll_loadfunc':loadlib.c:(.text+0x947): undefined reference to `dlsym'loadlib.c:(.text+0x954): undefined reference to `dlerror'loadlib.c:(.text+0xa2c): undefined reference to `dlopen'loadlib.c:(.text+0xa41): undefined reference to `dlerror'/usr/local/lua/lib/liblua.a(loadlib.o): In function `gctm':loadlib.c:(.text+0x104e): undefined reference to `dlclose'collect2: ld returned 1 exit status

linux编译lua,Linux CentOS 编译LUA。。搞半天终于对了= =相关推荐

  1. Linux CentOS 编译LUA。。搞半天终于对了= =

    2019独角兽企业重金招聘Python工程师标准>>> 安装 wget http://www.lua.org/ftp/lua-5.2.1.tar.gz tar -zvxf lua-5 ...

  2. linux centos 编译luabind-0.9.1 动态库 静态库

    luabind下载 luabind-0.9.1 下载地址 :http://download.csdn.net/download/yzf279533105/10109861 编译步骤 一. 需先编译好l ...

  3. linux centos 编译Lua5.2.0 静态库 动态库

    一 lua下载 lua5.2.0下载地址 :http://download.csdn.net/download/yzf279533105/10109818 二 笔者这里linux环境为centos6. ...

  4. 使用rust编译linux,在 Ubuntu 上为 CentOS 编译 Rust 程序,

    在 Ubuntu 上为 CentOS 编译 Rust 程序, 现在 CentOS 8 还没出来,最新的是 CentOS 7.6,上面搭载的 glibc 版本是 2.17,都已经是 2012 年那时候的 ...

  5. linux lua socket编程,CentOs 安装lua,luasocket

    一.centos安装Lua 3)个人在这里选择使用5.1版本的 *下载 wget http://www.lua.org/ftp/lua-5.1.5.tar.gz --2013-10-14 16:23: ...

  6. linux系统kate,linux kate 终端不能用,版本是centos,就是不能在kate下方直接编译源程序,没有shell界面,设置也不行...

    linux kate 版本是centos,在正常情况下,没有终端. 需要安装Konsole就可以了.kate本身是个文本编辑器,通过插件调用Konsole才能当终端使的所以先要保证你的机器中有Kons ...

  7. lua windows下编译

    从Lua5.1开始官方给出的文件只有源代码和makefile文件了,官网给出的bulid方式也是在linux平台,如果只是想找个库使用下可以到这里来下载:http://joedf.ahkscript. ...

  8. linux内核基础和配置编译原理

    2020-8-8 星期六 北京 闷热天 总结linux内核基础和配置编译原理,分两部分总结.仅作为技术积累,方便日后查阅.参考了网上的一些笔记. 第一部分:内核基础 2.14.1.内核和发行版的区别 ...

  9. 一键自动发布ipa(更新svn,拷贝资源,压缩资源,加密图片资源,加密数据文件,加密lua脚本,编译代码,ipa签名,上传ftp)...

    一键自动发布ipa(更新svn,拷贝资源,压缩资源,加密图片资源,加密数据文件,加密lua脚本,编译代码,ipa签名,上传ftp) 程序员的生活要一切自动化,更要幸福^_^. 转载请注明出处http: ...

最新文章

  1. 《数学之美》第20章 不要把鸡蛋都放到一个篮子里--谈谈最大熵模型
  2. Javascript在客户端导出multi-sheet excel
  3. 模拟一:STEMA 考试选择题模拟练习试卷(初级组)及答案 + 自我解题笔记
  4. php请编写一个函数来将一个_为什么开发人员讨厌PHP
  5. JSOUP 教程—— Java爬虫,简易入门,秒杀htmlparser
  6. 三个彩灯循环点亮程序_近百组彩灯点亮江畔,义渡灯会正式亮灯啦
  7. Redis系列教程(五):Redis哨兵、复制、集群的设计原理,以及区别
  8. FISCO BCOS(四)——— 在Ubantu上安装python3.8
  9. java图片的缩放_Java的图片自动缩放
  10. excel线性拟合的斜率_Excel 应用SLOPE函数计算线性回归线的斜率
  11. PostgreSQL usermanual翻译暂停20200420
  12. 微信公众号基础篇(个人订阅号)
  13. 一般纳税人税额计算_一般纳税人税率公式是什么样的,税额是怎么计算的-企业纳税|华律办事直通车...
  14. c程序-RGB转十六进制
  15. 银行家算法实现(操作系统实验)
  16. iphone 如何给cydia添加中文源和威锋源
  17. 一起来认识数组公式(最基础)
  18. Windows debugging tools
  19. WIN11如何一键返回桌面
  20. oc-分类(catgory)的概念及使用

热门文章

  1. Oracle 要慌了!华为终于开源了自家的 Huawei JDK——毕昇 JDK!
  2. IDEA 上位?不!Eclipse Theia 1.0 发布!
  3. “面试不败计划”:集合、日期、异常、序列化、jvm、其他
  4. java开发微信公众平台(一)-- 服务器配置
  5. 一天搞定CSS:字体font--04
  6. oracle 11g libclntsh.so.10.1,cx_Oracle找不到libclntsh.so.10.1错误
  7. (Java集合框架)List接口
  8. 浅谈迷宫搜索类的双向bfs问题(例题解析)
  9. AngularJS自定义指令详解(有分页插件代码)
  10. python 获取html js 变量_Python爬虫与反反爬虫实践