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

./cstore.pb-c.h:7:10: fatal error: 'protobuf-c/protobuf-c.h' file not found #40

Closed
falconair opened this issue Nov 17, 2014 · 7 comments

Comments

@falconair
Copy link

Hi, I'm trying to install cstore_fdw and getting the following error:

gcc -mmacosx-version-min=10.7 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv --std=c99 -I. -I. -I/Applications/Postgres93.app/Contents/MacOS/include/postgresql/server -I/Applications/Postgres93.app/Contents/MacOS/include/postgresql/internal -I/Applications/Postgres93.app/Contents/MacOS/include/libxml2 -I/Applications/Postgres93.app/Contents/MacOS/include -c -o cstore.pb-c.o cstore.pb-c.c
In file included from cstore.pb-c.c:9:
./cstore.pb-c.h:7:10: fatal error: 'protobuf-c/protobuf-c.h' file not found

include <protobuf-c/protobuf-c.h>

     ^

1 error generated.
make: *** [cstore.pb-c.o] Error 1

I am attempting this on my MBP (osx) laptop. I have installed postgre using postgres.app (version 9.3.1.0 (18)).

I installed protobuf and they seem to have installed without any errors:

brew info protobuf-c
protobuf-c: stable 1.0.2
https://github.com/protobuf-c/protobuf-c
/usr/local/Cellar/protobuf-c/1.0.2 (10 files, 304K) *
Built from source
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/protobuf-c.rb
==> Dependencies
Build: pkg-config ✔
Required: protobuf ✔

I am running OS X Yosemite (10.10)

@pykello
Copy link
Contributor

pykello commented Nov 17, 2014

I have some questions:

  1. What does bin/protoc-c --version print?
  2. Does /usr/local/Cellar/protobuf-c/1.0.2/bin/ contain protoc-c?
  3. If 1 fails but the answer to 2 is yes, can you do export PATH=/usr/local/Cellar/protobuf-c/1.0.2/bin:$PATH, then try 1 and then try installing cstore_fdw again (all in same terminal session)?

@falconair
Copy link
Author

  1. protoc-c --version
    protobuf-c 1.0.2
    libprotoc 2.6.0

  2. ls /usr/local/Cellar/protobuf-c/1.0.2/bin/
    protoc-c

Both work!
The problem seems to be missing header, not the command line executable to work with protobuf files...no? I'm a java dev so I probably don't know what I'm talking about when it comes to c/c++ imports.

Btw, I tried to do 'make' after adding .../Cellar/protobuf-c/... to my path, still same issue:

echo $PATH
/usr/local/Cellar/protobuf-c/1.0.2/bin/:/usr/local/opt/ruby/bin:/usr/local/opt/coreutils/libexec/gnubin:/Applications/Postgres.app/Contents/Versions/9.3/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/shahbaz/proj/gsutil

(you see different version of Postgres.app because I upgraded it after posting the message last night. current version of postgres.app is 9.3.5.2)

@pykello
Copy link
Contributor

pykello commented Nov 18, 2014

@falconair you are right.

One of my coworkers says he had ran into a similar situation after he upgraded. He said he ran the following command lines to fix his brew installation:

# brew update
# brew upgrade

Can you try them and then reinstall protobuf-c?

@falconair
Copy link
Author

Strange, I did update and upgrade, uninstalled protobuf-c and re-installed, still same issue. Btw, I just noticed that the error I pasted originally cut out some text due to angle brackets. Here is another attempt:

gcc -mmacosx-version-min=10.7 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv  --std=c99 -I. -I. -I/Applications/Postgres.app/Contents/Versions/9.3/include/postgresql/server -I/Applications/Postgres.app/Contents/Versions/9.3/include/postgresql/internal -I/Applications/Postgres.app/Contents/Versions/9.3/include/libxml2  -I/Applications/Postgres.app/Contents/Versions/9.3/include  -c -o cstore.pb-c.o cstore.pb-c.c
In file included from cstore.pb-c.c:9:
./cstore.pb-c.h:7:10: fatal error: 'protobuf-c/protobuf-c.h' file not found
#include <protobuf-c/protobuf-c.h>
         ^
1 error generated.
make: *** [cstore.pb-c.o] Error 1

@jasonmp85
Copy link
Contributor

I fought this for a bit on my own machine and found that the 10.10-provided version of clang/gcc were not including /usr/local/include as they used to. After thrashing around on the command line I eventually got it to work. My best guess of what might get it going:

  1. Launch the Xcode executable and make sure there are no ToS dialogs you need to agree to or downloads pending. I'm on version 6.1 as installed through the App Store.
  2. In Terminal, run xcode-select --install. If you're already on the latest version you'll see xcode-select: error: command line tools are already installed, use "Software Update" to install updates. If not, a GUI dialog will appear
  3. Hopefully the dialog appeared. Agree to it and let the installation complete

Before doing the above, gcc --version output:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix

Now I see:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix

Not entirely sure why this made the difference, but now cstore_fdw builds on my machine. I can confirm (a) that I could build it as recently as yesterday when I was on 10.9, (b) that I upgraded to 10.10 last night, (c) that I no longer could build it this morning, and (d) after the above steps I can build it again.

Hopefully this helps!

@falconair
Copy link
Author

@jasonmp85 I followed your steps exactly and I was able to compile! Thanks! On to the experiments :)

@jasonmp85
Copy link
Contributor

Awesome! Closing now.

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

3 participants