facebook / fboss

Facebook Open Switching System Software for controlling network switches.
Other
860 stars 295 forks source link

Cannot build latest code on Ubuntu 14.04 #6

Closed vitaliy-senchyshyn closed 8 years ago

vitaliy-senchyshyn commented 9 years ago

I've just pulled the latest fboss code, pulled and installed latest folly and fbthrift from github, executed getdeps.sh. Till that moment everything is OK. But when I execute cmake .. from the created build dir(as this is mentioned in BUILD document) I got the error as follows:

CMake Error at CMakeLists.txt:63 (add_library): Cannot find source file:

/home/vsenchyshyn/projects/xpliant/tmp/fboss/build/gen/common/network/if/gen-cpp/Address_reflection.cpp

Since the latest commit is fixing build I'm wondering what's wrong in my case? Do I need to install folly and fbthrift of specific version in order to make build working correctly? If yes then how can I do that? If not then what else could be wrong?

superchild commented 9 years ago

I found some bug in this CMakeList.txt Try to modify

foreach(reflect ${arg_REFLECT})
    set(outputs ${outputs}
        ${CMAKE_BINARY_DIR}/gen/${dirname}/gen-${gen}/${reflect}_reflect.h
        ${CMAKE_BINARY_DIR}/gen/${dirname}/gen-${gen}/${reflect}_reflect.cpp)
endforeach(reflect)

to

foreach(reflect ${arg_REFLECT})
    set(outputs ${outputs}
        ${CMAKE_BINARY_DIR}/gen/${dirname}/gen-${gen}/${reflect}_reflection.h
        ${CMAKE_BINARY_DIR}/gen/${dirname}/gen-${gen}/${reflect}_reflection.cpp)
endforeach(reflect)

and also needs to modify the cmake_parse_arguments. Try to modify

function(fboss_add_thrift)
    cmake_parse_arguments("arg" "" "OPTIONS";"THRIFTSRC" "SERVICES" ${ARGN})

to

