如何在 Mac 上安装 luac.cross?

How do I install luac.cross on a Mac?

NodeMCU documentation 状态

NodeMCU firmware build now automatically generates a luac.cross image as standard in the firmware root directory; this can be used to compile and to syntax-check Lua source on the Development machine for execution under NodeMCU Lua on the ESP8266.

我从哪里得到 luac.cross 以及如何安装它?

我是否在 Mac 上从源代码构建 NodeMCU 固件,luac.cross 是否作为该过程的一部分创建?我一直在使用云服务来创建自定义固件。 luac.cross 是否可以通过云构建获得?

直接 lua 代码使 MakerFocus NodeMCU 板不堪重负,导致运行时出现内存不足问题。希望编译后的代码将减少 RAM 需求。

Where do I get luac.cross from and how do I install it?

您在引用的文档中给出了答案。特别是这个

NodeMCU firmware build now automatically generates a luac.cross image...

因此,如果您在您的平台上手动 构建 NodeMCU,构建过程也会为您的平台创建一个 lua.cross。这就是您无法下载或安装 lua.cross 的原因 - 它必须适合您的平台,即 OS et.al.

下一个合乎逻辑的问题是:如何在 macOS 上手动构建 NodeMCU?

我不知道这个问题的答案,因为我在 macOS 上使用 Docker image(来自你的)构建。 运行 Docker 构建在固件根目录中创建一个 luac.cross。但是,由于 macOS 只是主机 OS for Docker 在此设置中 luac.cross is for Linux 而不是比原生的 macOS。要使用它,您将再次启动 Docker 容器并在其中 运行 bash 以获得 shell 来执行 Lua 交叉编译:docker run --rm -ti -vpwd:/opt/nodemcu-firmware marcelstoer/nodemcu-build bash.

Straight lua code has overwhelmed the MakerFocus NodeMCU board resulting runtime panic with out of memory issue. Hoping compiled code will reduce RAM needs.

我不想让你失望,但如果我不得不打赌,我预计节省的钱不会多到足以产生预期的结果。由于您已经开始阅读文档,我想向您指出相关的常见问题解答:How is NodeMCU Lua different to standard Lua? and Techniques for Reducing RAM

也许使用 LFS 将是您的救星。

如果您想在任何平台上使用此工具 - 您可以使用我的 API 来构建它:

curl -d @yourscript.lua -X POST https://nodemcu-luacross-run-64l7ehzjta-uc.a.run.app/compile > output.luac