MayaPosch / NymphCast

Audio and video casting system with support for custom applications.
http://nyanko.ws/nymphcast.php
BSD 3-Clause "New" or "Revised" License
2.41k stars 81 forks source link

NymphServer Windows Binary #59

Closed mapl closed 2 years ago

mapl commented 2 years ago

I successfully compiled the NymphServer Windows 10 binary under MSYS2 and was happy seeing it working.

Now I wanted to transfer the binary to another Windows 10 machine, but DLL Hell hit me hard, and I could not get it working.

Are they any plans to provide a simple portable or installer Windows build without prior compiling?

Thanks for this very nice project!

MayaPosch commented 2 years ago

Hello and thank you for using NymphCast :)

A Windows binary distribution & installer are currently in the works. We're currently trying to see whether we can create a static build of the NymphCast Server to bring the dependencies down and with it the file size including DLLs.

I have just pushed to the repository under src/server/dlls a shell script (dll_depends.sh) using which the required DLLs that are not found in a stock Windows environment can be copied automatically.

To use it, go to the folder src/server/dlls and run ./dlls_depends.sh, then sit back and wait a bit. Afterwards you should have around 100 MB worth of DLLs in the folder.

When you copy the src/server/apps folder along with the nymphcast_*_config.ini files in src/server/ and the compiled binary (nymphcast_server.exe) into this folder with the copied DLLs, you should have a distributable version of NCS.

I have run it like this in a standard Windows command window (cmd.exe), and it does work, although it insists for me on becoming a background process, so it has to be then terminated via e.g. the Task Manager. Whether that's a feature or not depends on your view :)

The binary release installer should make this tedious process a lot more automated. Please stay tuned while we sort out the remaining issues here.

mapl commented 2 years ago

Thank you for your immediate efforts :) Unfortunately, it's still not working :(

I've followed your steps, but when executing the nymphcast_server.exe binary, it immediately exists without any error message.

However, it's working great in the MSYS2 env!

I've tried to trace any possible ddl clash or something with procmon, but couldn't find any.

Note: I've compiled it from master about two days.

mapl commented 2 years ago

It works! I overlooked your background process part! When I launched it with no parameters, it dropped back to the cmd prompt without any console output, so I thought it died.

Executing "nymphcast_server.exe -c nymphcast_config.ini" did the trick! > Still no console output, but the background process started, and I was able to cast to it :)

MayaPosch commented 2 years ago

Glad to hear it :)

Yeah, the lack of console output is a bit weird, I'm not sure whether that's due to the way stdout with MSYS2 works differing from a standard Windows terminal or so.

We're currently testing a version of NC Server that is built with MSVC (2017 and up). This seems to behave more correctly when launched from the command line. It also saves a lot of the MSYS2-specific support DLLs, so this might be what we'll be using for the binary Windows distribution and installer.

MayaPosch commented 2 years ago

Closing this issue as there is no active problem/question.

As noted, Windows binaries and installers will be released with the v0.1 RC1 release.

mapl commented 2 years ago

I successfully compiled the server using Setup-NMake-vcpkg.bat script!

Had some trouble setting it up properly, but in the end it worked.

As seen on the screenshot, the console output is working as well, even colorized (in Windows Terminal).

image

MayaPosch commented 2 years ago

That's great to see, @mapl :)

What were the difficulties that you encountered with setting it up? Installing & configuring vcpkg, or? We still have to update the documentation for compilation with MSVC, so it's encouraging to see that it is this straightforward :)

mapl commented 2 years ago

The vcpkg installation itself was straightforward, besides, I had to set manually set the %VCPKG_ROOT% env. variable.

I manually "gitpulled" both LibNymphCast & NymphRPC and compiled it because I had issues to pass the env vars %NYMPHRPC_ROOT% and %LIBNYMPHCAST_ROOT% to Setup-NMake-vcpkg.bat.

So I set the env vars prior running the server - Setup-NMake-vcpkg.bat

set LIBNYMPHCAST_ROOT=C:\Libraries\LibNymphCast
set NYMPHRPC_ROOT=C:\Libraries\NymphRPC

I know it's a MSVC 2017 Build Project and I installed MSVC 2022 which caused additional versioning issues.

C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v150\Microsoft.Cpp.WindowsSDK.targets(46,5): error MSB8036: The Windows SDK version 10.0.16299.0 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution".
1>Done building project "angelscript.vcxproj" -- FAILED.

Fixing this error was quite easy and remarkably descriptive for MS!

For now, I had no luck compiling a static build...


