Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

编译遇到问题 #17

Open
keaideni opened this issue Apr 25, 2020 · 4 comments
Open

编译遇到问题 #17

keaideni opened this issue Apr 25, 2020 · 4 comments

Comments

@keaideni
Copy link

你好,我在尝试用c++编译whale,遇到了一个问题,编译error如下:
octoidl/include/octoidl/ServiceAgent.h:705:55: error: invalid covariant return type for 'virtual boost::shared_ptr meituan_mns::ServiceAgentProcessorFactory::getProcessor(const apache::thrift::TConnectionInfo
&)'
::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo);
^
In file included from external/cpp3rd_lib/thrift/include/thrift/transport/TFileTransport.h:25:0,
from external/cpp3rd_lib/thrift/include/thrift/transport/TTransportUtils.h:30,
from whale/cthrift/util/cthrift_common.h:54,
from whale/cthrift/util/cthrift_common.cc:26:
external/cpp3rd_lib/thrift/include/thrift/TProcessor.h:215:42: error: overriding 'virtual std::shared_ptrapache::thrift::TProcessor apache::thrift::TProcessorFactory::getProcessor(const apache::thrift::TConnectionInfo&)'
virtual stdcxx::shared_ptr getProcessor(const TConnectionInfo& connInfo) = 0;

好像是因为我用的thrift0.12是采用的c++11标准,智能指针用的标准库。你们这个用的boost。你们的octoidl源码公开了嘛?这里只有静态库没有源代码。你们工程中thrift用的哪个版本?

@tiancihui
Copy link
Member

tiancihui commented Apr 29, 2020 via email

@keaideni
Copy link
Author

谢谢,现在我应该遇到了编译的最后一个问题了,error描述如下:
/data/huixiangbo/git/octo-open_source/mns-sdk/src/thrift_client.cc:52: error: undefined reference to 'apac
he::thrift::transport::TSocket::TSocket(std::string, int)'
这个error我就不太明白了,thrift里面肯定有这个函数的定义呀,为啥会报socket undifine。你们遇到过吗?这个要怎么解决?或者mns-sdk源码有公开嘛?

@tiancihui
Copy link
Member

谢谢,现在我应该遇到了编译的最后一个问题了,error描述如下:
/data/huixiangbo/git/octo-open_source/mns-sdk/src/thrift_client.cc:52: error: undefined reference to 'apac
he::thrift::transport::TSocket::TSocket(std::string, int)'
这个error我就不太明白了,thrift里面肯定有这个函数的定义呀,为啥会报socket undifine。你们遇到过吗?这个要怎么解决?或者mns-sdk源码有公开嘛?

thrift版本的问题,我们使用的是0.8.0版本,如果thrift高于这个版本比如 0.9.2 或者 0.10.0等在编译的时候会遇到这种问题

@andylau004
Copy link

cd thrift-0.9.3/0.14.0

vim ./lib/cpp/src/thrift/transport/TSocket.h

  /**
   * Constructs a new socket. Note that this does NOT actually connect the
   * socket.
   *
   * @param host An IP address or hostname to connect to
   * @param port The port to connect on
   */
  //TSocket(const std::string& host, int port);
  TSocket(std::string host, int port); // for jianrong 0.8.0

对应 TSocket.cpp ​也改一下;

  1. 安装后,再编译就没问题了;
[root@863ef6858c3a thrift-0.9.3.2]# ./configure --with-qt4=no --with-c_glib=no --with-csharp=no --with-erlang=no --with-perl=no --with-ruby=no --with-haskell=no --with-java=no --enable-tests=no  --enable-tutorial=no && make -j 4  && make install

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

No branches or pull requests

3 participants