Module 'openssl.rand' not found on MacOS 12.0.1 (m1)
mayocream opened this issue · 8 comments
Steps to reproduce:
Install kong via brew:
$ brew reinstall kong
==> Downloading https://download.konghq.com/gateway-src/kong-2.7.0.tar.gz
Already downloaded: /Users/kong/Library/Caches/Homebrew/downloads/d55cde9dab8db770b230f6f4d624137e27b93518f33e2b16078c1935c6bd3616--kong-2.7.0.tar.gz
==> Reinstalling kong/kong/kong
==> Patching
==> /opt/homebrew/opt/openresty@1.19.3.2/luarocks/bin/luarocks --tree=/opt/homebrew/Cellar/kong/2.7.0 make CR
🍺 /opt/homebrew/Cellar/kong/2.7.0: 1,147 files, 9.8MB, built in 2 minutes 15 seconds
==> Running `brew cleanup kong`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
$ kong version
2.7.0
Start kong:
$ kong start -c kong.conf --v --vv
2021/12/22 17:31:41 [verbose] Kong: 2.7.0
2021/12/22 17:31:41 [verbose] reading config file at kong.conf
2021/12/22 17:31:41 [verbose] prefix in use: /opt/homebrew/opt/kong
2021/12/22 17:31:41 [verbose] preparing nginx prefix directory at /opt/homebrew/opt/kong
2021/12/22 17:31:41 [verbose] SSL enabled on
2021/12/22 17:31:41 [verbose] proxy SSL certificate found at /opt/homebrew/opt/kong/ssl/kong-default.crt
2021/12/22 17:31:41 [verbose] proxy SSL certificate found at /opt/homebrew/opt/kong/ssl/kong-default-ecdsa.crt
2021/12/22 17:31:41 [verbose] SSL enabled on
2021/12/22 17:31:41 [verbose] admin SSL certificate found at /opt/homebrew/opt/kong/ssl/admin-kong-default.crt
2021/12/22 17:31:41 [verbose] admin SSL certificate found at /opt/homebrew/opt/kong/ssl/admin-kong-default-ecdsa.crt
Error:
/opt/homebrew/share/lua/5.1/pgmoon/init.lua:273: module 'openssl.rand' not found:
no field package.preload['openssl.rand']
no file './openssl/rand.lua'
no file './openssl/rand/init.lua'
no file '/opt/homebrew/share/lua/5.1/openssl/rand.lua'
no file '/opt/homebrew/share/lua/5.1/openssl/rand/init.lua'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/site/lualib/openssl/rand.ljbc'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/site/lualib/openssl/rand/init.ljbc'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/lualib/openssl/rand.ljbc'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/lualib/openssl/rand/init.ljbc'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/site/lualib/openssl/rand.lua'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/site/lualib/openssl/rand/init.lua'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/lualib/openssl/rand.lua'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/lualib/openssl/rand/init.lua'
no file './openssl/rand.lua'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/luajit/share/luajit-2.1.0-beta3/openssl/rand.lua'
no file '/usr/local/share/lua/5.1/openssl/rand.lua'
no file '/usr/local/share/lua/5.1/openssl/rand/init.lua'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/luajit/share/lua/5.1/openssl/rand.lua'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/luajit/share/lua/5.1/openssl/rand/init.lua'
no file '/opt/homebrew/lib/lua/5.1/openssl/rand.so'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/site/lualib/openssl/rand.so'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/lualib/openssl/rand.so'
no file './openssl/rand.so'
no file '/usr/local/lib/lua/5.1/openssl/rand.so'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/luajit/lib/lua/5.1/openssl/rand.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/opt/homebrew/lib/lua/5.1/openssl.so'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/site/lualib/openssl.so'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/lualib/openssl.so'
no file './openssl.so'
no file '/usr/local/lib/lua/5.1/openssl.so'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/luajit/lib/lua/5.1/openssl.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
/opt/homebrew/share/lua/5.1/pgmoon/init.lua:273: in function 'auth'
/opt/homebrew/share/lua/5.1/pgmoon/init.lua:213: in function 'connect'
.../share/lua/5.1/kong/db/strategies/postgres/connector.lua:216: in function 'connect'
.../share/lua/5.1/kong/db/strategies/postgres/connector.lua:516: in function 'query'
.../share/lua/5.1/kong/db/strategies/postgres/connector.lua:284: in function 'init'
/opt/homebrew/share/lua/5.1/kong/db/init.lua:141: in function 'init_connector'
/opt/homebrew/share/lua/5.1/kong/cmd/start.lua:33: in function 'cmd_exec'
/opt/homebrew/share/lua/5.1/kong/cmd/init.lua:88: in function </opt/homebrew/share/lua/5.1/kong/cmd/init.lua:88>
[C]: in function 'xpcall'
/opt/homebrew/share/lua/5.1/kong/cmd/init.lua:88: in function </opt/homebrew/share/lua/5.1/kong/cmd/init.lua:45>
/opt/homebrew/bin/kong:10: in function 'file_gen'
init_worker_by_lua:50: in function <init_worker_by_lua:48>
[C]: in function 'xpcall'
init_worker_by_lua:57: in function <init_worker_by_lua:55>
I think this could be something wrong during building the openresty?
ref: wolfiestyle/oauth_light#1
luaossl lib not installed.
But when I check the luarocks list
, no pakcages installed.
$ luarocks list
Rocks installed for Lua 5.1
---------------------------
I am not familiar with homebrew since I am a 10-year heavy windows user, but I am going to figure it out. 🤔
I need to re-compile OpenResty and Kong by using https://github.com/Kong/kong-build-tools directly to test if there is something wrong with the install script.
Install from source on M1:
OpenResty (https://github.com/Kong/kong-build-tools/tree/master/openresty-build-tools):
./kong-ngx-build -p /opt/kong/openresty \
--openresty 1.19.9.1
--openssl 1.1.1m
--luarocks 3.8.0
--pcre 8.45
-j 8
Great news to hear:
SUCCESS: LuaRocks 3.8.0 has been built successfully!
SUCCESS: Build finished in 179 seconds. Enjoy!
Export ENV:
export PATH=$PATH:/opt/kong/openresty/openresty/bin/:/opt/kong/openresty/luarocks/bin:/opt/kong/openresty/openresty/nginx/sbin
Install Kong:
git clone https://github.com/kong/kong
cd kong
luarocks make \
OPENSSL_DIR=/opt/kong/openresty/openssl \
CRYPTO_DIR=/opt/kong/openresty/openssl \
YAML_LIBDIR=/opt/homebrew/Cellar/libyaml/0.2.5/lib \
YAML_INCDIR=/opt/homebrew/Cellar/libyaml/0.2.5/include
Configure LUA_PATH:
source <(luarocks path)
Error:
~/repos/kong/bin/kong start -c kong.conf
Error: module 'openssl.rand' not found:No LuaRocks module found for openssl.rand
Okay I figured it out, it's luaossl lib. After luarocks install luaossl
, back to normal.
$ luarocks list --tree=/opt/homebrew/Cellar/kong/2.7.0
Rocks installed for Lua 5.1 in /opt/homebrew/Cellar/kong/2.7.0
--------------------------------------------------------------
ansicolors
1.0.2-3 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
binaryheap
0.4-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
date
2.2-2 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
etlua
1.3.0-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
inspect
3.1.2-0 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
kong
2.7.0-0 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
kong-lapis
1.8.3.1-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
loadkit
1.1.0-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lpeg
1.0.2-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua-cassandra
1.5.1-0 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua-ffi-zlib
0.5-0 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua-messagepack
0.5.2-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua-protobuf
0.3.3-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua-resty-acme
0.7.2-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua-resty-counter
0.2.1-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua-resty-healthcheck
1.4.2-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua-resty-http
0.16.1-0 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua-resty-ipmatcher
0.6.1-0 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua-resty-jit-uuid
0.0.7-2 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua-resty-lrucache
0.09-2 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua-resty-mlcache
2.5.0-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua-resty-openssl
0.8.2-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua-resty-session
3.8-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua-resty-timer
1.1.0-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua-resty-worker-events
1.0.0-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua_pack
2.0.0-0 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lua_system_constants
0.1.4-0 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
luafilesystem
1.8.0-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lualogging
1.6.0-2 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
luasec
1.0.2-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
luasocket
3.0rc1-2 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
luasyslog
2.0.1-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
luatz
0.4-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
luaxxhash
1.0.0-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
lyaml
6.2.7-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
multipart
0.5.9-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
penlight
1.11.0-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
pgmoon
1.13.0-1 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
version
1.0.1-2 (installed) - /opt/homebrew/Cellar/kong/2.7.0/lib/luarocks/rocks-5.1
ref: Kong/kong#8259
Same error occurs on the 2.8 release with PostgreSQL 14.
sudo kong start -c kong.conf --v --vv
2022/03/04 20:28:35 [verbose] Kong: 2.8.0
2022/03/04 20:28:35 [verbose] reading config file at kong.conf
2022/03/04 20:28:35 [verbose] prefix in use: /opt/homebrew/opt/kong
2022/03/04 20:28:35 [verbose] preparing nginx prefix directory at /opt/homebrew/opt/kong
2022/03/04 20:28:35 [verbose] SSL enabled on
2022/03/04 20:28:35 [verbose] proxy SSL certificate found at /opt/homebrew/opt/kong/ssl/kong-default.crt
2022/03/04 20:28:35 [verbose] proxy SSL certificate found at /opt/homebrew/opt/kong/ssl/kong-default-ecdsa.crt
2022/03/04 20:28:35 [verbose] SSL enabled on
2022/03/04 20:28:35 [verbose] admin SSL certificate found at /opt/homebrew/opt/kong/ssl/admin-kong-default.crt
2022/03/04 20:28:35 [verbose] admin SSL certificate found at /opt/homebrew/opt/kong/ssl/admin-kong-default-ecdsa.crt
2022/03/04 20:28:35 [warn] ulimit is currently set to "256". For better performance set it to at least "4096" using "ulimit -n"
Error:
/opt/homebrew/share/lua/5.1/pgmoon/init.lua:273: module 'openssl.rand' not found:
no field package.preload['openssl.rand']
no file './openssl/rand.lua'
no file './openssl/rand/init.lua'
no file '/opt/homebrew/share/lua/5.1/openssl/rand.lua'
no file '/opt/homebrew/share/lua/5.1/openssl/rand/init.lua'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/site/lualib/openssl/rand.ljbc'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/site/lualib/openssl/rand/init.ljbc'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/lualib/openssl/rand.ljbc'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/lualib/openssl/rand/init.ljbc'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/site/lualib/openssl/rand.lua'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/site/lualib/openssl/rand/init.lua'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/lualib/openssl/rand.lua'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/lualib/openssl/rand/init.lua'
no file './openssl/rand.lua'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/luajit/share/luajit-2.1.0-beta3/openssl/rand.lua'
no file '/usr/local/share/lua/5.1/openssl/rand.lua'
no file '/usr/local/share/lua/5.1/openssl/rand/init.lua'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/luajit/share/lua/5.1/openssl/rand.lua'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/luajit/share/lua/5.1/openssl/rand/init.lua'
no file '/opt/homebrew/lib/lua/5.1/openssl/rand.so'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/site/lualib/openssl/rand.so'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/lualib/openssl/rand.so'
no file './openssl/rand.so'
no file '/usr/local/lib/lua/5.1/openssl/rand.so'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/luajit/lib/lua/5.1/openssl/rand.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file '/opt/homebrew/lib/lua/5.1/openssl.so'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/site/lualib/openssl.so'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/lualib/openssl.so'
no file './openssl.so'
no file '/usr/local/lib/lua/5.1/openssl.so'
no file '/opt/homebrew/Cellar/openresty@1.19.3.2/1.19.3.2/openresty/luajit/lib/lua/5.1/openssl.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
/opt/homebrew/share/lua/5.1/pgmoon/init.lua:273: in function 'auth'
/opt/homebrew/share/lua/5.1/pgmoon/init.lua:213: in function 'connect'
.../share/lua/5.1/kong/db/strategies/postgres/connector.lua:216: in function 'connect'
.../share/lua/5.1/kong/db/strategies/postgres/connector.lua:516: in function 'query'
.../share/lua/5.1/kong/db/strategies/postgres/connector.lua:284: in function 'init'
/opt/homebrew/share/lua/5.1/kong/db/init.lua:141: in function 'init_connector'
/opt/homebrew/share/lua/5.1/kong/cmd/start.lua:33: in function 'cmd_exec'
/opt/homebrew/share/lua/5.1/kong/cmd/init.lua:89: in function </opt/homebrew/share/lua/5.1/kong/cmd/init.lua:89>
[C]: in function 'xpcall'
/opt/homebrew/share/lua/5.1/kong/cmd/init.lua:89: in function </opt/homebrew/share/lua/5.1/kong/cmd/init.lua:46>
/opt/homebrew/bin/kong:10: in function 'file_gen'
init_worker_by_lua:50: in function <init_worker_by_lua:48>
[C]: in function 'xpcall'
init_worker_by_lua:57: in function <init_worker_by_lua:55>
Running well with PostgreSQL 13, I'll close this issue.
The latest Kong master branch should be okay with PostgreSQL 14.