Skip to content

Conversation

@pinkenburg
Copy link
Collaborator

@pinkenburg pinkenburg commented Jan 8, 2024

I finally tracked down the reason for the unresolved symbol which has been bugging me for a year. Whenever compiling with -O2 it showed up:
root.exe: symbol lookup error: /direct/phenix+u/pinkenbu/workarea/sPHENIX/gitrepov5/install/lib/libsphenixnpc.so.0.0.0: undefined symbol: ZN15nopayloadclient15NoPayloadClient8makeRespIN8nlohmann10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS2_14adl_serializerES5_IhSaIhEEEEEESF_T
[pinkenbu@sphnxdev01 CDBTest]$ c++filt ZN15nopayloadclient15NoPayloadClient8makeRespIN8nlohmann10basic_jsonISt3mapSt6vectorNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEblmdSaNS2_14adl_serializerES5_IhSaIhEEEEEESF_T
nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator > > nopayloadclient::NoPayloadClient::makeResp<nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator > > >(nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits, std::allocator >, bool, long, unsigned long, double, std::allocator, nlohmann::adl_serializer, std::vector<unsigned char, std::allocator > >)

Googling pointed to similar problems, it was this template declaration:

template
json NoPayloadClient::makeResp(T msg) {
return {{"code", 0}, {"msg", msg}};
}

it needs to be explicitly instantiated in the .cpp file so the optimizer doesn't get rid of it. Just adding a single line:

template json NoPayloadClient::makeResp(json);

fixes this. This PR sits on top of my previous 2 PR's

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant