2

I am unable to get beyond the make protobuf step due to the error below. I read up some blogs, they recommended installing brew install protobuf. Did that. Still not able to build.

I am building on a Mac 10.11.6

make protobuf_dist
c++ -MD -c -o /Users/jsiddharth/Desktop/workspace/test/j2objc-master/protobuf/compiler/build_result/google/protobuf/compiler/j2objc/j2objc_enum.o -x c++ -stdlib=libc++ -Isrc -I../google/src src/google/protobuf/compiler/j2objc/j2objc_enum.cc
In file included from src/google/protobuf/compiler/j2objc/j2objc_enum.cc:35:
In file included from src/google/protobuf/compiler/j2objc/j2objc_enum.h:41:
src/google/protobuf/compiler/j2objc/common.h:44:10: fatal error: 
      'google/protobuf/compiler/code_generator.h' file not found
#include <google/protobuf/compiler/code_generator.h>
         ^
1 error generated.
make[1]: *** [/Users/jsiddharth/Desktop/workspace/test/j2objc-master/protobuf/compiler/build_result/google/protobuf/compiler/j2objc/j2objc_enum.o] Error 1
make: *** [protobuf_compiler_dist] Error 2

Edit

I tried to export to

export PROTOBUF_ROOT_DIR=~/Downloads/protobuf-3.0.0/src/

Since I found the code_generator.h in

/Users/jsiddharth/Downloads/protobuf-3.0.0/src/google/protobuf/compiler/code_generator.h

Still the same error. Am I not exporting the correct variable ?

Edit

  1. For a Mac system, Unix tools are not available by default. You will first need to install Xcode from the Mac AppStore and then run the following command from a terminal:

  2. $ sudo xcode-select --install

  3. To install Unix tools, you can install "port" following the instructions at https://www.macports.org . This will reside in /opt/local/bin/port for most Mac installations.

  4. $ sudo /opt/local/bin/port install autoconf automake libtool

Now I am facing the following error

/Users/jsiddharth/Desktop/workspace/test/j2objc-master/protobuf/compiler/build_result/google/protobuf/stubs/strutil.o /usr/local/lib//libprotobuf.a(strutil.o) ld: 55 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: * [/Users/jsiddharth/Desktop/workspace/test/j2objc-master/protobuf/compiler/build_result/j2objc_protoc] Error 1 make: * [protobuf_compiler_dist] Error 2

Siddharth
  • 9,349
  • 16
  • 86
  • 148

1 Answers1

2

The Optional Setup for Protocol Buffers in the Building J2ObjC doc should work. I think the missing step is to define a PROTOBUF_ROOT_DIR environment variable to brew's include directory root (it's /usr/local/include by default):

$ export PROTOBUF_ROOT_DIR=/usr/local/include
$ make protobuf_dist
tball
  • 1,984
  • 11
  • 21
  • For your benefit, I have started a bounty too :) – Siddharth Feb 07 '17 at 08:20
  • Our protobuf expert says those installation instructions are incomplete, and instead you should follow the [protobuf project's installation steps](https://github.com/google/protobuf/blob/master/src/README.md). – tball Feb 08 '17 at 19:51
  • Can someone help get this built. – Siddharth Feb 11 '17 at 20:14
  • As of now java2obj does not build on a mac. I believe that 100% of your tool users are mac users. Please help fix this. – Siddharth Feb 13 '17 at 07:09
  • java2obj is a different project than j2objc, from completely different teams and companies (I think the java2obj project is dead). You have a couple of options: use a release (the most recent is a couple of weeks old), or install protocol buffers in /usr/local/. Thank you for reporting that PROTOBUF_ROOT_DIR doesn't work for the proto compiler, but the default /usr/local does. We will fix PROTOBUF_ROOT_DIR in the next release. – tball Feb 14 '17 at 14:23
  • thanks for your response man. any timeline ? (last question I promise) – Siddharth Feb 14 '17 at 14:33
  • Fix is pending review, so it should be pushed to the public repository next week. We currently expect to make a release in the next 2-3 weeks, though that depends on whether any new bugs are reported.Once the fix is public, though, you can build your own release bundle by running "./scripts/build_distribution.sh " (please pick a release number that won't conflict with our release numbering, to avoid confusion). – tball Feb 15 '17 at 16:48
  • Please dont forget to update this answer. I am in great need. Thanks. – Siddharth Feb 15 '17 at 17:24