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

Troubles getting started on OS X 10.11.6 (El Capitan) #7

Closed
adrienjoly opened this issue Oct 28, 2016 · 20 comments
Closed

Troubles getting started on OS X 10.11.6 (El Capitan) #7

adrienjoly opened this issue Oct 28, 2016 · 20 comments
Assignees

Comments

@adrienjoly
Copy link

Hi guys,

I spent some time trying to run the examples on my Mac, but ended up quitting after getting too many errors.

I'm sharing a history of what I tried to do, and what I got.

$ git clone https://github.com/grpc/grpc-web

$ cd grpc-web

$ ./build.sh 
ERRO[0001] Can't add file /Users/adrienjoly/dev/github/grpc-web/.git/index to tar: io: read/write on closed pipe 
ERRO[0001] Can't close tar writer: io: read/write on closed pipe 
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

$ ./ubuntu_14_04.sh 
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

$ ./init_submodules.sh 

$ make
protoc: command not found

$ brew install --devel protobuf

$ make
checking for --with-ld-opt="-L /usr/local/lib -lgrpc++ -lgrpc -lprotobuf -lpthread -lstdc++ -lm" ... not found
auto/configure: error: the invalid value in --with-ld-opt="-L /usr/local/lib -lgrpc++ -lgrpc -lprotobuf -lpthread -lstdc++ -lm"

$ cd third_party/grpc && git submodule update --init && EMBED_OPENSSL=false make
json_token.h:38:10: fatal error: 'openssl/rsa.h' file not found

$ brew update

$ brew upgrade openssl
==> Pouring openssl-1.0.2j.el_capitan.bottle.tar.gz

This formula is keg-only, which means it was not symlinked into /usr/local.

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include
    PKG_CONFIG_PATH: /usr/local/opt/openssl/lib/pkgconfig

$ cd third_party/grpc/

$ export EXTRA_CFLAGS=-I/usr/local/opt/openssl/include && export EXTRA_CXXFLAGS=-I/usr/local/opt/openssl/include & export EXTRA_LDFLAGS=-L/usr/local/opt/openssl/lib & make
Package zlib was not found in the pkg-config search path

$ export PKG_CONFIG_PATH=/anaconda/lib/pkgconfig && export EXTRA_CFLAGS=-I/usr/local/opt/openssl/include && export EXTRA_CXXFLAGS=-I/usr/local/opt/openssl/include && export EXTRA_LDFLAGS=-L/usr/local/opt/openssl/lib && make
[MAKE]    Generating cache.mk
[CXX]     Compiling src/cpp/ext/reflection.pb.cc
In file included from src/cpp/ext/reflection.pb.cc:47:
/usr/local/Cellar/protobuf/3.0.0-beta-4/include/google/protobuf/wire_format_lite_inl.h:352:17: error: comparison of integers of different signs:
      'const uint32' (aka 'const unsigned int') and 'int' [-Werror,-Wsign-compare]
  if (new_bytes != length) return false;
      ~~~~~~~~~ ^  ~~~~~~
/usr/local/Cellar/protobuf/3.0.0-beta-4/include/google/protobuf/wire_format_lite_inl.h:415:1: note: in instantiation of function template
      specialization 'google::protobuf::internal::WireFormatLite::ReadPackedFixedSizePrimitive<unsigned int,
      google::protobuf::internal::WireFormatLite::FieldType::TYPE_FIXED32>' requested here
READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(uint32, TYPE_FIXED32)
^

That's just a sample of all the error I got.

At that point, I decided to call it a day.

Hope this helps you in any way.

Cheers!

@paralin
Copy link
Collaborator

paralin commented Oct 28, 2016

Install docker in Mac and try it again, should work for sure

@adrienjoly
Copy link
Author

I believe that docker is installed on my Mac.

$ docker
Usage: docker [OPTIONS] COMMAND [arg...]
       docker [ --help | -v | --version ]

A self-sufficient runtime for containers.

@mark-grimes
Copy link
Contributor

Is the docker virtual machine running and visible? Try something like

docker-machine start default
eval `docker-machine env default`
docker ps

If you get any errors from that then docker is not setup correctly.

@fengli79
Copy link
Collaborator

fengli79 commented Nov 3, 2016

You don't need docker to build on mac. Docker is used as container to build for different linux.
Here's the steps:

  1. install brew
  2. brew install pcre
  3. ./init_submodules.sh
  4. export KERNEL_BITS=64
  5. make

@fengli79
Copy link
Collaborator

fengli79 commented Nov 4, 2016