SDL2_image.lib(IMG_svg.c.obj) : error LNK2005: nsvgCreateRasterizer already defined in nanosvg_impl.obj SDL2_image.lib(IMG_svg.c.obj) : error LNK2005: nsvgDelete already defined in nanosvg_impl.obj SDL2_image.lib(IMG_svg.c.obj) : error LNK2005: nsvgDeleteRasterizer already defined in nanosvg_impl.obj SDL2_image.lib(IMG_svg.c.obj) : error LNK2005: nsvgParse already defined in nanosvg_impl.obj SDL2_image.lib(IMG_svg.c.obj) : error LNK2005: nsvgRasterize already defined in nanosvg_impl.obj PocoFoundationmt.lib(RegularExpression.cpp.obj) : error LNK2019: unresolved external symbol pcre_compile referenced in function "public: cdecl Poco::RegularExpression::RegularExpression(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,int,bool)" (??0RegularExpression@Poco@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H_N@Z) PocoFoundationmt.lib(RegularExpression.cpp.obj) : error LNK2019: unresolved external symbol pcre_exec referenced in function "public: int cdecl Poco::RegularExpression::match(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,unsigned int64,struct Poco::RegularExpression::Match &,int)const " (?match@RegularExpression@Poco@@QEBAHAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_KAEAUMatch@12@H@Z) PocoFoundationmt.lib(RegularExpression.cpp.obj) : error LNK2019: unresolved external symbol pcre_study referenced in function "public: cdecl Poco::RegularExpression::RegularExpression(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,int,bool)" (??0RegularExpression@Poco@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H_N@Z) . . . .

libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol imp_CertGetNameStringA referenced in function Curl_verify_certificate libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol imp_CryptQueryObject referenced in function add_certs_data_to_store libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol imp_CertCreateCertificateChainEngine referenced in function Curl_verify_certificate libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol imp_CertFreeCertificateChainEngine referenced in function Curl_verify_certificate libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol imp_CertGetCertificateChain referenced in function Curl_verify_certificate libcurl.lib(schannel_verify.c.obj) : error LNK2019: unresolved external symbol imp_CertFreeCertificateChain referenced in function Curl_verify_certificate bin\x86_64-w64-msvc\Release\NymphcastServer.exe : fatal error LNK1120: 653 unresolved externals NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\HostX64\x64\cl.EXE"' : return code '0x2' Stop.

mapl commented 2 years ago

I tried to compile server with the latest commit but receiving several errors now

cl -nologo -c -std:c++17 -EHsc -Zi -MP -MD -O2 -DVERSION="\"v0.1-rc1.20220206\"" -DUSE_OPENGL_14 -DCONFIG_AVFILTER -DWIN32 -D_WIN32 -DNOMINMAX -USTRICT_ANSI__ -DPOCO_WIN32_UTF8=1 -I . -I ffplay -I angelscript/angelscript/include -I angelscript/add_on -I angelscript/json -I angelscript/regexp -I gui/app -I gui/app/animations -I gui/app/components -I gui/app/guis -I gui/app/scrapers -I gui/app/views -I gui/app/gamelist -I gui/core -I gui/core/animations -I gui/core/components -I gui/core/guis -I gui/core/math -I gui/core/nanosvg -I gui/core/renderers -I gui/core/resources -I gui/core/utils -I C:\Programs\LibNymphCast/include -I C:\Programs\NymphRPC/include -I c:\vcpkg\installed\x64-windows/include/curl -I c:\vcpkg\installed\x64-windows/include -I c:\vcpkg\installed\x64-windows/include -I c:\vcpkg\installed\x64-windows/include -I c:\vcpkg\installed\x64-windows/include -I c:\vcpkg\installed\x64-windows/include -I c:\vcpkg\installed\x64-windows/include -I c:\vcpkg\installed\x64-windows/include -I c:\vcpkg\installed\x64-windows/include/SDL2 -Foobj/x86_64-w64-msvc/Release/NymphCastServer.obj ./\NymphCastServer.cpp NymphCastServer.cpp ./\NymphCastServer.cpp(1426): error C2065: 'NymphSeekType': undeclared identifier ./\NymphCastServer.cpp(1426): error C2146: syntax error: missing ';' before identifier 'type' ./\NymphCastServer.cpp(1426): error C2065: 'type': undeclared identifier ./\NymphCastServer.cpp(1426): error C2061: syntax error: identifier 'NymphSeekType' ./\NymphCastServer.cpp(1427): error C2065: 'type': undeclared identifier ./\NymphCastServer.cpp(1427): error C2065: 'NYMPH_SEEK_TYPE_PERCENTAGE': undeclared identifier ./\NymphCastServer.cpp(1441): error C2065: 'type': undeclared identifier ./\NymphCastServer.cpp(1441): error C2065: 'NYMPH_SEEK_TYPE_BYTES': undeclared identifier ./\NymphCastServer.cpp(1448): error C2065: 'type': undeclared identifier NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX64\x64\cl.EXE"' : return code '0x2' Stop.

MayaPosch commented 2 years ago

The libnymphcast library was recently updated, which changes a header. Updating the locally installed libnymphcast should fix this.

mapl commented 2 years ago

I did that, but still had outdated env var for LIBNYMPHCAST_ROOT and NYMPHRPC_ROOT.

Not it works :)