Comments (14)
errors as like this:
undefined reference to `google::protobuf::internal::LogMessage::LogMessage(google::protobuf::LogLevel, char const*, int)'
from srpc.
All .so and headers of wokflow and srpc are already located in their _lib and _include.
This error is because libprotobuf.so cannot be found. You need to specify the default location which installed protobuf in your environment, usually in /usr/local.
from srpc.
thank you for your infomation,but what I want to know is when cross compile,where can I find the target temp so? /usr/local that is local compile and install can find.
from srpc.
交叉环境在使用bin时,如下库也是需要:libz.so libworkflow.so libprotobuf.so,但是编译产物里面没有,这个请问我需要一个个模块单独编译么?
from srpc.
其实一共需要:workflow lz4 snappy zlib protobuf openssl
先前我们recursive拉的代码,包含了前三个,可以在普通环境下make完看看:
- 其中workflow在srpc项目根目录/workflow/_libs和_include下,应该已经编译好了,指定一下路径链接一下就行
- snappy和lz4在third_party/各自的目录下,是用来压缩的,我看你上面没有列,可能你已经搞定了
- 然后是zlib和openssl,一般系统都会自带,所以我猜你如何交叉编译openssl的你也需要对zlib这样交叉编译一下(也是用来压缩的库)
- 最后是protobuf,不知道你的嵌入式环境下一般如何安装protobuf呢?如何系统没有自带,你需要单独编译。
from srpc.
多谢哈,我理解为应该是依赖模块都需要交叉编译,除非系统自带某些库。我试一下各个模块交叉编译吧。
from srpc.
我发现我直接从官方拉snappy代码,可以编译过,用srpc目录下面的snnappy编译,有如下错误
In file included from /home/barton/work/srpc/third_party/snappy/snappy-test.cc:31:0:
/home/barton/work/srpc/third_party/snappy/snappy-test.h: In member function ‘void snappy::CycleTimer::Start()’:
/home/barton/work/srpc/third_party/snappy/snappy-test.h:133:7: error: ‘::gettimeofday’ has not been declared
::gettimeofday(&start_, nullptr);
^~~~~~~~~~~~
/home/barton/work/srpc/third_party/snappy/snappy-test.h: In member function ‘void snappy::CycleTimer::Stop()’:
/home/barton/work/srpc/third_party/snappy/snappy-test.h:149:7: error: ‘::gettimeofday’ has not been declared
::gettimeofday(&stop, nullptr);
^~~~~~~~~~~~
CMakeFiles/snappy_test_support.dir/build.make:75: recipe for target 'CMakeFiles/snappy_test_support.dir/snappy-test.cc.o' failed
make[2]: *** [CMakeFiles/snappy_test_support.dir/snappy-test.cc.o] Error 1
CMakeFiles/Makefile2:204: recipe for target 'CMakeFiles/snappy_test_support.dir/all' failed
make[1]: *** [CMakeFiles/snappy_test_support.dir/all] Error 2
Makefile:145: recipe for target 'all' failed
make: *** [all] Error 2
from srpc.
gettimeofday
这个函数并不跨平台,我看了下你给的文件名:third_party/snappy/snappy-test.h,它这里是这样的:
inline void Start() {
#ifdef WIN32
QueryPerformanceCounter(&start_);
#else
::gettimeofday(&start_, nullptr);
#endif
}
这里对于非windows的话都用gettimeofday的话,在嵌入式环境下会有问题。
你拉的snappy应该是适合你的环境的包,应该以你从官方拉下来的snappy为准就好~
from srpc.
压缩这些库感觉某些场景也不太需要,以前是觉得库比较小、系统自带,不费事。
我今天晚点加一个编译选项,让srpc编译可选不需要压缩库,也许交叉编译这种场景可以方便一点。
from srpc.
太酷啦,点赞点赞。
from srpc.
还有个问题请教哈,我编译出来的./srpcserver,执行的时候为啥去找libsrpc.so.0,我理解为最终生成一个so即可,其他的so都是软连接的,所以我把libsrpc.so.0.10.0重命名为libsrpc.so应该可以,但是发现执行的时候还是去找libsrpc.so.0,不太明白。
error while loading shared libraries: libsrpc.so.0: cannot open shared object file: No such file or directory
from srpc.
是因为链接的时候,如果是采用动态链接,-lsrpc,系统会使用版本号标识不同的.so。可以通过ldd
命令查看到,实际上可执行文件是依赖的libsrpc.so.0,而不是libsrpc.so,所以你重命名了也不行。比如(不知道你的系统上有ldd脚本不):
[root@XXXX]# ldd srpc_pb_server
libsrpc.so.0 => /root/srpc/srpc_1412/_lib/libsrpc.so.0 (0x00007f1a4896e000)
libworkflow.so.0 => /root/srpc/srpc_1412/workflow/_lib/libworkflow.so.0 (0x00007f1a488bb000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f1a48892000)
libssl.so.1.1 => /lib64/libssl.so.1.1 (0x00007f1a485fe000)
libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x00007f1a48110000)
libprotobuf.so.23 => /usr/local/lib/libprotobuf.so.23 (0x00007f1a47e72000)
libz.so.1 => /lib64/libz.so.1 (0x00007f1a47e58000)
...
解决办法有两个:
- 链接时不要用
-lsrpc
,而是指定名字libsrpc.so
,记得加上-L指定路径 - 使用静态连接,比如在cmake文件中加
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a" ${CMAKE_FIND_LIBRARY_SUFFIXES})
试试看
from srpc.
Related Issues (20)
- Thrift 多参数支持 HOT 2
- Thrift Union 支持 HOT 4
- srpc 编译错误 HOT 2
- srpc在C++20的编译问题 HOT 3
- SRPC可以直接使用Consul的服务注册与发现
- srpc 在编译tutorial的报错 HOT 2
- Windows环境内存增涨问题 HOT 19
- 希望可以增加websocket的支持 HOT 1
- 支持UNIX Domain socket吗? HOT 6
- client端访问status code 103 HOT 1
- vs找不到unistd.h文件 HOT 5
- 关于压缩的问题 HOT 2
- problem HOT 29
- New versions of GTest use C++14 HOT 8
- Have Conan package? HOT 1
- crt detected that the application wrote to memory after end of heap buffer HOT 4
- 🎉 srpc tools: simple generator for building Workflow and SRPC projects
- cross compile problem HOT 12
- srpc_generator.exe无法使用 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from srpc.