dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.46k stars 10.03k forks source link

Document dependencies used by SignalR c++ client #44788

Open mprather opened 2 years ago

mprather commented 2 years ago

Is there an existing issue for this?

Describe the bug

Projects that are dependent on the microsoft-signalr package no longer compile with v0.1.0-alpha4 when compiling on a linux platform.

Expected Behavior

With the latest release of signalR c++ library, projects that relied on the library no longer build on linux compilations.

Steps To Reproduce

Platform: debian or ubuntu x64

Setup: 1) install latest vcpkg (i.e. commit from 10/29 that effectively includes v0.1.0-alpha4) 2) install the microsoft-signalr package. 3) compile existing app that used signalR. the app uses makefile for compilation.

Result: Compilation fails due to missing reference

11 29.14 /usr/bin/ld: /src/vcpkg/installed/x64-linux/lib/libmicrosoft-signalr.a(json_hub_protocol.cpp.o): in function `signalr::json_hub_protocol::parse_message(char const*, unsigned long) const':

11 29.14 json_hub_protocol.cpp:(.text+0x29): undefined reference to `Json::Value::Value(Json::ValueType)'

11 29.14 /usr/bin/ld: json_hub_protocol.cpp:(.text+0x15c): undefined reference to `Json::Value::~Value()'

11 29.14 /usr/bin/ld: /src/vcpkg/installed/x64-linux/lib/libmicrosoft-signalr.a(json_hub_protocol.cpp.o): in function `signalr::json_hub_protocol::write_message[abi:cxx11](signalr::hub_message const*) const':

11 29.14 json_hub_protocol.cpp:(.text+0xce6): undefined reference to `Json::Value::Value(Json::ValueType)'

11 29.14 /usr/bin/ld: json_hub_protocol.cpp:(.text+0xd29): undefined reference to `Json::writeString[abi:cxx11](Json::StreamWriter::Factory const&, Json::Value const&)'

11 29.14 /usr/bin/ld: json_hub_protocol.cpp:(.text+0xd96): undefined reference to `Json::StreamWriterBuilder::~StreamWriterBuilder()'

11 29.14 /usr/bin/ld: json_hub_protocol.cpp:(.text+0xd9e): undefined reference to `Json::Value::~Value()'

11 29.14 /usr/bin/ld: json_hub_protocol.cpp:(.text+0xdd1): undefined reference to `Json::Value::Value(int)'

11 29.14 /usr/bin/ld: json_hub_protocol.cpp:(.text+0xde0): undefined reference to `Json::Value::operator[](char const*)'

11 29.14 /usr/bin/ld: json_hub_protocol.cpp:(.text+0xdeb): undefined reference to `Json::Value::operator=(Json::Value&&)'

11 29.14 /usr/bin/ld: json_hub_protocol.cpp:(.text+0xdf3): undefined reference to `Json::Value::~Value()'

11 29.14 /usr/bin/ld: json_hub_protocol.cpp:(.text+0xe0a): undefined reference to `Json::Value::Value(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&)'

Rolling back to vcpkg release 2022.10.19, which utilizes alpha3 results in a successful build.

I've also tried manually installing the jsoncpp package to ensure that it would be available (while using alpha4). Compilation fails.

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

mprather commented 2 years ago

The issue is that jsoncpp is now a dependency as of alpha4. This is not explicitly called out in the project's readme. If you are using a makefile, the fix is to add jsoncpp to the library list.

Please make sure the doc's state what dependencies are utilized.

BrennanConroy commented 2 years ago

Hmm, it should install and pull in jsoncpp automatically from vcpkg. What changes when you use make vs cmake? Does make require explicitly calling out dependencies?

mprather commented 2 years ago

vcpkg is properly including jsoncpp. thus from a vcpkg perspective, there is no change. that part of setup is ok. the part that needs adjustment is the makefiles. you are required to list out each dependency via the -l parameter for gcc and clang.

For example, the following command produces an exe that leverages the signalR library.

< alpha4

g++ -o /test-app -DNO_SIGNALRCLIENT_EXPORTS /src/app/cpp/build/debug-livestream/Application.o -L/src/vcpkg/installed/x64-linux/lib -lpthread -lz  -ldl -lmicrosoft-signalr -lcpprest -lcrypto -lssl -lz

alpha4 (note addition of -ljsoncpp at the end)

g++ -o /test-app -DNO_SIGNALRCLIENT_EXPORTS /src/app/cpp/build/debug-livestream/Application.o -L/src/vcpkg/installed/x64-linux/lib -lpthread -lz  -ldl -lmicrosoft-signalr -lcpprest -lcrypto -lssl -lz -ljsoncpp

at this point, this issue is focused on improving the documentation. our build scripts upgraded vcpkg to pull in the latest changes and they all broke. I took a quick look at the project readme to see if something changed and it was not clear that a new dependency was now required with the change from alpha3 to alpha4.

BrennanConroy commented 2 years ago

Gotcha, thanks for the explanation!