APISIX3.8.0在M1 mbp上的源码安装

206 阅读1分钟

在参考官方文档源码安装后(apisix.apache.org/zh/docs/api…

报错一:

Error: Failed installing dependency: luarocks.org/luasec-1.3.… - Could not find header file for OPENSSL No file openssl/ssl.h in /usr/local/openresty/openssl3/include You may have to install OPENSSL in your system and/or pass OPENSSL_DIR or OPENSSL_INCDIR to the luarocks command.

LuaRocks 无法找到 OpenSSL 的头文件(特别是 openssl/ssl.h)。luasec 是一个 Lua 模块,为 Lua 提供了 SSL/TLS 支持,依赖于 OpenSSL 库。

安装SSL:

brew install openssl

使用 brew --prefix openssl 命令来找到 OpenSSL 的安装路径

替换掉Makefile中的 ENV_OPENSSL_PREFIX 变量

原始:

ENV_OPENSSL_PREFIX     ?= /usr/local/openresty/openssl3x

修改后:

ENV_OPENSSL_PREFIX     ?= /opt/homebrew/opt/openssl@3

同时,需要注意在M1 mbp下,homebrew的路径不同

原始:

ENV_HOMEBREW_PREFIX    ?= /usr/local

修改后:

ENV_HOMEBREW_PREFIX    ?= /opt/homebrew

报错二:

在执行make deps后,出现报错:

RPC failed; curl 16 Error in the HTTP2 framing layer 

这个错误是一个 Git 克隆过程中的网络错误,通常与使用 HTTP/2 通信时出现的问题有关。这个问题可能是由网络配置、代理服务器、Git 客户端或服务器端的问题导致的。解决这个问题的方法如下:

禁用 HTTP/2

在 Git 命令中禁用 HTTP/2。你可以通过设置环境变量来强制 Git 使用 HTTP/1.1,而不是 HTTP/2:

export GIT_HTTP_VERSION=1.1

然后再次尝试 Git 操作。这个环境变量会影响当前终端会话中的所有 Git 命令。

报错三:

在执行apisix start 之后,访问报错:

init_worker_by_lua error: /xxx/Study/apisix-3.8.0/apisix/events.lua:68: module 'resty.events.compat' not found

需要修改配置config-default.yaml

lua-resty-events ---》lua-resty-worker-events

 (参考github.com/apache/apis…

  events:                             # Event distribution module configuration    
    module: lua-resty-worker-events          # Sets the name of the events module used.                                      
                                             # Supported module: lua-resty-worker-events and lua-resty-events