nfultz / grpc

gRPC clients and servers in R
72 stars 24 forks source link

Cannot get the demo working #37

Open husafan opened 2 years ago

husafan commented 2 years ago

I've set up a Docker container running Ubuntu 21. I've followed the instructions under installation to make sure the necessary package dependencies are installed and that grpc is available. I then clone the repository, CD into the base directory and run R -e 'demo("helloserver", "grpc")'. I see:

root@dbf97d90098c:/tmp/grpc# R -e 'demo("helloserver", "grpc")'

R version 4.1.1 (2021-08-10) -- "Kick Things"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> demo("helloserver", "grpc")
Error in find.package(package, lib.loc, verbose = verbose) : 
  there is no package called 'grpc'
Calls: demo -> find.package
Execution halted
nfultz commented 2 years ago

It looks like you didn't build and install the package?

there is no package called 'grpc'

husafan commented 2 years ago

Thank you you very much for replying. You were absolutely right. Please forgive my newness to R. I got further last night by installing the devtools package and then running install_local("/tmp/grpc"). However, now I am seeing the following error:

g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I'/usr/local/lib/R/site-library/Rcpp/include'   `pkg-config --cfl
ags grpc` -fpic  -g -O2 -ffile-prefix-map=/build/r-base-kbcSEe/r-base-4.1.1=. -flto=auto -ffat-lto-objects -fstack-pro
tector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c RcppExports.cpp -o RcppExports.og++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG  -I'/usr/local/lib/R/site-library/Rcpp/include'   `pkg-config --cflags grpc` -fpic  -g -O2 -ffile-prefix-map=/build/r-base-kbcSEe/r-base-4.1.1=. -flto=auto -ffat-lto-objects -fstack-pro
tector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c client.cpp -o client.o
client.cpp: In function 'Rcpp::RawVector fetch(Rcpp::CharacterVector, Rcpp::CharacterVector, Rcpp::RawVector, Rcpp::Ch
aracterVector)':                                                                                                      client.cpp:76:47: error: no match for 'operator=' (operand types are 'grpc_metadata' and '<brace-enclosed initializer list>')                                                                                                                  76 |         {{nullptr, nullptr, nullptr, nullptr}}};
      |                                               ^
In file included from /.grpc/include/grpc/impl/codegen/byte_buffer.h:26,
                 from /.grpc/include/grpc/byte_buffer.h:24,                                                                            from /.grpc/include/grpc/grpc.h:26,                                                                                   from client.cpp:2:                                                                                   /.grpc/include/grpc/impl/codegen/grpc_types.h:533:16: note: candidate: 'grpc_metadata& grpc_metadata::operator=(const 
grpc_metadata&)'                                           
  533 | typedef struct grpc_metadata {
      |                ^~~~~~~~~~~~~
/.grpc/include/grpc/impl/codegen/grpc_types.h:533:16: note:   no known conversion for argument 1 from '<brace-enclosed
 initializer list>' to 'const grpc_metadata&'
/.grpc/include/grpc/impl/codegen/grpc_types.h:533:16: note: candidate: 'grpc_metadata& grpc_metadata::operator=(grpc_m
etadata&&)'
/.grpc/include/grpc/impl/codegen/grpc_types.h:533:16: note:   no known conversion for argument 1 from '<brace-enclosed
 initializer list>' to 'grpc_metadata&&'
make: *** [/usr/lib/R/etc/Makeconf:177: client.o] Error 1
ERROR: compilation failed for package 'grpc'
* removing '/usr/local/lib/R/site-library/grpc'

Any idea what that's about? Thanks again for your time and help.

nfultz commented 2 years ago

The error message you posted is at this line:

https://github.com/nfultz/grpc/blob/8306bf8158ace0e66d6c8a3b7132e313116ef573/src/client.cpp#L76

I suspect you are using a more recent version of GRPC from google, and maybe something in the header slightly changed. If you make the line match the version you installed, it ought to build, or it may reveal some other related issues. Please dosubmit a PR if you get it working.