diff --git a/watchdog/justfile b/watchdog/justfile index 884ba3d..d3a6998 100644 --- a/watchdog/justfile +++ b/watchdog/justfile @@ -31,5 +31,5 @@ doctor: exit 1; \ } @lua -e "package.cpath = '.deps/lua/?.so;' .. package.cpath; require('lcurl'); print('doctor: lcurl ok')" - @lua -e "package.path = './?.lua;./?/init.lua;' .. package.path; local m=require('watchdog.machine_cartesi').new(); local inst,err=m:load('examples/canonical-app/out/canonical-machine-image'); if not inst then error('doctor: machine_cartesi cannot load devnet image: '..tostring(err)) end; print('doctor: machine_cartesi load ok')" + @LUA_CPATH_5_4="/usr/lib/lua/5.4/?.so;/usr/lib/lua/5.4/?/init.so;${LUA_CPATH_5_4:-;}" LUA_PATH_5_4="/usr/share/lua/5.4/?.lua;/usr/share/lua/5.4/?/init.so;${LUA_PATH_5_4:-;}" lua -e "package.path = './?.lua;./?/init.lua;' .. package.path; local m=require('watchdog.machine_cartesi').new(); local inst,err=m:load('examples/canonical-app/out/canonical-machine-image'); if not inst then error('doctor: machine_cartesi cannot load devnet image: '..tostring(err)) end; print('doctor: machine_cartesi load ok')" @echo "doctor: watchdog toolchain ok" diff --git a/watchdog/sequencer-watchdog b/watchdog/sequencer-watchdog index a92f099..744661f 100755 --- a/watchdog/sequencer-watchdog +++ b/watchdog/sequencer-watchdog @@ -11,6 +11,16 @@ fi lua_root="${CARTESI_WATCHDOG_LUA_ROOT:-/opt/watchdog/lua}" lua_bin="${CARTESI_WATCHDOG_LUA_BIN:-lua5.4}" +# Prefer deb-installed cartesi bindings under /usr/lib over stale /usr/local +# copies left by an older manual install (same ordering as the cartesi-machine +# wrapper shipped in machine-emulator_*.deb). +_cartesi_lua_cpath="/usr/lib/lua/5.4/?.so;/usr/lib/lua/5.4/?/init.so" +_cartesi_lua_path="/usr/share/lua/5.4/?.lua;/usr/share/lua/5.4/?/init.so" +export LUA_CPATH="${_cartesi_lua_cpath};${LUA_CPATH:-;}" +export LUA_PATH="${_cartesi_lua_path};${LUA_PATH:-;}" +export LUA_CPATH_5_4="${_cartesi_lua_cpath};${LUA_CPATH_5_4:-;}" +export LUA_PATH_5_4="${_cartesi_lua_path};${LUA_PATH_5_4:-;}" + cd "${lua_root}" if [[ "$#" -gt 0 && ( "$1" == "init" || "$1" == "tick" ) ]]; then