nmos-cpp icon indicating copy to clipboard operation
nmos-cpp copied to clipboard

MacOS/Cmake Supplied-JWT Linker Error

Open christopherbaine opened this issue 1 year ago • 1 comments

Hi, I've been attempting to building on MacOS, with the NMOS_CPP_USE_SUPPLIED_JWT_CPP flag to true, causes Linking CXX static library libjwt-cpp.a Error

Assuming Boost/cpprestsdk are installed, To Replicate: cmake -B build -DNMOS_CPP_USE_SUPPLIED_JWT_CPP=TRUE -DNMOS_CPP_USE_SUPPLIED_JSON_SCHEMA_VALIDATOR=TRUE -DWEBSOCKETPP_INCLUDE_DIR="Release/libs/websocketpp" cmake --build build

Thanks

christopherbaine avatar Oct 27 '24 00:10 christopherbaine

It looks like the section in NmosCppDependencies.cmake that compiles this creates a static library for a header only library. It even has a comment # hm, header-only so should be INTERFACE library?

christopherbaine avatar Oct 27 '24 02:10 christopherbaine

I've checked and confirmed NMOS_CPP_USE_SUPPLIED_JSON_SCHEMA_VALIDATOR works OK on Linux... it constructs an empty libjwt-cpp.a (8 Byte file). I suspect difference in behaviour with empty archives on macOS. The CI matrix only tests this flag on one platform. As the original author of the "hm" comment after the library was first added, I agree an INTERFACE library would be more elegant anyway... but I note one or two other potential issues - I think missing install(FILES) and I think wrong target_include_directories. I'll look at this when I get a chance.

garethsb avatar Nov 02 '24 16:11 garethsb

I believe that is exactly the case, MacOS fails on an empty archive. Thanks for getting back to me!

christopherbaine avatar Nov 02 '24 16:11 christopherbaine

Closes, as this issue has been resolved in #431.

lo-simon avatar Feb 14 '25 11:02 lo-simon