intel / iotivity-node

Node.js bindings for IoTivity
https://www.iotivity.org/
42 stars 44 forks source link

Missing include folder when using a version of IoTivity built separately (can't locate `octypes.h`) #152

Open gvancuts opened 7 years ago

gvancuts commented 7 years ago

I was trying to build iotivity separately and then re-use it to build iotivity-node by following the top-level README.md file. I was however hitting the error listed below.

I worked around the issue by exporting the following variable (note the extra include dir):

OCTBSTACK_CFLAGS=-I/home/gvancuts/iotivity/resource/csdk/include -I/home/gvancuts/iotivity/resource/csdk/stack/include/

Does that sound like the right approach to solving the problem? If so, I can also prepare a PR for the documentation to be updated accordingly.

Error when missing the iotivity/resource/csdk/include include directory:

gvancuts@gvancuts-nuc:~/iotivity-node$ npm install

> iotivity-node@1.3.0-1 install /home/gvancuts/iotivity-node
> node-gyp rebuild

make: Entering directory '/home/gvancuts/iotivity-node/build'
  TOUCH Release/obj.target/csdk.stamp
  ACTION Generating constants generated/constants.cc
/home/gvancuts/iotivity-node/build-scripts/helpers/header-paths.js:48
        throw new Error( "Failed to find file " + filesToFind[ fileIndex ] );
        ^

Error: Failed to find file octypes.h
    at Object.<anonymous> (/home/gvancuts/iotivity-node/build-scripts/helpers/header-paths.js:48:9)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/home/gvancuts/iotivity-node/build-scripts/generate-constants.js:22:20)
    at Module._compile (module.js:410:26)
    at Object.Module._extensions..js (module.js:417:10)
generateconstants.target.mk:13: recipe for target 'generated/constants.cc' failed
make: *** [generated/constants.cc] Error 1
make: Leaving directory '/home/gvancuts/iotivity-node/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:269:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.4.0-92-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/gvancuts/iotivity-node
gyp ERR! node -v v4.2.6
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.1.2
npm ERR! Linux 4.4.0-92-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! iotivity-node@1.3.0-1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the iotivity-node@1.3.0-1 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the iotivity-node 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 information on how to open an issue for this project with:
npm ERR!     npm bugs iotivity-node
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls iotivity-node
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/gvancuts/iotivity-node/npm-debug.log
gabrielschulhof commented 7 years ago

If you'd like to prepare a PR, sure. Nevertheless, the documentation as it is states that OCTBSTACK_CFLAGS "should contain the compiler flags for locating the iotivity include files" and the value shown is a value it "can" have, meaning it doesn't necessarily have to have that value.

I guess I was being deliberately vague, opting to convey that these variables should contain all necessary flags, rather than attempting to offer a working value, which is bound to change with time, thus requiring maintenance.

On Tue, Sep 12, 2017 at 12:34 PM, Geoffroy Van Cutsem < notifications@github.com> wrote:

I was trying to build iotivity separately and then re-use it to build iotivity-node by following the top-level README.md file. I was however hitting the error listed below.

I worked around the issue by exporting the following variable (note the extra include dir):

OCTBSTACK_CFLAGS=-I/home/gvancuts/iotivity/resource/csdk/include -I/home/gvancuts/iotivity/resource/csdk/stack/include/

Does that sound like the right approach to solving the problem? If so, I can also prepare a PR for the documentation to be updated accordingly.

Error when missing the iotivity/resource/csdk/include include directory:

gvancuts@gvancuts-nuc:~/iotivity-node$ npm install

iotivity-node@1.3.0-1 install /home/gvancuts/iotivity-node node-gyp rebuild

make: Entering directory '/home/gvancuts/iotivity-node/build' TOUCH Release/obj.target/csdk.stamp ACTION Generating constants generated/constants.cc /home/gvancuts/iotivity-node/build-scripts/helpers/header-paths.js:48 throw new Error( "Failed to find file " + filesToFind[ fileIndex ] ); ^

Error: Failed to find file octypes.h at Object. (/home/gvancuts/iotivity-node/build-scripts/helpers/header-paths.js:48:9) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Module.require (module.js:354:17) at require (internal/module.js:12:17) at Object. (/home/gvancuts/iotivity-node/build-scripts/generate-constants.js:22:20) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10)generateconstants.target.mk:13: recipe for target 'generated/constants.cc' failed make: *** [generated/constants.cc] Error 1 make: Leaving directory '/home/gvancuts/iotivity-node/build' gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:269:23) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) gyp ERR! System Linux 4.4.0-92-generic gyp ERR! command "/usr/bin/nodejs" "/usr/bin/node-gyp" "rebuild" gyp ERR! cwd /home/gvancuts/iotivity-node gyp ERR! node -v v4.2.6 gyp ERR! node-gyp -v v3.0.3 gyp ERR! not ok

npm WARN optional Skipping failed optional dependency /chokidar/fsevents: npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.1.2 npm ERR! Linux 4.4.0-92-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" npm ERR! node v4.2.6 npm ERR! npm v3.5.2 npm ERR! code ELIFECYCLE npm ERR! iotivity-node@1.3.0-1 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the iotivity-node@1.3.0-1 install script 'node-gyp rebuild'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the iotivity-node 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 information on how to open an issue for this project with: npm ERR! npm bugs iotivity-node npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls iotivity-node npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /home/gvancuts/iotivity-node/npm-debug.log

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/otcshare/iotivity-node/issues/152, or mute the thread https://github.com/notifications/unsubscribe-auth/AA7k0cdIyFOMvD2Kw1N_J5ATOs2_TTiVks5shlA5gaJpZM4PUXgs .