lanthora / candy

A reliable, low-latency, and anti-censorship virtual private network
https://canets.org
MIT License
393 stars 47 forks source link

替换 Poco 库后在 Windows 环境无法正常运行 #268

Closed lanthora closed 6 months ago

lanthora commented 6 months ago

最初发现由 CI 构建的 Windows Portable 版本报错:

[critical] websocket connect failed: SSL Exception

在 MSYS2 中编译,并把 wintun.dll 放到可执行文件所在目录

root@DESKTOP-320CSMD MINGW64 /home/root/candy/build/src/main
# ls
candy.exe  cmake_install.cmake  CMakeFiles  wintun.dll

可以正常执行

root@DESKTOP-320CSMD MINGW64 /home/root/candy/build/src/main
# ./candy.exe -m client -w wss://zone.icandy.one/demo
[2024-03-11 16:19:44.679] [info] client address: 172.16.99.105/16
[2024-03-11 16:19:47.711] [info] service exit: normal

复制所有 dll 到可执行文件所在目录

root@DESKTOP-320CSMD MINGW64 /home/root/candy/build/src/main
# ../../../scripts/search-deps.sh candy.exe .
Copied /mingw64/bin/libconfig++-11.dll to ./
Copied /mingw64/bin/libstdc++-6.dll to ./
Copied /mingw64/bin/libgcc_s_seh-1.dll to ./
Copied /mingw64/bin/libwinpthread-1.dll to ./
Copied /mingw64/bin/libfmt.dll to ./
Copied /mingw64/bin/libspdlog.dll to ./
Copied /mingw64/bin/liburiparser-1.dll to ./
Copied /mingw64/bin/libPocoNet-100.dll to ./
Copied /mingw64/bin/libPocoFoundation-100.dll to ./
Copied /mingw64/bin/zlib1.dll to ./
Copied /mingw64/bin/libpcre2-8-0.dll to ./
Copied /mingw64/bin/libPocoNetSSL-100.dll to ./
Copied /mingw64/bin/libssl-3-x64.dll to ./
Copied /mingw64/bin/libcrypto-3-x64.dll to ./
Copied /mingw64/bin/libPocoCrypto-100.dll to ./
Copied /mingw64/bin/libPocoUtil-100.dll to ./
Copied /mingw64/bin/libPocoJSON-100.dll to ./
Copied /mingw64/bin/libPocoXML-100.dll to ./
Copied /mingw64/bin/libexpat-1.dll to ./

此时报错: SSL Exception

root@DESKTOP-320CSMD MINGW64 /home/root/candy/build/src/main
# ./candy.exe -m client -w wss://zone.icandy.one/demo
[2024-03-11 16:20:06.647] [critical] websocket connect failed: SSL Exception
[2024-03-11 16:20:06.648] [critical] websocket client connect failed
[2024-03-11 16:20:06.649] [critical] start websocket client thread failed
[2024-03-11 16:20:06.650] [info] service exit: internal exception

移除目录中的 libcrypto-3-x64.dll

root@DESKTOP-320CSMD MINGW64 /home/root/candy/build/src/main
# rm libcrypto-3-x64.dll

恢复正常

root@DESKTOP-320CSMD MINGW64 /home/root/candy/build/src/main
# ./candy.exe -m client -w wss://zone.icandy.one/demo
[2024-03-11 16:20:38.828] [info] client address: 172.16.99.105/16
[2024-03-11 16:20:41.736] [info] service exit: normal
lanthora commented 6 months ago

打印更多日志后出现了新的内容

websocket connect failed: SSL Exception: error:80000002:system library::No such file or directory

看来跟不同环境下证书的路径有关系