1

I'm compiling a Google protobuf plugin from these sources.

I've installed protobuf@2.5 with the homebrew command:

brew install protobuf@2.5

After installation I get the following error when trying to compile by calling make:

Richards-Mac-mini:protobuf-objc-arc richard$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in src/compiler
g++ -DHAVE_CONFIG_H -I. -I../..     -g -O2 -DNDEBUG -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.cc
main.cc:17:10: fatal error: 'google/protobuf/compiler/plugin.h' file not found
#include <google/protobuf/compiler/plugin.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [main.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

In particular, this line is interesting:

fatal error: 'google/protobuf/compiler/plugin.h' file not found

While I definitely able to go to this path and find the plugin.h file:

/usr/local/Cellar/protobuf@2.5/2.5.0/include/google/protobuf/compiler/plugin.h

screenshot

Looks, like the library is not linked correctly with the binary and the issue is somehow related to the correct path.

When I try to issue a command which protoc, I get:

/usr/local/opt/protobuf@2.5/bin/protoc

protoc --version leads to the following output, which is expected.

libprotoc 2.5.0

Richard Topchii
  • 7,075
  • 8
  • 48
  • 115

1 Answers1

0

Fixed by issuing the following commands:

brew link --force --overwrite protobuf250

Output:

Linking /usr/local/Cellar/protobuf@2.5/2.5.0... 14 symlinks created

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/protobuf@2.5/bin:$PATH"' >> ~/.bash_profile

And then:

echo 'export PATH="/usr/local/opt/protobuf@2.5/bin:$PATH"' >> ~/.bash_profile

After successful linking I was able to compile the Objective-C plugin without errors.

Richard Topchii
  • 7,075
  • 8
  • 48
  • 115