Comments (3)
构建 helloworld
If your project is using cmake, there are several ways to add gRPC dependency.
-
install gRPC via cmake first and then locate it with find_package(gRPC CONFIG).
这种方式依赖 build grpc,后两者其实并不需要。构建失败(github 似乎已经解决 这个问题 了,为什么我还会遇到?)
CMake Error at E:/gRPC/grpc/180622/lib/cmake/grpc/gRPCConfig.cmake:8 (include): include could not find load file: E:/gRPC/grpc/180622/lib/cmake/grpc/gRPCTargets.cmake
结合上述 issue 的详细内容,估计还是得用 run_distrib_test_cmake.bat 构建 grpc 才行,如此也就和上一评论中 build grpc 无关了
-
via cmake's ExternalProject_Add using a technique called "superbuild".
成功了。因为是把 grpc 作为外部项目又编了一次,所以时间很长
-
add gRPC source tree to your project (preferrably as a git submodule) and add it to your cmake project with add_subdirectory.
成功了。因为是把 grpc 作为子项目又编了一次,所以时间也很长。从其 CMakeLists.txt 注释文字中,可以发现官方肯定此种方式足够简单易用,但也存在明显缺点,其实是不太推荐的。
from quote-demo.
构建 Secure helloworld
debug 模式正确执行;release 模式启动 server 之后运行 client 报错:
E0625 16:35:08.313000000 2260 resolver_registry.cc:80] don't know how to resolve 'localhost:50051' or 'dns:///localhost:50051'
E0625 16:35:08.316000000 2260 resolver_registry.cc:80] don't know how to resolve 'dns:///localhost:50051' or 'dns:///dns:///localhost:50051'
E0625 16:35:08.318000000 2260 channel.cc:95] channel stack builder failed: {"created":"@1529915708.318000000","description":"resolver creation failed","file":"E:\gRPC\grpc\src\core\ext\filters\client_channel\client_channel.cc","file_line":695}
2: lame client channel
Greeter received: RPC failed
release 模式的 client 为什么会出现上述问题? #14
今天突然 Debug 模式的 client 也出现上述问题……
错误的尝试 #13
-
虽然删除上述截图指出的库文件也能编译通过,但运行会报错……
-
Release 模式:将 client 项目静态库位置调整如上,重新生成(一定要重新生成才可以);server 项目不更改。通信成功。 -
Debug 模式:将 client 项目静态库位置调整如上,重新生成;server 项目不更改。不再出现上述问题,但依旧无法连接,client 报错 & server 报错如下。PS E:\gRPC\grpc\examples\cpp\secure\sln1\Debug> .\greeter_secure_client.exe 2: Stream removed Greeter received: RPC failed PS E:\gRPC\grpc\examples\cpp\secure\sln1\Debug>
Server listening on localhost:50051 E0626 16:25:06.040000000 11728 ssl_transport_security.cc:1227] Handshake failed with fatal error SSL_ERROR_SSL: error:1408F10B:SSL routines:ssl3_get_record:wrong version number. ——后来向赵哥请教,说这个错误在 server/client 单方面未使用 ssl 认证时会出现
-
Debug 模式:同时将 client server 项目静态库位置调整如上,重新生成。通信成功。
上述调整静态库顺序是莫名其妙使 ssl 认证失效 ,证据有二:
- 当 server/client 单方面更换证书时,通信成功;
- 当 server/client 单方面取消 ssl 认证代码时,通信成功;
ps 可能 release 版本不调整 grpc_unsecure.lib
时 ssl 认证也是失效的
更合适的表述是,引入 grpc_unsecure.lib
可能使 ssl 认证失效,这种失效既不会表现在编译失败,也不会在运行时抛出有效的错误提示
from quote-demo.
即便代码如下:
//client
stub_ = Greeter::NewStub(grpc::CreateChannel(
server, /*grpc::SslCredentials(opts)*/ grpc::InsecureChannelCredentials()));
grpc_unsecure.lib 的位置依旧会影响结果! **吧这是
关于此条目,详细讨论见 #13
from quote-demo.
Related Issues (18)
- 合并 testinstall[d] 两个目录
- 合并 debug & release
- 将 grpc 作为第三方库纳入项目管理
- 文件包含不能在当前代码页(936)中表示的字符 HOT 5
- 依赖路径未同步修改
- powershell 和 cmd
- 析构函数是可以显式调用的 HOT 4
- crlf 或者 lf 格式源生成的文件是完全相同的吧?
- 学习 add_subdirectory 以及 ExternalProject_Add
- node.js 的例子并不是都能跑通
- client 增加 Credentials plugin,server 怎么处理?
- 依赖库,他妈怎么回事? HOT 7
- 为什么会出现 C2 错误?
- grpc_unsecure.lib 和 ${_GRPC_GRPCPP_UNSECURE} 并不相同
- 有且仅有一个虚函数的基类是否都应该用 std::function<> 替换?
- Observer 观察者模式的具体实现,运行不起来吧?
- 主动对象,是什么概念?
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 quote-demo.