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

MacOS 安装 srpc 时 ld 出错 #198

Closed
HDT3213 opened this issue Apr 5, 2022 · 11 comments
Closed

MacOS 安装 srpc 时 ld 出错 #198

HDT3213 opened this issue Apr 5, 2022 · 11 comments

Comments

@HDT3213
Copy link

HDT3213 commented Apr 5, 2022

MacOS 10.15.7 环境下 make 命令报错:

截屏2022-04-05 下午6.09.47.png

openssl 使用 homebrew 安装, 版本为 LibreSSL 2.8.3, workflow 也已正常安装。 看上去是 architecture 设置不对

已设置环境变量:

OPENSSL_ROOT_DIR=/usr/local/opt/openssl 
OPENSSL_LIBRARIES=/usr/local/opt/openssl/lib

cmake 变量也已设置

cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib
@holmes1412
Copy link
Contributor

libressl和openssl还不太一样,怀疑是这是原因~可以尝试一下按照openssl并且根据brew的提示把openssl的路径添加上?参考:sogou/workflow#150

@HDT3213
Copy link
Author

HDT3213 commented Apr 5, 2022

OPENSSL_ROOT_DIR 和 OPENSSL_LIBRARIES 两个环境变量已经指向了 openssl, 问题还是一样的。现在的版本是:
OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)

@holmes1412
Copy link
Contributor

你先试一下workflow和tutorial可以编译吗?

@HDT3213
Copy link
Author

HDT3213 commented Apr 5, 2022

workflow 和 workflow/tutorial 可以编译。 srpc/tutorial 会报 variable SRPC_INCLUDE_DIR does not exist

@holmes1412
Copy link
Contributor

holmes1412 commented Apr 5, 2022

你好,怀疑是没有重新find_package造成的(我这边mac可以正常编译,但怀疑不同版本cmake不一样)。我尝试更改了一下CMakelists.txt,包括find_package以及刚才ld其他库的问题,目前改动在我的分支上,等下会提PR到主项目。麻烦有空了试试这个是否ok:
https://github.com/holmes1412/srpc/tree/compiling_for_mac

@HDT3213
Copy link
Author

HDT3213 commented Apr 6, 2022

可以了,安装过程碰到了两个问题建议 Fix一下。
环境: MacOS 10.15.7 cmake version 3.23.0

  1. 建议指定一下 C++ 标准

check_include_file_cxx 报错:

/usr/local/include/snappy.h:199:10: error: unknown type name 'constexpr'
  static constexpr int kBlockLog = 16;
         ^
/usr/local/include/snappy.h:200:10: error: unknown type name 'constexpr'
  static constexpr size_t kBlockSize = 1 << kBlockLog;
         ^

设置 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") 后问题解决

  1. 建议指定一下 protobuf 版本号, 使用 protobuf 3.12.3_1 出现报错, 升级到 3.19.4 后问题解决
In file included from /Users/xxx/project/srpc/src/message/rpc_message_brpc.cc:24:
/Users/xxx/project/srpc/build.cmake/src/message/rpc_meta_brpc.pb.h:12:2: error: This file was generated by a newer version of protoc which is
#error This file was generated by a newer version of protoc which is
 ^
/Users/xxx/project/srpc/build.cmake/src/message/rpc_meta_brpc.pb.h:13:2: error: incompatible with your Protocol Buffer headers. Please update
#error incompatible with your Protocol Buffer headers. Please update
 ^
/Users/xxx/project/srpc/build.cmake/src/message/rpc_meta_brpc.pb.h:14:2: error: your headers.
#error your headers.
 ^
/Users/xxx/project/srpc/build.cmake/src/message/rpc_meta_brpc.pb.h:49:51: error: no type named 'AuxiliaryParseTableField' in namespace 'google::protobuf::internal'; did you mean 'AuxillaryParseTableField'?
  static const ::PROTOBUF_NAMESPACE_ID::internal::AuxiliaryParseTableField aux[]
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
                                                  AuxillaryParseTableField
/usr/local/include/google/protobuf/generated_message_table_driven.h:141:7: note: 'AuxillaryParseTableField' declared here
union AuxillaryParseTableField {
      ^
In file included from /Users/xxx/project/srpc/src/message/rpc_message_brpc.cc:24:
/Users/xxx/project/srpc/build.cmake/src/message/rpc_meta_brpc.pb.h:108:30: error: no type named 'ConstStringParam' in namespace 'google::protobuf'
    ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, TalkType* value) {
    ~~~~~~~~~~~~~~~~~~~~~~~~~^
/Users/xxx/project/srpc/build.cmake/src/message/rpc_meta_brpc.pb.h:131:30: error: no type named 'ConstStringParam' in namespace 'google::protobuf'
    ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, ProtocolType* value) {
    ~~~~~~~~~~~~~~~~~~~~~~~~~^
/Users/xxx/project/srpc/build.cmake/src/message/rpc_meta_brpc.pb.h:157:30: error: no type named 'ConstStringParam' in namespace 'google::protobuf'
    ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, FrameType* value) {
    ~~~~~~~~~~~~~~~~~~~~~~~~~^
/Users/xxx/project/srpc/src/message/rpc_message_brpc.cc:206:25: warning: 'ByteSize' is deprecated: Please use ByteSizeLong() instead [-Wdeprecated-declarations]
        this->meta_len = meta->ByteSize();
                               ^
/usr/local/include/google/protobuf/message_lite.h:407:3: note: 'ByteSize' has been explicitly marked deprecated here
  PROTOBUF_DEPRECATED_MSG("Please use ByteSizeLong() instead")
  ^

@Barenboim
Copy link
Contributor

snappy应该-std=c++11就可以吧?和我们的标准一样

@HDT3213
Copy link
Author

HDT3213 commented Apr 6, 2022

11 也可以编过,建议说明一下对我这种小白友好一些

@Barenboim
Copy link
Contributor

嗯嗯,我们在努力的改CMake中。现在包括动态库的生成,都是有一些问题的。

@HDT3213
Copy link
Author

HDT3213 commented Apr 6, 2022

非常感谢您的帮助

@HDT3213 HDT3213 closed this as completed Apr 6, 2022
@Barenboim
Copy link
Contributor

#199

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