Updated the README.md with build instructions.

@fengli79 fengli79 closed this as completed Nov 4, 2016
@adrienjoly
Copy link
Author

Thanks @fengli79, but I got another error while trying your solution.

Here is my complete log:

github$ git clone https://github.com/grpc/grpc-web

Cloning into 'grpc-web'...
remote: Counting objects: 172, done.
remote: Total 172 (delta 0), reused 0 (delta 0), pack-reused 172
Receiving objects: 100% (172/172), 68.46 KiB | 0 bytes/s, done.
Resolving deltas: 100% (39/39), done.
Checking connectivity... done.

github$ cd grpc-web

grpc-web$ ./init_submodules.sh

Submodule 'third_party/closure-library' (https://github.com/google/closure-library.git) registered for path 'third_party/closure-library'
Submodule 'third_party/grpc' (https://github.com/grpc/grpc.git) registered for path 'third_party/grpc'
Submodule 'third_party/nginx/src' (https://nginx.googlesource.com/nginx) registered for path 'third_party/nginx/src'
Submodule 'third_party/openssl' (https://github.com/openssl/openssl.git) registered for path 'third_party/openssl'
Submodule 'third_party/protobuf' (https://github.com/google/protobuf.git) registered for path 'third_party/protobuf'
Cloning into 'third_party/closure-library'...
remote: Counting objects: 93224, done.
remote: Compressing objects: 100% (99/99), done.
remote: Total 93224 (delta 41), reused 0 (delta 0), pack-reused 93125
Receiving objects: 100% (93224/93224), 74.82 MiB | 783.00 KiB/s, done.
Resolving deltas: 100% (74711/74711), done.
Checking connectivity... done.
Submodule path 'third_party/closure-library': checked out 'effb4062e34576a011e788a0d33c1433a677f940'
Cloning into 'third_party/grpc'...
remote: Counting objects: 219985, done.
remote: Compressing objects: 100% (73/73), done.
remote: Total 219985 (delta 30), reused 0 (delta 0), pack-reused 219909
Receiving objects: 100% (219985/219985), 89.11 MiB | 1.31 MiB/s, done.
Resolving deltas: 100% (166212/166212), done.
Checking connectivity... done.
Submodule path 'third_party/grpc': checked out '6040b471bcd1d6bb05b25c126b6545180a1d3528'
Cloning into 'third_party/nginx/src'...
remote: Sending approximately 47.85 MiB ...
remote: Counting objects: 503, done
remote: Finding sources: 100% (17/17)
remote: Total 53998 (delta 43836), reused 53996 (delta 43836)
Receiving objects: 100% (53998/53998), 47.86 MiB | 1.40 MiB/s, done.
Resolving deltas: 100% (43836/43836), done.
Checking connectivity... done.
Submodule path 'third_party/nginx/src': checked out '2a881edaa3e60c9392e90efe9f6bfc25024e6e3c'
Cloning into 'third_party/openssl'...
remote: Counting objects: 223046, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 223046 (delta 0), reused 0 (delta 0), pack-reused 223042
Receiving objects: 100% (223046/223046), 97.61 MiB | 1.39 MiB/s, done.
Resolving deltas: 100% (172242/172242), done.
Checking connectivity... done.
Submodule path 'third_party/openssl': checked out '5dd94f1847c744929a3bd24819f1c99644bb18c7'
Cloning into 'third_party/protobuf'...
remote: Counting objects: 38177, done.
remote: Compressing objects: 100% (50/50), done.
remote: Total 38177 (delta 18), reused 0 (delta 0), pack-reused 38118
Receiving objects: 100% (38177/38177), 35.22 MiB | 1.30 MiB/s, done.
Resolving deltas: 100% (25604/25604), done.
Checking connectivity... done.
Submodule path 'third_party/protobuf': checked out '1a586735085e817b1f52e53feec92ce418049f69'
HEAD is now at effb406... Add an equals method to goog.math.Coordinate and make the existing equals method on goog.math.Vec2 take '*' instead of another goog.math.Vec2.
HEAD is now at 5dd94f1... Prepare for 1.0.2h release
HEAD is now at 1a58673... Merge pull request #2077 from pherl/3.0.x
HEAD is now at 6040b47... Merge pull request #8543 from apolcyn/fix_ruby_plugin_build
Submodule 'third_party/boringssl' (https://github.com/google/boringssl.git) registered for path 'third_party/boringssl'
Submodule 'third_party/gflags' (https://github.com/gflags/gflags.git) registered for path 'third_party/gflags'
Submodule 'third_party/googletest' (https://github.com/google/googletest.git) registered for path 'third_party/googletest'
Submodule 'third_party/protobuf' (https://github.com/google/protobuf.git) registered for path 'third_party/protobuf'
Submodule 'third_party/zlib' (https://github.com/madler/zlib) registered for path 'third_party/zlib'
Cloning into 'third_party/boringssl'...
remote: Counting objects: 34143, done.
remote: Total 34143 (delta 0), reused 0 (delta 0), pack-reused 34143
Receiving objects: 100% (34143/34143), 23.41 MiB | 1.36 MiB/s, done.
Resolving deltas: 100% (23379/23379), done.
Checking connectivity... done.
Submodule path 'third_party/boringssl': checked out 'c880e42ba1c8032d4cdde2aba0541d8a9d9fa2e9'
Cloning into 'third_party/gflags'...
remote: Counting objects: 2045, done.
remote: Total 2045 (delta 0), reused 0 (delta 0), pack-reused 2045
Receiving objects: 100% (2045/2045), 1.38 MiB | 620.00 KiB/s, done.
Resolving deltas: 100% (1187/1187), done.
Checking connectivity... done.
Submodule path 'third_party/gflags': checked out '05b155ff59114735ec8cd089f669c4c3d8f59029'
Cloning into 'third_party/googletest'...
remote: Counting objects: 7422, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 7422 (delta 4), reused 0 (delta 0), pack-reused 7407
Receiving objects: 100% (7422/7422), 2.52 MiB | 1.14 MiB/s, done.
Resolving deltas: 100% (5512/5512), done.
Checking connectivity... done.
Submodule path 'third_party/googletest': checked out 'c99458533a9b4c743ed51537e25989ea55944908'
Cloning into 'third_party/protobuf'...
remote: Counting objects: 38177, done.
remote: Compressing objects: 100% (50/50), done.
remote: Total 38177 (delta 18), reused 0 (delta 0), pack-reused 38118
Receiving objects: 100% (38177/38177), 35.22 MiB | 1.30 MiB/s, done.
Resolving deltas: 100% (25604/25604), done.
Checking connectivity... done.
Submodule path 'third_party/protobuf': checked out '1a586735085e817b1f52e53feec92ce418049f69'
Cloning into 'third_party/zlib'...
remote: Counting objects: 4462, done.
remote: Total 4462 (delta 0), reused 0 (delta 0), pack-reused 4462
Receiving objects: 100% (4462/4462), 2.42 MiB | 354.00 KiB/s, done.
Resolving deltas: 100% (3101/3101), done.
Checking connectivity... done.
Submodule path 'third_party/zlib': checked out '50893291621658f355bc5b4d450a8d06a563053d'

grpc-web$ make

cd "/Users/adrienjoly/dev/github/grpc-web" && rm -rf objs gConnector gConnector_static \
third_party/nginx/src/objs third_party/openssl/.openssl
cd "/Users/adrienjoly/dev/github/grpc-web" && rm -f gConnector.zip gConnector_static.zip \
"/Users/adrienjoly/dev/github/grpc-web/net/grpc/gateway/protos"/*.pb.cc "/Users/adrienjoly/dev/github/grpc-web/net/grpc/gateway/protos"/*.pb.h \
third_party/nginx/src/Makefile
cd "/Users/adrienjoly/dev/github/grpc-web"/net/grpc/gateway/examples/echo && make clean
rm -f *.grpc.pb.cc *.grpc.pb.h *.grpc.pb.o *.pb.cc *.pb.h *.pb.o \
  echo_server echo_server.o compiled.js
rm -rf ./out
cd "/Users/adrienjoly/dev/github/grpc-web"/javascript/net/grpc/web && make clean
rm -f *.o protoc-gen-grpc-web
cd "/Users/adrienjoly/dev/github/grpc-web"
cd /Users/adrienjoly/dev/github/grpc-web && /Users/adrienjoly/dev/github/grpc-web/third_party/protobuf/src/protoc --proto_path="/Users/adrienjoly/dev/github/grpc-web/net/grpc/gateway/protos" \
--proto_path="/Users/adrienjoly/dev/github/grpc-web/third_party/protobuf/src" "/Users/adrienjoly/dev/github/grpc-web/net/grpc/gateway/protos/pair.proto" \
--cpp_out="/Users/adrienjoly/dev/github/grpc-web/net/grpc/gateway/protos"
/bin/sh: /Users/adrienjoly/dev/github/grpc-web/third_party/protobuf/src/protoc: No such file or directory
make: *** [protos] Error 127

@adrienjoly
Copy link
Author

@fengli79, same when I follow the install procedure you added in README.md:

grpc-web$ ./darwin_x86_64.sh
HEAD is now at effb406... Add an equals method to goog.math.Coordinate and make the existing equals method on goog.math.Vec2 take '*' instead of another goog.math.Vec2.
HEAD is now at 5dd94f1... Prepare for 1.0.2h release
HEAD is now at 1a58673... Merge pull request #2077 from pherl/3.0.x
HEAD is now at 6040b47... Merge pull request #8543 from apolcyn/fix_ruby_plugin_build
cd "/Users/adrienjoly/dev/github/grpc-web" && rm -rf objs gConnector gConnector_static \
third_party/nginx/src/objs third_party/openssl/.openssl
cd "/Users/adrienjoly/dev/github/grpc-web" && rm -f gConnector.zip gConnector_static.zip \
"/Users/adrienjoly/dev/github/grpc-web/net/grpc/gateway/protos"/*.pb.cc "/Users/adrienjoly/dev/github/grpc-web/net/grpc/gateway/protos"/*.pb.h \
third_party/nginx/src/Makefile
cd "/Users/adrienjoly/dev/github/grpc-web"/net/grpc/gateway/examples/echo && make clean
rm -f *.grpc.pb.cc *.grpc.pb.h *.grpc.pb.o *.pb.cc *.pb.h *.pb.o \
  echo_server echo_server.o compiled.js
rm -rf ./out
cd "/Users/adrienjoly/dev/github/grpc-web"/javascript/net/grpc/web && make clean
rm -f *.o protoc-gen-grpc-web
cd "/Users/adrienjoly/dev/github/grpc-web"
./darwin_x86_64.sh: line 3: cd: /github/grpc-web/third_party/protobuf: No such file or directory
./darwin_x86_64.sh: line 4: cd: /github/grpc-web/third_party/grpc: No such file or directory
cd "/Users/adrienjoly/dev/github/grpc-web" && rm -rf objs gConnector gConnector_static \
third_party/nginx/src/objs third_party/openssl/.openssl
cd "/Users/adrienjoly/dev/github/grpc-web" && rm -f gConnector.zip gConnector_static.zip \
"/Users/adrienjoly/dev/github/grpc-web/net/grpc/gateway/protos"/*.pb.cc "/Users/adrienjoly/dev/github/grpc-web/net/grpc/gateway/protos"/*.pb.h \
third_party/nginx/src/Makefile
cd "/Users/adrienjoly/dev/github/grpc-web"/net/grpc/gateway/examples/echo && make clean
rm -f *.grpc.pb.cc *.grpc.pb.h *.grpc.pb.o *.pb.cc *.pb.h *.pb.o \
  echo_server echo_server.o compiled.js
rm -rf ./out
cd "/Users/adrienjoly/dev/github/grpc-web"/javascript/net/grpc/web && make clean
rm -f *.o protoc-gen-grpc-web
cd "/Users/adrienjoly/dev/github/grpc-web"
cd /Users/adrienjoly/dev/github/grpc-web && /Users/adrienjoly/dev/github/grpc-web/third_party/protobuf/src/protoc --proto_path="/Users/adrienjoly/dev/github/grpc-web/net/grpc/gateway/protos" \
--proto_path="/Users/adrienjoly/dev/github/grpc-web/third_party/protobuf/src" "/Users/adrienjoly/dev/github/grpc-web/net/grpc/gateway/protos/pair.proto" \
--cpp_out="/Users/adrienjoly/dev/github/grpc-web/net/grpc/gateway/protos"
/bin/sh: /Users/adrienjoly/dev/github/grpc-web/third_party/protobuf/src/protoc: No such file or directory
make: *** [protos] Error 127

=> same error: third_party/protobuf/src/protoc: No such file or directory

Is there anything I missed?

@fengli79
Copy link
Collaborator

fengli79 commented Nov 7, 2016

Hmm, it's bug in the ./darwin_x86_64.sh, fixed by #17.

@adrienjoly
Copy link
Author

This fix does allow me to go further! :-)

But I still can't build the whole thing...

It ends with the following errors:

/usr/local/Cellar/protobuf/3.0.0-beta-4/include/google/protobuf/wire_format_lite_inl.h:352:17: error: 
      comparison of integers of different signs: 'const uint32' (aka 'const unsigned int') and 'int'
      [-Werror,-Wsign-compare]
  if (new_bytes != length) return false;
      ~~~~~~~~~ ^  ~~~~~~
/usr/local/Cellar/protobuf/3.0.0-beta-4/include/google/protobuf/wire_format_lite_inl.h:420:1: note: in
      instantiation of function template specialization
      'google::protobuf::internal::WireFormatLite::ReadPackedFixedSizePrimitive<double,
      google::protobuf::internal::WireFormatLite::FieldType::TYPE_DOUBLE>' requested here
READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE(double, TYPE_DOUBLE)
^
/usr/local/Cellar/protobuf/3.0.0-beta-4/include/google/protobuf/wire_format_lite_inl.h:411:10: note: 
      expanded from macro 'READ_REPEATED_PACKED_FIXED_SIZE_PRIMITIVE'
  return ReadPackedFixedSizePrimitive<                                         \
         ^
6 errors generated.
make: *** [/Users/adrienjoly/Dev/github/grpc-web/third_party/grpc/objs/opt/src/cpp/ext/reflection.pb.o] Error 1

Am I using the wrong protobuf version, maybe?

Full log: http://pastebin.com/5iQ17dkb

@fengli79
Copy link
Collaborator

fengli79 commented Nov 13, 2016

It looks not right, if you use init_submodules.sh, it should pin to protobuf tags/v3.0.2.
Could you help to create a new github directory and retry?

@fengli79 fengli79 reopened this Nov 14, 2016
@fengli79 fengli79 self-assigned this Nov 14, 2016
@fengli79
Copy link
Collaborator

@adrienjoly , does it work for you?

@adrienjoly
Copy link
Author

nope, still not, @fengli79 ...

here is my log from this morning, fresh clone:

http://pastebin.com/0faGZjY9

@fengli79
Copy link
Collaborator

fengli79 commented Nov 29, 2016 via email

@adrienjoly
Copy link
Author

Sorry for the delay, @fengli79, I've been very busy lately, with the launch of my product + of two crowdfunding campaigns.

I uninstalled "protobuf 3.0.0 beta4", tried again, and got:

checking for int size ...dyld: Library not loaded: libgrpc++_unsecure.dylib
  Referenced from: /Users/adrienjoly/Dev/WEEKEND/grpc-web/third_party/nginx/src/./objs/autotest
  Reason: image not found
  bytes
auto/configure: error: can not detect int size
make: *** [nginx_config] Error 1

full trace: http://pastebin.com/txzrjGJQ

@fengli79
Copy link
Collaborator

From El Cap, Mac starts to purge the DYLD_LIBRARY_PATH, thus I have to install grpc and protobuf into the default lib path for build.
Fixed by #28

@adrienjoly
Copy link
Author

Good job, @fengli79, the build seems to be working now! :-)

@adrienjoly
Copy link
Author

Now, I have no idea on how to test the project.
There used to be some samples mentioned in README, but I can't find them anymore...

@fengli79
Copy link
Collaborator

@adrienjoly
Copy link
Author

Thank you for the link, @fengli79

Unfortunately, I'm having problems to run the example, now:

  • When I run make example, I get a message saying that I should use the darwin script. So I interrupted the script, and re-ran the darwin script.
  • To run make from grpc-web/net/grpc/gateway/examples/echo, I had to re-install protoc (using brew install protobuf), but then I got the following error:
echo$ make
protoc -I . --cpp_out=. echo.proto
g++ -std=c++11 -I/usr/local/include -I../../../../.. -pthread  -c -o echo.pb.o echo.pb.cc
protoc -I . --grpc_out=. \
  --plugin=protoc-gen-grpc=`which grpc_cpp_plugin` echo.proto
g++ -std=c++11 -I/usr/local/include -I../../../../.. -pthread  -c -o echo.grpc.pb.o echo.grpc.pb.cc
g++ -std=c++11 -I/usr/local/include -I../../../../.. -pthread  -c -o echo_server.o echo_server.cc
g++ echo.pb.o echo.grpc.pb.o echo_server.o -L/usr/local/lib -lgrpc++ -lgrpc -Wl,--no-as-needed -lgrpc++_reflection -Wl,--as-needed -lprotobuf -lpthread -ldl -o echo_server
ld: unknown option: --no-as-needed
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [echo_server] Error 1

=> Should I open a new issue?

@fengli79
Copy link
Collaborator

fengli79 commented Dec 17, 2016 via email

loyalpartner pushed a commit to loyalpartner/grpc-web that referenced this issue Sep 4, 2020
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

4 participants