couchbase / forestdb

A Fast Key-Value Storage Engine Based on Hierarchical B+-Tree Trie
Apache License 2.0
1.29k stars 173 forks source link

Error building on OSX -- fatal error: 'snappy-c.h' file not found #6

Closed tleyden closed 10 years ago

tleyden commented 10 years ago

Steps to build:

$ brew install cmake
$ brew install snappy # note, I didn't use "sudo", does that make a difference?
$ git clone <repo>
$ cd forestdb && mkdir build && cd build && cmake ../

Cmake output: https://gist.github.com/tleyden/555a6ea565f768c739f3

When I ran make all, I got an error:

[ 27%] Building CXX object CMakeFiles/docio_test.dir/src/docio.cc.o
/Users/tleyden/DevLibraries/forestdb/src/docio.cc:26:10: fatal error: 'snappy-c.h' file not found
#include "snappy-c.h"
         ^
1 error generated.
make[2]: *** [CMakeFiles/docio_test.dir/src/docio.cc.o] Error 1
make[1]: *** [CMakeFiles/docio_test.dir/all] Error 2
make: *** [all] Error 2

Full make all output: https://gist.github.com/tleyden/86c926a85adfd9d175da

I do have snappy-c.h in my /usr/local/Cellar dir:

$ find /usr/local/Cellar -iname "*snappy*"
/usr/local/Cellar/snappy
/usr/local/Cellar/snappy/1.1.1/include/snappy-c.h
....

but it doesn't seem to be found during the compilation. Is my brew misconfigured or do I need to do another step?

ajres commented 10 years ago

I repeated these steps, I only diverged with make, I used :

sudo make
sudo make install
sudo make all

All completed without error

snej commented 10 years ago

You should file issues in Jira ... Couchbase Server project, ForestDB component.

mschoch commented 10 years ago

If we don't want issues filed here, we should disable them in the settings for this project.

tleyden commented 10 years ago

Oh ok. I'm going to close this out anyway, because @ajres tried it and it worked fine for him.

josiahjohnston commented 5 years ago

I ran into this same issue, and didn't find a solution posted anywhere. A search led me to this page, so I'm posting my quick fix here.

My quick fix was up environment variables to pass all the library & header paths that I needed (in my case, both openssl & snappy installed from homebrew). If there's a standard way of making homebrew link those to the standard include & lib directories, that might be a better solution.

export LDFLAGS="-L/usr/local/opt/openssl/lib -L/usr/local/opt/snappy/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include -I/usr/local/opt/snappy/include"
hisundar commented 5 years ago

Yup, those look good. Thanks so much @josiahjohnston !

cantoniazzi commented 5 years ago

Thanks @josiahjohnston your tips works to me. 🥇