facebook/fbthrift

Several build errors, problem with generated CPP code

Qiaolin-Yu opened this issue · 0 comments

What I want to do

I want to import fbthift dependencies into my rocksdb project

How I built fbthrift

Following the top-level README, I built fbthrift with a custom --scratch-path.

./build/fbcode_builder/getdeps.py install-system-deps --recursive fbthrift
./build/fbcode_builder/getdeps.py --allow-system-packages build --scratch-path=/my/custom/path

What I tried to build

I added this in CMakeLists.txt

include_directories(/my/custom/path/installed/fbthrift/include)
link_directories(/my/custom/path/installed/fbthrift/lib)

Error

/path/to/gen-cpp2/remote_compaction_service.cpp: In member function ‘virtual apache::thrift::AsyncProcessorFactory::CreateMethodMetadataResult THRIFT_NAMESPACE::cpp2::remote_compaction_serviceSvIf::createMethodMetadata()’:
/path/to/gen-cpp2/remote_compaction_service.cpp:19:105: error: too few arguments to function ‘apache::thrift::AsyncProcessorFactory::MethodMetadataMap apache::thrift::detail::ap::createMethodMetadataMap(const ServiceRequestInfoMap&) [with Processor = THRIFT_NAMESPACE::cpp2::remote_compaction_serviceAsyncProcessor; apache::thrift::AsyncProcessorFactory::MethodMetadataMap = folly::F14FastMap<std::__cxx11::basic_string<char>, std::shared_ptr<const apache::thrift::AsyncProcessorFactory::MethodMetadata> >; apache::thrift::ServiceRequestInfoMap = folly::F14ValueMap<std::__cxx11::basic_string<char>, apache::thrift::ServiceRequestInfo>]’
   19 | ft::detail::ap::createMethodMetadataMap<remote_compaction_serviceAsyncProcessor>();
      |                                                                                  ^
/path/to/gen-cpp2/remote_compaction_service.tcc:23:18:
error: cannot convert ‘<unresolved overloaded function type>’ to ‘apache::thrift::GeneratedAsyncProcessor::ExecuteFunc<THRIFT_NAMESPACE::cpp2::remote_compaction_serviceAsyncProcessor>’ {aka ‘void (THRIFT_NAMESPACE::cpp2::remote_compaction_serviceAsyncProcessor::*)(apache::thrift::ServerRequest&&)’}
   23 |   processInThread(std::move(req), std::move(serializedRequest), ctx, eb, tm, apache::thrift::RpcKind::SINGLE_REQUEST_SINGLE_RESPONSE, &remote_compaction_serviceAsyncProcessor::process_OpenAndCompact<ProtocolIn_, ProtocolOut_>, this);
      |   ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/path/to/gen-cpp2/remote_compaction_service.cpp:101:132: error: no matching function for call to ‘process(THRIFT_NAMESPACE::cpp2::remote_compaction_serviceAsyncProcessor*, std::remove_reference<std::unique_ptr<apache::thrift::ResponseChannelRequest, apache::thrift::RequestsRegistry::Deleter>&>::type, std::remove_reference<apache::thrift::SerializedCompressedRequest&>::type, const apache::thrift::AsyncProcessorFactory::MethodMetadata&, apache::thrift::protocol::PROTOCOL_TYPES&, apache::thrift::Cpp2RequestContext*&, folly::EventBase*&, apache::thrift::concurrency::ThreadManager*&)’
  101 |   apache::thrift::detail::ap::process(this, std::move(req), std::move(serializedRequest), methodMetadata, protType, context, eb, tm);

The problem seems to be caused by the generated CPP code.
Have I done anything wrong in the build process?