如何解决'错误: 构建错误: 安装cjson.dll失败'

我想安装lua-cjson,但是我在运行luarocks install lua-cjson时遇到了这个错误

Error: Build error: Failed installing cjson.dll

我的cl版本是https://imgur.com/a/YiSVqTm

我的luarocks版本是:

luarocks 2.0.2
LuaRocks主命令行界面

我不知道如何解决这个问题

当我在VS 2019的Developer Command Prompt(2)中运行luarocks install lua-cjson时,以下是输出结果:

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools>luarocks install lua-cjson
Installing http://luarocks.org/repositories/rocks/lua-cjson-2.1.0.6-1.src.rock...
cl /MD /O2 -c -Folua_cjson.obj -IC:/Program Files (x86)/Lua/5.1/include lua_cjson.c -DDISABLE_INVALID_NUMBERS -DUSE_INTERNAL_ISINF
Microsoft (R) C/C++ Optimizing Compiler Version 19.22.27905 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

lua_cjson.c
lua_cjson.c(736): warning C4090: '函数': 不同的 'const' 限定符
lua_cjson.c(753): warning C4090: '函数': 不同的 'const' 限定符
lua_cjson.c(1280): warning C4090: '函数': 不同的 'const' 限定符
lua_cjson.c(1458): warning C4090: '函数': 不同的 'const' 限定符
lua_cjson.c(1470): warning C4090: '函数': 不同的 'const' 限定符
lua_cjson.c(1475): warning C4090: '函数': 不同的 'const' 限定符
lua_cjson.c(1492): warning C4090: '函数': 不同的 'const' 限定符
lua_cjson.c(1497): warning C4090: '函数': 不同的 'const' 限定符
lua_cjson.c(1502): warning C4090: '函数': 不同的 'const' 限定符
cl /MD /O2 -c -Fostrbuf.obj -IC:/Program Files (x86)/Lua/5.1/include strbuf.c -DDISABLE_INVALID_NUMBERS -DUSE_INTERNAL_ISINF
Microsoft (R) C/C++ Optimizing Compiler Version 19.22.27905 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

strbuf.c
cl /MD /O2 -c -Fofpconv.obj -IC:/Program Files (x86)/Lua/5.1/include fpconv.c -DDISABLE_INVALID_NUMBERS -DUSE_INTERNAL_ISINF
Microsoft (R) C/C++ Optimizing Compiler Version 19.22.27905 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

fpconv.c
link -dll -def:cjson.def -out:cjson.dll C:/Program Files (x86)/Lua/5.1/lib/lua5.1.lib lua_cjson.obj strbuf.obj fpconv.obj
Microsoft (R) 增量链接器版本 14.22.27905.0
版权所有 (C) Microsoft Corporation。保留所有权利。

   正在创建库 cjson.lib 和对象 cjson.exp

Error: Build error: Failed installing cjson.dll in C:\Program Files (x86)\Lua\5.1\rocks/lua-cjson/2.1.0.6-1/lib

我希望能够成功安装luarocks。

点赞