LuaHelper
LuaHelper copied to clipboard
Debugger didn't work on macOS 12.6 - reGetSock fail
The debugging mode didn't work on my Apple M1 MacBook Air M1 with macOS 12.6 My Visual Studio Code version is 1.71.2 and the Lua plugin is on version 0.2.19
I get the following error output
lua -e "package.path = '/Users/mkb/.vscode/extensions/yinfei.luahelper-0.2.19/debugger/?.lua;'.. package.path; package.cpath = '/Users/mkb/.vscode/extensions/yinfei.luahelper-0.2.19/debugger/luasocket/mac/lua5.4/?.so;'.. package.cpath; require('LuaPanda').start('127.0.0.1',8818);" "/Users/mkb/Desktop/marc/marc.lua"
~/Desktop/marc lua -e "package.path = '/Users/mkb/.vscode/extensions/yinfei.luahelper-0.2.19/debugger/?.lua;'.. package.path; package.cpath = '/Users/mkb/.vscode/extensions/yinfei.luahelper-0.2.19/debugger/luasocket/mac/lua5.4/?.so;'.. package.cpath; require('LuaPanda').start('127.0.0.1',8818);" "/Users/mkb/Desktop/marc/marc.lua"
[LuaPanda] [Error] reGetSock fail
[LuaPanda] [Error] Start debugger but get Socket fail , please install luasocket!
luasocket is installed on my system
Lua 5.4.4 Copyright (C) 1994-2022 Lua.org, PUC-Rio
> socket = require("socket")
> print(socket._VERSION)
LuaSocket 3.0.0
My launch.json file
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "LuaHelper-Debug",
"request": "launch",
"name": "LuaHelper-DebugFile",
"description": "通用模式,通常调试项目请选择此模式",
"luaPath": "",
"packagePath": [],
"luaFileExtension": "",
"connectionPort": 8818,
"stopOnEntry": true,
"useCHook": true
}
]
}
The same debug configuration on my Intel Mac mini with macOS 12.6 works fine.
I got the same error. It's like the core.so file is incompatible with Apple M1.
Error log:
[LuaPanda] [Error] reGetSock fail
[LuaPanda] [Error] Start debugger but get Socket fail , please install luasocket!
lua: error loading module 'socket.core' from file '/Users/t4erg/.vscode/extensions/yinfei.luahelper-0.2.19/debugger/luasocket/mac/lua5.4/socket/core.so':
dlopen(/Users/t4erg/.vscode/extensions/yinfei.luahelper-0.2.19/debugger/luasocket/mac/lua5.4/socket/core.so, 0x0006): tried: '/Users/t4erg/.vscode/extensions/yinfei.luahelper-0.2.19/debugger/luasocket/mac/lua5.4/socket/core.so' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))
Lua info:
Lua 5.4.4 Copyright (C) 1994-2022 Lua.org, PUC-Rio
> socket = require("socket")
> print(socket._VERSION)
LuaSocket 3.0.0
Solution here in another issue ( https://github.com/Tencent/LuaHelper/issues/8 ). You need to set the packagePath to include the directory.