Open cyb233 opened 2 years ago
解决了吗哥
解决了吗哥
没有,没人回复就不用了
Solution here in another issue ( https://github.com/Tencent/LuaHelper/issues/8 ). You need to set the packagePath to include the directory.
For added clarity...
For those experiencing issues with luasocket, here's what worked for me to get the debugger working on Windows 11:
Download the Lua (5.4) Interpreter an put it somewhere to use it, in my case /C/Users/MarioRicalde/OneDrive/Documents/Lua/
Install MSYS2 https://www.msys2.org/#installation
In the MSYS terminal and install the toolchain:
pacman -S mingw-w64-x86_64-toolchain
Download latest release (src) or clone from https://github.com/lunarmodules/luasocket/releases.
Using Msys2 mingw64 and navigate to directory, adjust the paths to match your configuration (hint, replace C/Users/MarioRicalde/OneDrive/Documents with your path ):
x86_64-w64-mingw32-gcc -O2 -c -o src/luasocket.o -I/C/Users/MarioRicalde/OneDrive/Documents/Lua/include/lua/5.4 src/luasocket.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -I/c/windows/system32/include
x86_64-w64-mingw32-gcc -O2 -c -o src/timeout.o -I/C/Users/MarioRicalde/OneDrive/Documents/Lua/include/lua/5.4 src/timeout.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -I/c/windows/system32/include
x86_64-w64-mingw32-gcc -O2 -c -o src/buffer.o -I/C/Users/MarioRicalde/OneDrive/Documents/Lua/include/lua/5.4 src/buffer.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -I/c/windows/system32/include
x86_64-w64-mingw32-gcc -O2 -c -o src/io.o -I/C/Users/MarioRicalde/OneDrive/Documents/Lua/include/lua/5.4 src/io.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -I/c/windows/system32/include
x86_64-w64-mingw32-gcc -O2 -c -o src/auxiliar.o -I/C/Users/MarioRicalde/OneDrive/Documents/Lua/include/lua/5.4 src/auxiliar.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -I/c/windows/system32/include
x86_64-w64-mingw32-gcc -O2 -c -o src/options.o -I/C/Users/MarioRicalde/OneDrive/Documents/Lua/include/lua/5.4 src/options.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -I/c/windows/system32/include
x86_64-w64-mingw32-gcc -O2 -c -o src/inet.o -I/C/Users/MarioRicalde/OneDrive/Documents/Lua/include/lua/5.4 src/inet.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -I/c/windows/system32/include
x86_64-w64-mingw32-gcc -O2 -c -o src/except.o -I/C/Users/MarioRicalde/OneDrive/Documents/Lua/include/lua/5.4 src/except.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -I/c/windows/system32/include
x86_64-w64-mingw32-gcc -O2 -c -o src/select.o -I/C/Users/MarioRicalde/OneDrive/Documents/Lua/include/lua/5.4 src/select.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -I/c/windows/system32/include
x86_64-w64-mingw32-gcc -O2 -c -o src/tcp.o -I/C/Users/MarioRicalde/OneDrive/Documents/Lua/include/lua/5.4 src/tcp.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -I/c/windows/system32/include
x86_64-w64-mingw32-gcc -O2 -c -o src/udp.o -I/C/Users/MarioRicalde/OneDrive/Documents/Lua/include/lua/5.4 src/udp.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -I/c/windows/system32/include
x86_64-w64-mingw32-gcc -O2 -c -o src/compat.o -I/C/Users/MarioRicalde/OneDrive/Documents/Lua/include/lua/5.4 src/compat.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -I/c/windows/system32/include
x86_64-w64-mingw32-gcc -O2 -c -o src/wsocket.o -I/C/Users/MarioRicalde/OneDrive/Documents/Lua/include/lua/5.4 src/wsocket.c -DLUASOCKET_DEBUG -DWINVER=0x0501 -I/c/windows/system32/include
mkdir socket
x86_64-w64-mingw32-gcc -shared -o socket/core.dll src/luasocket.o src/timeout.o src/buffer.o src/io.o src/auxiliar.o src/options.o src/inet.o src/except.o src/select.o src/tcp.o src/udp.o src/compat.o src/wsocket.o -lws2_32 /C/Users/MarioRicalde/OneDrive/Documents/Lua/lua54.dll -lm
With that you should have the core.dll file:
MarioRicalde@MR-WS MINGW64 /c/Users/MarioRicalde/OneDrive/Documents/Lua/other/luasocket-3.1.0
$ ls socket
core.dll
Go to VSCode, Ctrl + P, write:
LuaHelper: Open Debug Folder
That will open explorer, go into luasocket > win > x64 > lua5.4 > socket
Rename core.dll to core.bak.dll and add your newly compiled core.dll
Go back into VSCode and test.