function(fboss_add_thrift)
    set(options)
    set(oneValueArgs OPTIONS REFLECT)
    set(multiValueArgs THRIFTSRC SERVICES)
    cmake_parse_argument("arg" "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
vitaliy-senchyshyn commented 9 years ago

This helped a bit but now I see error as follows: fboss/external/fbthrift/thrift/compiler/thrift1: error while loading shared libraries: libfolly.so.48: cannot open shared object file: No such file or directory

At the same time I see that this library is here: fboss$ find . -name libfolly.so.48 ./external/folly/folly/.libs/libfolly.so.48

So this looks quite strange. But perhaps this happens because ./getdeps.sh throws errors on gen-cpp2/ stage and fails to finish. Although ./getdeps.sh now has exact versions of folly, fbthrift and iproute2 which have to be downloaded but looks like there is still some mistake in versions mentioned there. First of all I've added the command "git reset --hard $2" after "cd $1" function build() but still see many errors as follows:

In file included from gen-cpp2/SaslAuthService.cpp:7:0: gen-cpp2/SaslAuthService.h:79:37: error: expected type-specifier before ‘ProcessFunc’ using BinaryProtocolProcessFunc = ProcessFunc<SaslAuthServiceAsyncProcessor, apache::thrift::BinaryProtocolReader>; ^ gen-cpp2/SaslAuthService.h:80:36: error: expected type-specifier before ‘ProcessMap’ using BinaryProtocolProcessMap = ProcessMap; ^ gen-cpp2/SaslAuthService.h:81:16: error: ‘BinaryProtocolProcessMap’ in ‘class apache::thrift::sasl::SaslAuthServiceAsyncProcessor’ does not name a type static const SaslAuthServiceAsyncProcessor::BinaryProtocolProcessMap& getBinaryProtocolProcessMap(); ^ gen-cpp2/SaslAuthService.h:83:10: error: ‘BinaryProtocolProcessMap’ in ‘class apache::thrift::sasl::SaslAuthServiceAsyncProcessor’ does not name a type static SaslAuthServiceAsyncProcessor::BinaryProtocolProcessMap binaryProcessMap; ^ gen-cpp2/SaslAuthService.h:85:38: error: expected type-specifier before ‘ProcessFunc’ using CompactProtocolProcessFunc = ProcessFunc<SaslAuthServiceAsyncProcessor, apache::thrift::CompactProtocolReader>; ^ gen-cpp2/SaslAuthService.h:86:37: error: expected type-specifier before ‘ProcessMap’ using CompactProtocolProcessMap = ProcessMap; ^ gen-cpp2/SaslAuthService.h:87:16: error: ‘CompactProtocolProcessMap’ in ‘class apache::thrift::sasl::SaslAuthServiceAsyncProcessor’ does not name a type static const SaslAuthServiceAsyncProcessor::CompactProtocolProcessMap& getCompactProtocolProcessMap(); ^ gen-cpp2/SaslAuthService.h:89:10: error: ‘CompactProtocolProcessMap’ in ‘class apache::thrift::sasl::SaslAuthServiceAsyncProcessor’ does not name a type static SaslAuthServiceAsyncProcessor::CompactProtocolProcessMap compactProcessMap; ^ gen-cpp2/SaslAuthService.h: In constructor ‘apache::thrift::sasl::SaslAuthServiceAsyncClient::SaslAuthServiceAsyncClient(std::sharedptrapache::thrift::RequestChannel)’: gen-cpp2/SaslAuthService.h:127:50: error: no matching function for call to ‘apache::thrift::Cpp2ConnContext::Cpp2ConnContext()’ connectionContext.reset(new apache::thrift::Cpp2ConnContext); ^ gen-cpp2/SaslAuthService.h:127:50: note: candidates are: In file included from ../../../thrift/lib/cpp2/async/AsyncProcessor.h:29:0, from ../../../thrift/lib/cpp2/ServiceIncludes.h:5, from gen-cpp2/SaslAuthService.h:9, from gen-cpp2/SaslAuthService.cpp:7: ../../../thrift/lib/cpp2/server/Cpp2ConnContext.h:39:12: note: apache::thrift::Cpp2ConnContext::Cpp2ConnContext(const folly::SocketAddress, const apache::thrift::async::TAsyncSocket, apache::thrift::transport::THeader, const apache::thrift::SaslServer, apache::thrift::async::TEventBaseManager_, const std::shared_ptrapache::thrift::RequestChannel&) explicit Cpp2ConnContext( ^ ../../../thrift/lib/cpp2/server/Cpp2ConnContext.h:39:12: note: candidate expects 6 arguments, 0 provided ../../../thrift/lib/cpp2/server/Cpp2ConnContext.h:37:7: note: apache::thrift::Cpp2ConnContext::Cpp2ConnContext(const apache::thrift::Cpp2ConnContext&) class Cpp2ConnContext : public apache::thrift::server::TConnectionContext { ^ ../../../thrift/lib/cpp2/server/Cpp2ConnContext.h:37:7: note: candidate expects 1 argument, 0 provided ../../../thrift/lib/cpp2/server/Cpp2ConnContext.h:37:7: note: apache::thrift::Cpp2ConnContext::Cpp2ConnContext(apache::thrift::Cpp2ConnContext&&) ../../../thrift/lib/cpp2/server/Cpp2ConnContext.h:37:7: note: candidate expects 1 argument, 0 provided In file included from gen-cpp2/SaslAuthService.cpp:9:0: gen-cpp2/SaslAuthService.tcc: In member function ‘void apache::thrift::sasl::SaslAuthServiceAsyncProcessor::process_authFirstRequest(std::unique_ptrapache::thrift::ResponseChannel::Request, std::unique_ptrfolly::IOBuf, std::uniqueptr, apache::thrift::Cpp2RequestContext, apache::thrift::async::TEventBase, apache::thrift::concurrency::ThreadManager)’: gen-cpp2/SaslAuthService.tcc:48:159: error: no matching function for call to ‘apache::thrift::transport::THeader::transform(std::unique_ptrfolly::IOBuf, const std::vector&, uint32_t)’ queue.append(apache::thrift::transport::THeader::transform(queue.move(), ctx->getHeader()->getWriteTransforms(), ctx->getHeader()->getMinCompressBytes())); ^ gen-cpp2/SaslAuthService.tcc:48:159: note: candidate is: In file included from ../../../thrift/lib/cpp/server/TConnectionContext.h:25:0, from ../../../thrift/lib/cpp/EventHandlerBase.h:25, from ../../../thrift/lib/cpp/TProcessor.h:25, from ../../../thrift/lib/cpp2/async/AsyncProcessor.h:20, from ../../../thrift/lib/cpp2/ServiceIncludes.h:5, from gen-cpp2/SaslAuthService.h:9, from gen-cpp2/SaslAuthService.cpp:7: ../../../thrift/lib/cpp/transport/THeader.h:140:40: note: static std::unique_ptrfolly::IOBuf apache::thrift::transport::THeader::transform(std::unique_ptrfolly::IOBuf, std::vector&, uint32_t) static std::unique_ptrfolly::IOBuf transform( ^ ../../../thrift/lib/cpp/transport/THeader.h:140:40: note: no known conversion for argument 2 from ‘const std::vector’ to ‘std::vector&’ In file included from gen-cpp2/SaslAuthService.cpp:9:0: gen-cpp2/SaslAuthService.tcc: In static member function ‘static void apache::thrift::sasl::SaslAuthServiceAsyncProcessor::throw_authFirstRequest(std::unique_ptrapache::thrift::ResponseChannel::Request, int32t, apache::thrift::ContextStack, std::__exception_ptr::exceptionptr, apache::thrift::Cpp2RequestContext)’: gen-cpp2/SaslAuthService.tcc:91:165: error: no matching function for call to ‘apache::thrift::transport::THeader::transform(std::unique_ptrfolly::IOBuf, const std::vector&, uint32_t)’ queue.append(apache::thrift::transport::THeader::transform(queue.move(), reqCtx->getHeader()->getWriteTransforms(), reqCtx->getHeader()->getMinCompressBytes())); ^ gen-cpp2/SaslAuthService.tcc:91:165: note: candidate is: In file included from ../../../thrift/lib/cpp/server/TConnectionContext.h:25:0, from ../../../thrift/lib/cpp/EventHandlerBase.h:25, from ../../../thrift/lib/cpp/TProcessor.h:25, from ../../../thrift/lib/cpp2/async/AsyncProcessor.h:20, from ../../../thrift/lib/cpp2/ServiceIncludes.h:5, from gen-cpp2/SaslAuthService.h:9, from gen-cpp2/SaslAuthService.cpp:7: ../../../thrift/lib/cpp/transport/THeader.h:140:40: note: static std::unique_ptrfolly::IOBuf apache::thrift::transport::THeader::transform(std::unique_ptrfolly::IOBuf, std::vector&, uint32_t) static std::unique_ptrfolly::IOBuf transform( ^ ../../../thrift/lib/cpp/transport/THeader.h:140:40: note: no known conversion for argument 2 from ‘const std::vector’ to ‘std::vector&’ In file included from gen-cpp2/SaslAuthService.cpp:9:0: gen-cpp2/SaslAuthService.tcc:104:165: error: no matching function for call to ‘apache::thrift::transport::THeader::transform(std::unique_ptrfolly::IOBuf, const std::vector&, uint32_t)’ queue.append(apache::thrift::transport::THeader::transform(queue.move(), reqCtx->getHeader()->getWriteTransforms(), reqCtx->getHeader()->getMinCompressBytes())); ^ gen-cpp2/SaslAuthService.tcc:104:165: note: candidate is: In file included from ../../../thrift/lib/cpp/server/TConnectionContext.h:25:0, from ../../../thrift/lib/cpp/EventHandlerBase.h:25, from ../../../thrift/lib/cpp/TProcessor.h:25, from ../../../thrift/lib/cpp2/async/AsyncProcessor.h:20, from ../../../thrift/lib/cpp2/ServiceIncludes.h:5, from gen-cpp2/SaslAuthService.h:9, from gen-cpp2/SaslAuthService.cpp:7: ../../../thrift/lib/cpp/transport/THeader.h:140:40: note: static std::unique_ptrfolly::IOBuf apache::thrift::transport::THeader::transform(std::unique_ptrfolly::IOBuf, std::vector&, uint32_t) static std::unique_ptrfolly::IOBuf transform( ^ ../../../thrift/lib/cpp/transport/THeader.h:140:40: note: no known conversion for argument 2 from ‘const std::vector’ to ‘std::vector&’ In file included from gen-cpp2/SaslAuthService.cpp:9:0: gen-cpp2/SaslAuthService.tcc: In static member function ‘static void apache::thrift::sasl::SaslAuthServiceAsyncProcessor::throw_wrapped_authFirstRequest(std::unique_ptrapache::thrift::ResponseChannel::Request, int32t, apache::thrift::ContextStack, folly::exceptionwrapper, apache::thrift::Cpp2RequestContext)’: gen-cpp2/SaslAuthService.tcc:126:165: error: no matching function for call to ‘apache::thrift::transport::THeader::transform(std::unique_ptrfolly::IOBuf, const std::vector&, uint32_t)’ queue.append(apache::thrift::transport::THeader::transform(queue.move(), reqCtx->getHeader()->getWriteTransforms(), reqCtx->getHeader()->getMinCompressBytes()));

oridb commented 9 years ago

What version of Thrift are you building against?

vitaliy-senchyshyn commented 9 years ago

v0.28.0 as mentioned in ./getdeps.sh

oridb commented 9 years ago

Odd. What compiler version?

vitaliy-senchyshyn commented 9 years ago

/fboss$ g++ --version g++ (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4

vitaliy-senchyshyn commented 8 years ago

Any updates?

vitaliy-senchyshyn commented 8 years ago

After my hard disc clean up things are much better(I guess the problems above occurred because of thrift, folly and iproute2 libraries of versions other than required here were installed in system directories. Apparently they affected compilation).

I still see one compilation error which should be fixed but as a temporary solution I've just commented it out and this helped - fboss was built successfully. The error is as follows and I guess has to be fixed anyway:

/home/vsenchyshyn/projects/xpliant/tmp/fboss/fboss/agent/NeighborUpdater.cpp: In destructor ‘virtual facebook::fboss::NeighborUpdater::~NeighborUpdater()’: /home/vsenchyshyn/projects/xpliant/tmp/fboss/fboss/agent/NeighborUpdater.cpp:156:37: error: no matching function for call to ‘std::vectorfolly::Future::push_back(std::remove_referencefolly::Future<void&>::type)’ stopTasks.push_back(std::move(f)); ^ /home/vsenchyshyn/projects/xpliant/tmp/fboss/fboss/agent/NeighborUpdater.cpp:156:37: note: candidates are: In file included from /usr/include/c++/4.8/vector:64:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from /usr/include/boost/container/detail/flat_tree.hpp:23, from /usr/include/boost/container/flat_map.hpp:25, from /home/vsenchyshyn/projects/xpliant/tmp/fboss/fboss/agent/NeighborUpdater.h:12, from /home/vsenchyshyn/projects/xpliant/tmp/fboss/fboss/agent/NeighborUpdater.cpp:10: /usr/include/c++/4.8/bits/stl_vector.h:901:7: note: void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = folly::Futurefolly::Unit; _Alloc = std::allocatorfolly::Future; std::vector<_Tp, _Alloc>::value_type = folly::Futurefolly::Unit] push_back(const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_vector.h:901:7: note: no known conversion for argument 1 from ‘std::remove_referencefolly::Future<void&>::type {aka folly::Future}’ to ‘const value_type& {aka const folly::Futurefolly::Unit&}’ /usr/include/c++/4.8/bits/stl_vector.h:919:7: note: void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = folly::Futurefolly::Unit; _Alloc = std::allocatorfolly::Future; std::vector<_Tp, _Alloc>::value_type = folly::Futurefolly::Unit] push_back(value_type&& __x) ^ /usr/include/c++/4.8/bits/stl_vector.h:919:7: note: no known conversion for argument 1 from ‘std::remove_referencefolly::Future<void&>::type {aka folly::Future}’ to ‘std::vectorfolly::Future::value_type&& {aka folly::Futurefolly::Unit&&}’

oridb commented 8 years ago

This should be fixed.