nfultz / grpc

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

Compilation error #19

Closed doncwilliam closed 6 years ago

doncwilliam commented 6 years ago

I am using Ubuntu 16.04, and R 3.4.4.

I tried to follow the installation instruction (https://github.com/nfultz/grpc/blob/master/install) with no problem.

I also try to install the R package following (https://github.com/nfultz/grpc/issues/18)

R CMD build grpc/
R -e "install.packages(dir(pattern = 'grpc.*.tar.gz'), repos=NULL)"

However, during compilation, I get the following error. Do you know how I may solve the problem?

> install.packages(dir(pattern = 'grpc.*.tar.gz'), repos=NULL)
Installing package into ‘/home/don/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
* installing *source* package ‘grpc’ ...
** libs
g++  -I/usr/share/R/include -DNDEBUG  -I"/home/don/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include"   `pkg-config --cflags grpc` -fpic  -g 
-O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c RcppExports.cpp -o RcppExports.o
g++  -I/usr/share/R/include -DNDEBUG  -I"/home/don/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include"   `pkg-config --cflags grpc` -fpic  -g 
-O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c client.cpp -o client.o
client.cpp:13:23: error: ‘grpc_slice’ was not declared in this scope
 RawVector sliceToRaw2(grpc_slice slice){
                       ^
client.cpp:13:40: error: expected ‘,’ or ‘;’ before ‘{’ token
 RawVector sliceToRaw2(grpc_slice slice){
                                        ^
client.cpp: In function ‘Rcpp::RawVector fetch(Rcpp::CharacterVector, Rcpp::CharacterVector, Rcpp::RawVector)’:

                                        ^                                                                                          
client.cpp: In function ‘Rcpp::RawVector fetch(Rcpp::CharacterVector, Rcpp::CharacterVector, Rcpp::RawVector)’:
client.cpp:42:73: error: ‘grpc_completion_queue_create_for_next’ was not declared in this scope
   grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL);
                                                                         ^
client.cpp:44:9: error: ‘grpc_slice’ does not name a type
   const grpc_slice server_slice = grpc_slice_from_copied_string(server[0]);
         ^
client.cpp:45:9: error: ‘grpc_slice’ does not name a type
   const grpc_slice method_slice = grpc_slice_from_copied_string(method[0]);
         ^
client.cpp:49:3: error: ‘grpc_slice’ was not declared in this scope
   grpc_slice request_payload_slice = grpc_slice_from_copied_buffer((char*) RAW(raw_), len);
   ^
client.cpp:52:9: error: ‘grpc_slice’ does not name a type
   const grpc_slice *sp = &server_slice;
         ^
client.cpp:61:5: error: ‘method_slice’ was not declared in this scope
     method_slice, //grpc_slice_from_static_string("/foo"),
     ^
client.cpp:62:5: error: ‘sp’ was not declared in this scope
     sp, 
     ^
client.cpp:79:14: error: expected ‘;’ before ‘details’
   grpc_slice details;
              ^
client.cpp:91:34: error: ‘request_payload_slice’ was not declared in this scope
     grpc_raw_byte_buffer_create(&request_payload_slice, 1);
                                  ^
client.cpp:97:34: error: ‘struct grpc_op::<anonymous union>::<anonymous>’ has no member named ‘maybe_compression_level’
   op->data.send_initial_metadata.maybe_compression_level.is_set = false;
                                  ^
client.cpp:102:25: error: request for member ‘send_message’ in ‘op->grpc_op::data.grpc_op::<anonymous union>::send_message’, which is of poi
nter type ‘grpc_byte_buffer*’ (maybe you meant to use ‘->’ ?)
client.cpp:102:25: error: request for member ‘send_message’ in ‘op->grpc_op::data.grpc_op::<anonymous union>::send_message’, which is of pointer type ‘grpc_byte_buffer*’ (maybe you meant to use ‘->’ ?)
   op->data.send_message.send_message = request_payload;
                         ^
client.cpp:111:34: error: request for member ‘recv_initial_metadata’ in ‘op->grpc_op::data.grpc_op::<anonymous union>::recv_initial_metadata
’, which is of pointer type ‘grpc_metadata_array*’ (maybe you meant to use ‘->’ ?)
   op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv;
                                  ^
client.cpp:116:25: error: request for member ‘recv_message’ in ‘op->grpc_op::data.grpc_op::<anonymous union>::recv_message’, which is of non
-class type ‘grpc_byte_buffer**’
   op->data.recv_message.recv_message = &response_payload_recv;
                         ^
client.cpp:123:52: error: ‘details’ was not declared in this scope
   op->data.recv_status_on_client.status_details = &details;
                                                    ^
client.cpp:150:14: error: expected ‘;’ before ‘response_payload_slice’
   grpc_slice response_payload_slice = grpc_byte_buffer_reader_readall(&bbr);
              ^
client.cpp:151:48: error: ‘response_payload_slice’ was not declared in this scope
   RawVector response_payload_raw = sliceToRaw2(response_payload_slice);
                                                ^
client.cpp:165:27: error: ‘grpc_slice_unref’ was not declared in this scope
   grpc_slice_unref(details);
                           ^
/usr/lib/R/etc/Makeconf:168: recipe for target 'client.o' failed
make: *** [client.o] Error 1
ERROR: compilation failed for package ‘grpc’
* removing ‘/home/don/R/x86_64-pc-linux-gnu-library/3.4/grpc’
Warning message:
In install.packages(dir(pattern = "grpc.*.tar.gz"), repos = NULL) :
  installation of package ‘grpc_0.1.0.tar.gz’ had non-zero exit status
> 

Thank you! Don

nfultz commented 6 years ago

Based on

client.cpp:13:23: error: ‘grpc_slice’ was not declared in this scope

Maybe you don't have the grpc library available?

nfultz commented 6 years ago

You might also check the Docker files for alternative build instructions, they are somewhat more current.

doncwilliam commented 6 years ago

Thank you for your help!

nfultz commented 6 years ago

What did you do to fix it? I could update the instructions.