使用 luarocks 安装 lua-requests 期间出现错误

大家好,

我在使用命令行中输入 luarocks install lua-requests 以安装 lua-requests 模块时遇到了麻烦。虽然该模块的一些依赖关系可以顺利安装,但 luasec 却出现了问题。

一开始,我遇到了以下错误:

C:\Users\user>luarocks install luasec
Installing https://luarocks.org/luasec-0.9-1.src.rock

Error: Could not find header file for OPENSSL
  No file openssl/ssl.h in c:/external/include
  No file openssl/ssl.h in c:/mingw/include
  No file openssl/ssl.h in c:/windows/system32/include
You may have to install OPENSSL in your system and/or pass OPENSSL_DIR or OPENSSL_INCDIR to the luarocks command.
Example: luarocks install luasec OPENSSL_DIR=/usr/local

然而,我通过下载 OpenSSL 并在命令行中使用以下命令来解决了问题:

C:\Users\user>luarocks install luasec OPENSSL_DIR=" *openssl 目录的路径* "

接着出现了以下错误:

C:\Users\user>luarocks install luasec OPENSSL_DIR=" *openssl 目录的路径* "
Installing https://luarocks.org/luasec-0.9-1.src.rock

c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: cannot find -llibssl32MD
c:/mingw/bin/../lib/gcc/mingw32/9.2.0/../../../../mingw32/bin/ld.exe: cannot find -llibcrypto32MD
collect2.exe: error: ld returned 1 exit status

Error: Build error: Failed compiling module ssl.dll

经过一番搜索,我找到了以下问题 https://github.com/brunoos/luasec/issues/150

我试着将 dll 文件重命名,但还是没有成功。所以,现在我有点卡住了,不知道该怎么办……如果有人能提供任何提示或建议,我将不胜感激。

提前感谢,祝大家有一个愉快的一天 :)

点赞