Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to make on ubuntu 17.04 #19

Open
javapriyan opened this issue Oct 21, 2017 · 11 comments
Open

unable to make on ubuntu 17.04 #19

javapriyan opened this issue Oct 21, 2017 · 11 comments

Comments

@javapriyan
Copy link

javapriyan commented Oct 21, 2017

Having this error while making,

root@kumaran:~/grpc-c/build# make make all-recursive make[1]: Entering directory '/root/grpc-c/build' Making all in compiler make[2]: Entering directory '/root/grpc-c/build/compiler' depbase=echo ../third_party/protobuf-c/protoc-c/c_bytes_field.o | sed 's|[^/]*$|.deps/&|;s|.o$||';\ g++ -DHAVE_CONFIG_H -I. -I../../compiler -I.. -I../../compiler -I../../compiler/../third_party/protobuf-c -I../../compiler/../third_party/protobuf-c/protobuf-c -g -O2 -MT ../third_party/protobuf-c/protoc-c/c_bytes_field.o -MD -MP -MF $depbase.Tpo -c -o ../third_party/protobuf-c/protoc-c/c_bytes_field.o ../../compiler/../third_party/protobuf-c/protoc-c/c_bytes_field.cc &&\ mv -f $depbase.Tpo $depbase.Po In file included from ../../compiler/../third_party/protobuf-c/protoc-c/c_bytes_field.cc:63:0: ../../compiler/../third_party/protobuf-c/protoc-c/c_bytes_field.h:89:3: error: ‘map’ does not name a type map<string, string> variables_; ^~~ ../../compiler/../third_party/protobuf-c/protoc-c/c_bytes_field.cc:77:25: error: ‘map’ has not been declared map<string, string>* variables) { ^~~ ../../compiler/../third_party/protobuf-c/protoc-c/c_bytes_field.cc:77:28: error: expected ‘,’ or ‘...’ before ‘<’ token map<string, string>* variables) { ^ ../../compiler/../third_party/protobuf-c/protoc-c/c_bytes_field.cc: In function ‘void google::protobuf::compiler::c::SetBytesVariables(const google::protobuf::FieldDescriptor*, int)’: ../../compiler/../third_party/protobuf-c/protoc-c/c_bytes_field.cc:78:5: error: ‘variables’ was not declared in this scope (*variables)["name"] = FieldName(descriptor); ^~~~~~~~~ ../../compiler/../third_party/protobuf-c/protoc-c/c_bytes_field.cc: In constructor ‘google::protobuf::compiler::c::BytesFieldGenerator::BytesFieldGenerator(const google::protobuf::FieldDescriptor*)’: ../../compiler/../third_party/protobuf-c/protoc-c/c_bytes_field.cc:89:34: error: ‘variables_’ was not declared in this scope SetBytesVariables(descriptor, &variables_); ^~~~~~~~~~ ../../compiler/../third_party/protobuf-c/protoc-c/c_bytes_field.cc: In member function ‘virtual void google::protobuf::compiler::c::BytesFieldGenerator::GenerateStructMembers(google::protobuf::io::Printer*) const’: ../../compiler/../third_party/protobuf-c/protoc-c/c_bytes_field.cc:101:22: error: ‘variables_’ was not declared in this scope printer->Print(variables_, "ProtobufCBinaryData $name$$deprecated$;\n"); ^~~~~~~~~~ ../../compiler/../third_party/protobuf-c/protoc-c/c_bytes_field.cc: In member function ‘virtual void google::protobuf::compiler::c::BytesFieldGenerator::GenerateStaticInit(google::protobuf::io::Printer*) const’: ../../compiler/../third_party/protobuf-c/protoc-c/c_bytes_field.cc:142:22: error: ‘variables_’ was not declared in this scope printer->Print(variables_, "$default_value$"); ^~~~~~~~~~ Makefile:519: recipe for target '../third_party/protobuf-c/protoc-c/c_bytes_field.o' failed make[2]: *** [../third_party/protobuf-c/protoc-c/c_bytes_field.o] Error 1 make[2]: Leaving directory '/root/grpc-c/build/compiler' Makefile:464: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/root/grpc-c/build' Makefile:375: recipe for target 'all' failed make: *** [all] Error 2

And tried to resolve with this solution. The errors are repeated for other components like set and queue and so on. The same is reproducible for mint versions as well. I bet in other evn too.

@ajhai
Copy link
Contributor

ajhai commented Oct 22, 2017

"error: ‘map’ does not name a type" Do you have build essentials installed? Can you build https://github.com/protobuf-c/protobuf-c project and see if that goes through fine?

@javapriyan
Copy link
Author

@ajhai protobuf-c is already installed and able to do the example snippet compilation. i.e, protoc --c_out=. example.proto What I am trying to achieve is building a c based server stram application.

@guru-florida
Copy link

I took a look and that is a legitimate error. That header file includes and declares a variable "variables_" of type map...which it should be std::map. So it's a legitimate bug IMO. Its possible for the developer that header includes somewhere in the chain have a "using namespace std;" in which case the map without std:: prefix would work...but that would be bad form. Dont use "using namespace ..." in headers (impl files are fine). Reason being that it imports the entire std:: namespace into global namespace, can then cause naming conflicts, it's affect is viral to all code that includes that evil header, and negates the whole reason for using namespaces. My suggestion would be to fork that project and fix up those issues by adding std:: to the front of map. Then send the original developer a pull request after you have it working.

@javapriyan
Copy link
Author

@guru-florida Thanks for looking into it. Like I said, the namespace issue keeps growing for other components like sets, queue and so on. So I thought I was missing something. So were you able to compile this in other environments?

@javapriyan
Copy link
Author

javapriyan commented Oct 24, 2017

