i am trying to build and link cap'n proto library using arm-linux-gnueabihf-ld and receive such link errors. also i am building it on docker and snapcraft.
arm-linux-gnueabihf-ld: error: undefined symbol: capnp::MessageBuilder::getRootInternal()
>>> referenced by main.cpp
>>> CMakeFiles/feature-manager.dir/src/main.cpp.o:(SysRegRequestBuilder::buildVersion(capnp::MallocMessageBuilder&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))
>>> referenced by main.cpp
>>> CMakeFiles/feature-manager.dir/src/main.cpp.o:(SysRegRequestBuilder::buildAuth(capnp::MallocMessageBuilder&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))
>>> referenced by main.cpp
>>> CMakeFiles/feature-manager.dir/src/main.cpp.o:(SysRegRequestBuilder::buildGet(capnp::MallocMessageBuilder&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))
>>> referenced 10 more times
arm-linux-gnueabihf-ld: error: undefined symbol: capnp::_::PointerBuilder::initStruct(capnp::_::StructSize)
>>> referenced by main.cpp
>>> CMakeFiles/feature-manager.dir/src/main.cpp.o:(SysRegRequestBuilder::buildVersion(capnp::MallocMessageBuilder&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))
>>> referenced by main.cpp
>>> CMakeFiles/feature-manager.dir/src/main.cpp.o:(SysRegRequestBuilder::buildVersion(capnp::MallocMessageBuilder&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))
>>> referenced by main.cpp
>>> CMakeFiles/feature-manager.dir/src/main.cpp.o:(SysRegRequestBuilder::buildAuth(capnp::MallocMessageBuilder&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))
>>> referenced 23 more times
arm-linux-gnueabihf-ld: error: undefined symbol: void capnp::_::PointerBuilder::setBlob<capnp::Text>(capnp::Text::Reader)
>>> referenced by main.cpp
>>> CMakeFiles/feature-manager.dir/src/main.cpp.o:(SysRegRequestBuilder::buildVersion(capnp::MallocMessageBuilder&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))
>>> referenced by main.cpp
>>> CMakeFiles/feature-manager.dir/src/main.cpp.o:(SysRegRequestBuilder::buildAuth(capnp::MallocMessageBuilder&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))
>>> referenced by main.cpp
>>> CMakeFiles/feature-manager.dir/src/main.cpp.o:(SysRegRequestBuilder::buildGet(capnp::MallocMessageBuilder&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&))
>>> referenced 12 more times
arm-linux-gnueabihf-ld: error: undefined symbol: capnp::_::ListBuilder::asReader() const
>>> referenced by main.cpp
>>> CMakeFiles/feature-manager.dir/src/main.cpp.o:(SysRegResponseBuilder::buildEnumerate(capnp::MallocMessageBuilder&, capnp::List<capnp::Text, (capnp::Kind)1>::Builder const&, capnp::schemas::SysregStatus_b56039029f3859aa))
arm-linux-gnueabihf-ld: error: undefined symbol: capnp::_::PointerBuilder::setList(capnp::_::ListReader const&, bool)
>>> referenced by main.cpp
>>> CMakeFiles/feature-manager.dir/src/main.cpp.o:(SysRegResponseBuilder::buildEnumerate(capnp::MallocMessageBuilder&, capnp::List<capnp::Text, (capnp::Kind)1>::Builder const&, capnp::schemas::SysregStatus_b56039029f3859aa))
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/feature-manager.dir/build.make:145: feature-manager] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/feature-manager.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
CodePudding user response:
You need to link your binary against the libcapnp.so
or libcapnp.a
library. If you've installed the libraries to your system then the linker flag -lcapnp
should accomplish this.