cross compile problem
ouclbc opened this issue · 12 comments
I want to make srpc in arm linux,but we exc make,found error
mkdir -p build.cmake
cd build.cmake && cmake /home/barton/holly/srpc
CMake Warning at CMakeLists.txt:45 (find_package):
By not providing "FindSnappy.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Snappy", but
CMake did not find one.
Could not find a package configuration file provided by "Snappy" with any
of the following names:
SnappyConfig.cmake
snappy-config.cmake
Add the installation prefix of "Snappy" to CMAKE_PREFIX_PATH or set
"Snappy_DIR" to a directory containing one of the above files. If "Snappy"
provides a separate development package or SDK, be sure it has been
installed.
CMake Error at src/CMakeLists.txt:33 (find_package):
Could not find a package configuration file provided by "Workflow" with any
of the following names:
WorkflowConfig.cmake
workflow-config.cmake
Add the installation prefix of "Workflow" to CMAKE_PREFIX_PATH or set
"Workflow_DIR" to a directory containing one of the above files. If
"Workflow" provides a separate development package or SDK, be sure it has
been installed.
编译srpc需要依赖workflow作为third_party。请问git clone https://github.com/sogou/srpc.git
时是否有带上--recursive
呢?
如果已经clone完了,可以通过执行命令:git submodule update --init --recursive
初始化刚才没有拉下来的third_party,然后再试试~
有什么进展欢迎反馈,谢谢~
我下载的时候带着--recursive
Add the installation prefix of "Workflow" to CMAKE_PREFIX_PATH or set
"Workflow_DIR" to a directory containing one of the above files. If
"Workflow" provides a separate development package or SDK, be sure it has
been installed.
1、你执行make的路径是在srpc根目录吗?
2、cd workflow
看看里边有东西么?
我试了一下,如果没有--recursive拉代码的话,确实会有找不到third_party的错误,比如我这里会:
CMake Error at src/CMakeLists.txt:41 (find_package):
Could not find a package configuration file provided by "Snappy" (requested
version 1.1.6) with any of the following names:
SnappyConfig.cmake
snappy-config.cmake
Add the installation prefix of "Snappy" to CMAKE_PREFIX_PATH or set
"Snappy_DIR" to a directory containing one of the above files. If "Snappy"
provides a separate development package or SDK, be sure it has been
installed.
然后你的报错那行是srpc/src的CMakeLists.txt:find_package(Workflow REQUIRED CONFIG HINTS ../workflow)
也就是说如果srpc/workflow/这个目录下如果有workflow-config.cmake.in,就会生成workflow-config.cmake
所以麻烦确认下srpc根目录下的workflow目录里是否有东西?
linux x86下设置交叉编译环境,完整的错误:
mkdir -p build.cmake
cd build.cmake && cmake /home/barton/holly/srpc
CMake Warning at CMakeLists.txt:45 (find_package):
By not providing "FindSnappy.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Snappy", but
CMake did not find one.
Could not find a package configuration file provided by "Snappy" with any
of the following names:
SnappyConfig.cmake
snappy-config.cmake
Add the installation prefix of "Snappy" to CMAKE_PREFIX_PATH or set
"Snappy_DIR" to a directory containing one of the above files. If "Snappy"
provides a separate development package or SDK, be sure it has been
installed.
CMake Error at src/CMakeLists.txt:33 (find_package):
Could not find a package configuration file provided by "Workflow" with any
of the following names:
WorkflowConfig.cmake
workflow-config.cmake
Add the installation prefix of "Workflow" to CMAKE_PREFIX_PATH or set
"Workflow_DIR" to a directory containing one of the above files. If
"Workflow" provides a separate development package or SDK, be sure it has
been installed.
在cmakelist.txt里面设置set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/third_party/snappy;${CMAKE_SOURCE_DIR}/workflow;${CMAKE_MODULE_PATH}")好像也不行
按说src/CMakeLists.txt里的find_package()里已经制定了HINTS的路径才对。
要不你试试set一下Snappy_DIR和Workflow_DIR,看看ok吗?
本地可以编译过,但是交叉编译有问题。set一下Snappy_DIR和Workflow_DIR好像不起作用。
我们不懂交叉编译,所以还得请你多帮定位🙏
我看workflow的交叉编译有一个小伙伴提过一个PR:https://github.com/sogou/workflow/pull/655/files 虽然现在你已经编译好workflow了,但不知道这个改动有可以参考的地方吗?比如设置CMAKE_FIND_ROOT_PATH这种。
另外问了下GPT,基本也是建议改这两个:
cmake -DCMAKE_PREFIX_PATH=/path/to/cross/toolchain ..
或者
set(Workflow_DIR "/path/to/cross/toolchain/lib/cmake/Workflow")
find_package(Workflow REQUIRED CONFIG)
要么是否可以先安装workflow、snappy、lz4,然后再编译srpc,从系统里找依赖?
非常感谢你们这边及时的回答,我这边再排查一下cmake的执行流程,看看哪里有问题。
好的,有任何进展欢迎反馈,感谢~
我这边在src/CMakelist.txt里面设置绝对路径:set(Workflow_DIR "/home/barton/holly/srpc/workflow")编译通过了,另外请问一下这个srpc怎么切换是brpc还是Thrift 这种有文档说明么?我们想用在嵌入式设备上
太好了~
关于收发协议,可以参考这两个文档:
https://github.com/sogou/srpc/blob/master/docs/docs-03-server.md
https://github.com/sogou/srpc/blob/master/docs/docs-04-client.md
比如你在文档里看到SRPCServer/SRPCClient,那就是SRPC协议+protobuf,如果你是用BRPCServer/BRPCClient,那么就是brpc,如此类推。你可以把tutorial编译出来,有各个协议对应的写法和示例可以run~