Luajit2.0.4 Build错误

关于下载编译构建Luajit-2.0.4请移步这里,本文主要介绍一下在构建过程中遇到的奇葩问题。

从Windows上传Luajit-2.0.4.zip到Linux服务器,在构建的时候可能会遇到如下的编译错误:

In file included from lj_ffrecord.c:859:0:
lj_recdef.h:224:1: error: ‘recff_rawlen’ undeclared here (not in a function)
 recff_rawlen,
 ^
Makefile:645: recipe for target 'lj_ffrecord.o' failed

The root cause is in src/hostildvm_lib.c :

void emit_lib(BuildCtx *ctx)
{
    ......
    int ok = 1;
    if (!strcmp(buf, "#if LJ_52\n"))
      ok = LJ_52;
    else if (!strcmp(buf, "#if LJ_HASJIT\n"))
      ok = LJ_HASJIT;
    else if (!strcmp(buf, "#if LJ_HASFFI\n"))
      ok = LJ_HASFFI;
    ......
}

什么原因?

因为在Windows系统中,行尾结束符是"\r\n",所以!strcmp(buf,"#if LJ_52\n")就会返回false,!strcmp(buf, "#if LJ_HASJIT\n"将返回true,可以使用下面的命令转换整个文件夹:

# cd luajit-2.0.4
# find . -type f -print0 | xargs -0 dos2unix
OK!

你可能感兴趣的:(media,monaserver)