grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.65k stars 764 forks source link

Problem compiling on ARM with gcc 6.1.1 #19

Closed lucalenardi closed 7 years ago

lucalenardi commented 8 years ago

Hello!

We've got some issues while compiling on ARM (Cortex A8).

The problem is related to some debugging macro with printf and wrong type. Related files are nginx_notify_queue.cc and nginx_http_frontend.cc

This is the error report:

cc -c -pipe  -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I /usr/local/include -I /opt/grpc-web -I /opt/grpc-web/third_party/protobuf/src -I /opt/grpc-web/third_party/grpc/include -std=c++11  -I src/core -I src/event -I src/event/modules -I src/os/unix -I /opt/grpc-web/third_party/openssl/.openssl/include -I ./objs -I src/http -I src/http/modules -I src/http/v2 \
        -o ./objs/addon/runtime/nginx_notify_queue.o \
        /opt/grpc-web/net/grpc/gateway/runtime/nginx_notify_queue.cc
In file included from /opt/grpc-web/net/grpc/gateway/runtime/nginx_notify_queue.cc:8:0:
/opt/grpc-web/net/grpc/gateway/runtime/nginx_notify_queue.cc: In member function ‘void grpc::gateway::NginxNotifyQueue::Add(std::unique_ptr<grpc::gateway::Tag>)’:
/opt/grpc-web/net/grpc/gateway/log.h:33:48: error: format ‘%li’ expects argument of type ‘long int’, but argument 5 has type ‘ngx_int_t {aka int}’ [-Werror=format=]
 #define ERROR_1(f, v1) gpr_log(GPR_ERROR, f, v1);
                                                ^
/opt/grpc-web/net/grpc/gateway/log.h:37:50: note: in definition of macro ‘ERROR_X’
 #define ERROR_X(x, f, v1, v2, v3, v4, func, ...) func
                                                  ^~~~
/opt/grpc-web/net/grpc/gateway/log.h:42:29: note: in expansion of macro ‘ERROR_1’
                             ERROR_1(f, __VA_ARGS__), \
                             ^~~~~~~
/opt/grpc-web/net/grpc/gateway/runtime/nginx_notify_queue.cc:42:5: note: in expansion of macro ‘ERROR’
     ERROR("ngx_notify failed, rc = %li", rc);
     ^~~~~

We fixed it here: https://goo.gl/Zn4OZt Maybe this is due to the compiler version; I hope it helps.

Thanks!

fengli79 commented 8 years ago

Thanks, this info does help, it's a portability issue, will be fixed soon. However, we haven't test it on derbin/arm. Could you tell us why you want an arm build? It's probably worth discussing to add a new docker image to support it.

fengli79 commented 8 years ago

https://github.com/grpc/grpc-web/pull/20

lucalenardi commented 7 years ago

Hello, thanks for the answers.

We are working on embedded linux platforms, using gRPC to interact – via web based interfaces, hence grpc-web – with remote devices.

The idea to have a new docker image for ARM is very appealing, how would you proceed with that? Do you need any help?

fengli79 commented 7 years ago

Enhance the build script and add debian support. Please give a try to see if it compiles on ARM.

faddat commented 7 years ago

I can put together an ARM image for Docker.

lucalenardi commented 7 years ago

It compiles now, nginx starts but it crashes as soon as a grpc call comes in. See #42

fengli79 commented 7 years ago

Fix merged.