my8bird / node-leveldb

NodeJS bindings to levelDB - a fast and lightweight key/value database library
http://code.google.com/p/leveldb/
BSD 2-Clause "Simplified" License
63 stars 12 forks source link

OS X - endian.h: No such file or directory #9

Closed jahewson closed 12 years ago

jahewson commented 12 years ago

I'm getting a build error on Mac OS X (10.7), with node v0.6.2, when I do an npm install leveldb

/Users/john/node_modules/leveldb/deps/leveldb/port/port_posix.h:20:22: error: 
endian.h: No such file or directory

However, if I clone the source from master, it builds fine.

my8bird commented 12 years ago

when you cloned did you still use npm install to build everything?

jahewson commented 12 years ago

yes, I did npm install .

my8bird commented 12 years ago

Sorry this took so long i do not have a mac so I have been trying to determine what direction could work to figure this out.

Leveldb uses a script called build_detect_platform, in the root of the dep, to determine what type of machine you are running on. This script spits out a file called build_config.mk. Could you attach this file? What i see in the google leveldb code is that this file will not have

PLATFORM=OS_MACOSX

in it. Which would cause your issue.

jahewson commented 12 years ago

Yes, you're right, when I do an npm install leveldb then build_config.mk contains:

PLATFORM_CFLAGS=-pthread -DOS_LINUX
PLATFORM_LDFLAGS=-pthread
PLATFORM=OS_LINUX
SNAPPY=0
PORT_CFLAGS=-fno-builtin-memcmp -DLEVELDB_PLATFORM_POSIX

but when I cloned and built with npm install . I get:

PLATFORM_CFLAGS=-DOS_MACOSX
PLATFORM_LDFLAGS=
PLATFORM=OS_MACOSX
SNAPPY=0
PORT_CFLAGS=-fno-builtin-memcmp -DLEVELDB_PLATFORM_POSIX

I'm not sure how to fix this though?

my8bird commented 12 years ago

The issue was that my local machines settings were being deployed to npm. i update the .npmignore file to exclude the files so it should work. however, there is no good way for me to verify this on my machine since it would "just work".

Long story short try 0.5.3 and you should be good to go.

jahewson commented 12 years ago

Yep, works perfectly. Thanks.