7

使用最近的 luaJITlua_open返回null。常规 lua 库不会发生这种情况。

lua_State *L = lua_open();
std::cout << L << std::endl;

输出:0x0

我怎样才能让 luaJIT 工作?

SSCCE:

#include <iostream>
#include <luajit-2.0/lua.hpp>
//linked library: libluajit-5.1.a

int main(int argc, const char * argv[])
{
    lua_State *L = luaL_newstate(); // lua_open();
    std::cout << L << std::endl; // 0x0
}

附加信息:使用makemake install. 使用编译器:

$ cc --version
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix

(使用 luajit 命令行应用程序luajit工作正常,测试脚本执行时没有错误。)

4

1 回答 1

14

显然,x64 Mac 应用程序需要特殊处理;见http://luajit.org/install.html

如果您在 OSX 上构建直接或间接链接到 LuaJIT 的 64 位应用程序,则需要将主可执行文件与以下标志链接:

-pagezero_size 10000 -image_base 100000000
于 2014-01-02T02:08:44.120 回答