I found these are already addressed in the parent protobuf-c so updated the submodule by pulling from the master for the submodule. Now I am having this issue. @ajhai Anything that I missed here ?

make all-recursive make[1]: Entering directory '/home/kumaran/grpc-c/build' Making all in compiler make[2]: Entering directory '/home/kumaran/grpc-c/build/compiler' make[2]: Nothing to be done for 'all'. make[2]: Leaving directory '/home/kumaran/grpc-c/build/compiler' Making all in lib make[2]: Entering directory '/home/kumaran/grpc-c/build/lib' depbase=`echo client.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ /bin/bash ../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../lib -I.. -I../../lib -I../../lib/h -I../../lib/../third_party/protobuf-c -g -O2 -MT client.lo -MD -MP -MF $depbase.Tpo -c -o client.lo ../../lib/client.c &&\ mv -f $depbase.Tpo $depbase.Plo libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../../lib -I.. -I../../lib -I../../lib/h -I../../lib/../third_party/protobuf-c -g -O2 -MT client.lo -MD -MP -MF .deps/client.Tpo -c ../../lib/client.c -fPIC -DPIC -o .libs/client.o ../../lib/client.c: In function ‘gc_client_create_by_host’: ../../lib/client.c:82:43: error: too few arguments to function ‘grpc_completion_queue_create’ client->gcc_channel_connectivity_cq = grpc_completion_queue_create(NULL); ^ In file included from ../../lib/h/grpc-c/grpc-c.h:14:0, from ../../lib/client.c:6: /usr/local/include/grpc/grpc.h:98:32: note: declared here GRPCAPI grpc_completion_queue *grpc_completion_queue_create( ^ ../../lib/client.c: In function ‘gc_client_prepare_async_ops’: ../../lib/client.c:579:23: error: too few arguments to function ‘grpc_completion_queue_create’ context->gcc_cq = grpc_completion_queue_create(NULL); ^ In file included from ../../lib/h/grpc-c/grpc-c.h:14:0, from ../../lib/client.c:6: /usr/local/include/grpc/grpc.h:98:32: note: declared here GRPCAPI grpc_completion_queue *grpc_completion_queue_create( ^ ../../lib/client.c: In function ‘gc_client_prepare_sync_ops’: ../../lib/client.c:744:23: error: too few arguments to function ‘grpc_completion_queue_create’ context->gcc_cq = grpc_completion_queue_create(NULL); ^ In file included from ../../lib/h/grpc-c/grpc-c.h:14:0, from ../../lib/client.c:6: /usr/local/include/grpc/grpc.h:98:32: note: declared here GRPCAPI grpc_completion_queue *grpc_completion_queue_create( ^ ../../lib/client.c: In function ‘gc_client_prepare_unary_ops’: ../../lib/client.c:874:23: error: too few arguments to function ‘grpc_completion_queue_create’ context->gcc_cq = grpc_completion_queue_create(NULL); ^ In file included from ../../lib/h/grpc-c/grpc-c.h:14:0, from ../../lib/client.c:6: /usr/local/include/grpc/grpc.h:98:32: note: declared here GRPCAPI grpc_completion_queue *grpc_completion_queue_create( ^ Makefile:482: recipe for target 'client.lo' failed make[2]: *** [client.lo] Error 1 make[2]: Leaving directory '/home/kumaran/grpc-c/build/lib' Makefile:464: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/home/kumaran/grpc-c/build' Makefile:375: recipe for target 'all' failed make: *** [all] Error 2

@ajhai
Copy link
Contributor

ajhai commented Oct 24, 2017

@javapriyan Thanks for identifying protobuf-c updates. I will pull and update submodule. This all seems to be working fine in my vagrant which is Ubuntu 16.04. For the issues that you are seeing now, what is the version of gRPC you have installed? Latest master of grpc-c will work with gRPC v1.3.0

@javapriyan
Copy link
Author

@ajhai It was 1.6 I guess. To be precise used this https://github.com/grpc/grpc/blob/v1.6.x/INSTALL.md Let me try downgrade this to 1.3 once.

@javapriyan
Copy link
Author

After degrading, I have got this error. I know I am making some noice here but would really love to get this up and running.

In file included from /usr/include/string.h:630:0, from ../../lib/common/strextra.h:16, from ../../lib/stream_ops.c:6: ../../lib/common/strextra.h:88:7: error: expected identifier or ‘(’ before ‘__extension__’ char *strndup (const char *str, size_t count); ^ Makefile:482: recipe for target 'stream_ops.lo' failed make[2]: *** [stream_ops.lo] Error 1 make[2]: Leaving directory '/home/kumaran/grpc-c/build/lib' Makefile:464: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/home/kumaran/grpc-c/build' Makefile:375: recipe for target 'all' failed make: *** [all] Error 2

@ajhai
Copy link
Contributor

ajhai commented Oct 24, 2017

Looks like some issue with strndup definition. Other projects also seem to have hit similar issue. Can you check what is the generated value of HAVE_STRNDUP ? Can you paste your configure output? If you want to get it up and running quick, can you try this on a vagrant with 16.04? Use protobuf 3.0 and gRPCv1.3. I suspect the initial error could be because of running latest protobuf. What is the version of protobuf you have installed?

@mattrichards
Copy link

I fixed the error: expected identifier or ‘(’ before ‘__extension__’ error by #including "config.h" in lib/stream_ops.c.

--- a/lib/stream_ops.c
+++ b/lib/stream_ops.c
@@ -3,6 +3,7 @@
  * All rights reserved.
  */
 
+#include "config.h"
 #include "common/strextra.h"
 #include "stream_ops.h"

@wxj520wzm
Copy link

@javapriyan Do you have solve the compile problem? How to solve?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants