kelly / node-i2c

Node.js native bindings for i2c-dev. Plays well with Raspberry Pi and Beaglebone.
Other
216 stars 91 forks source link

Error installing - 'linux/types.h' file not found #17

Closed judholliday closed 10 years ago

judholliday commented 10 years ago

node-gyp is throwing an error during installation. Tried a few things like making sure node was up to date, etc, but to no avail. Any help would be appreciated.

> i2c@0.1.4 install /Users/jbh/project/node_modules/i2c
> node-gyp rebuild

  CXX(target) Release/obj.target/i2c/src/i2c.o
In file included from ../src/i2c.cc:11:
../src/i2c-dev.h:27:10: fatal error: 'linux/types.h' file not found
#include <linux/types.h>
         ^
1 error generated.
make: *** [Release/obj.target/i2c/src/i2c.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 11.4.2
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jbh/project/node_modules/i2c
gyp ERR! node -v v0.10.22
gyp ERR! node-gyp -v v0.11.0
gyp ERR! not ok
npm ERR! i2c@0.1.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the i2c@0.1.4 install script.
npm ERR! This is most likely a problem with the i2c package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls i2c
npm ERR! There is likely additional logging output above.
kelly commented 10 years ago

Try:

sudo apt-get install build-essential
judholliday commented 10 years ago

Turns out the problem was between they keyboard and the chair. Wrong ssh window means I was trying to install on my mac instead of my pi. Clearly time to call it a night. :)

ghendricks commented 10 years ago

So how does one install on Mac OSX? I get the same error on Mountain Lion. Is Mac OSX supported?

kelly commented 10 years ago

It's currently made for embedded systems that have direct access to the i2c bus.

paullryan commented 10 years ago

@ghendricks you can make it an optional dependency for your OS X app using the optionalDependencies section of your package.json and then checking for a valid require by doing the following:

var i2c;
try {
    i2c = require('i2c');
} catch { // handle no-i2c case }

Then you can stub out methods to handle the no i2c case and still test/develop/debug your application from a non-embedded system.

rzr commented 4 years ago

Do you think it could be ported to also support OSX ?