Luajit2.0.4-Build错误

2021/07 31 14:07

从Windows上传Luajit到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
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