我是Lua编程的新手,所以很抱歉在这里提出一些基本要求。我找到了一个看起来像Lua软件包,它将提供项目所需的功能,但是当我尝试使用Luarocks安装其依赖软件包之一时,似乎出现了编译器错误:
$ luarocks install xml
Installing https://luarocks.org/xml-1.1.3-1.src.rock
env MACOSX_DEPLOYMENT_TARGET=10.8 gcc -O2 -fPIC -I/usr/local/opt/lua/include/lua5.3 -c src/Parser.cpp -o src/Parser.o -Iinclude -Isrc/bind -Isrc/vendor
warning: include path for stdlibc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++
standard library instead [-Wstdlibcxx-not-found]
In file included from src/Parser.cpp:1:
In file included from include/xml/Parser.h:33:
src/bind/dub/dub.h:62:10: fatal error: 'string' file not found
#include <string> // std::string for Exception
^~~~~~~~
1 warning and 1 error generated.
Error: Build error: Failed compiling object src/Parser.o
gcc已安装在系统上(macOS 10.14.6),但不确定问题是否出在我的版本不正确或缺少其他内容:
$ gcc -v
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
再次,对于Lua来说是全新的,我以为与Luarocks一起下载的“摇滚”是独立的,随时可用的软件包。因此,不确定编译器在这里扮演什么角色。仅仅是我还需要安装或升级吗?我能够安装其他依赖项,所以Luarocks本身看起来还可以。顺便说一句:
$ lua -v
Lua 5.3.5 Copyright (C) 1994-2018 Lua.org, PUC-Rio
$ luarocks --version
/usr/local/bin/luarocks 3.2.1
LuaRocks main command-line interface
谢谢。