Azure / iot-edge-v1

Azure IoT Edge
http://azure.github.io/iot-edge/
Other
525 stars 258 forks source link

Build error with node.js on Windows 10 #220

Closed RikVerbrugge closed 7 years ago

RikVerbrugge commented 7 years ago

Today I tried to build the node.js samples on Windows 10. But I receive this error when I run: build.cmd --enable-nodejs-binding

CMake Error at bindings/nodejs/CMakeLists.txt:12 (message): Environment variables NODE_INCLUDE and NODE_LIB are not defined. Please define NODE_INCLUDE to point to the location where the Node JS include files reside and NODE_LIB to point to the location where the Node JS library files reside. If you haven't built Node JS yet, then please run tools/build_nodejs.sh or tools/build_nodejs.cmd as appropriate.

I have installed node JS (and it is in path) and tried several time to rebuild with tools/build_nodejs.cmd

Any ideas?

aribeironovaes commented 7 years ago

Yes, add the variables NODE_INCLUDE and NODE_LIB to you environment and restart the command windows and try again.

After you build nodejs it will tell which value to put on these variables.

Let us know,

Angelo Ribeiro

Sent from my phone

On Apr 19, 2017, at 7:42 AM, RikVerbrugge notifications@github.com wrote:

Today I tried to build the node.js samples on Windows 10. But I receive this error when I run: build.cmd --enable-nodejs-binding

CMake Error at bindings/nodejs/CMakeLists.txt:12 (message): Environment variables NODE_INCLUDE and NODE_LIB are not defined. Please define NODE_INCLUDE to point to the location where the Node JS include files reside and NODE_LIB to point to the location where the Node JS library files reside. If you haven't built Node JS yet, then please run tools/build_nodejs.sh or tools/build_nodejs.cmd as appropriate.

I have installed node JS (and it is in path) and tried several time to rebuild with tools/build_nodejs.cmd

Any ideas?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

avranju commented 7 years ago

The gateway build scripts need to know where the Node.js headers and lib files are located. It relies on 2 environment variables for these 2 paths:

As @aribeironovaes said, when you run tools/build_nodejs.cmd or tools/build_nodejs.sh the script lets you know what values to set for these variables.

If you have cloned the repo at this location for instance - c:\code\azure-iot-gateway-sdk then the 2 paths are likely to have the following values:

set NODE_INCLUDE=c:\code\azure-iot-gateway-sdk\build_nodejs\dist\inc
set NODE_LIB=c:\code\azure-iot-gateway-sdk\build_nodejs\dist\lib
RikVerbrugge commented 7 years ago

Thanks. Now I get several errors after setting the NODE (with the correct paths): (I did rebuild anything and then run the build command with enable nodjs binding

C:\tmp\azure-iot-gateway-sdk\bindings\nodejs\src\nodejs.cpp(22): fatal error C1083: Cannot open include file: 'u v.h': No such file or directory [C:\tmp\azure-iot-gateway-sdk\build\bindings\nodejs\nodejs_binding_static.vcxpro j]

and things like this:

"C:\tmp\azure-iot-gateway-sdk\build\azure_iot_gateway_sdk.sln" (default target) (1) -> "C:\tmp\azure-iot-gateway-sdk\build\bindings\nodejs\nodejs_binding_static.vcxproj.metaproj" (default target) (29 ) -> "C:\tmp\azure-iot-gateway-sdk\build\bindings\nodejs\nodejs_binding_static.vcxproj" (default target) (51) -> (ClCompile target) -> C:\tmp\azure-iot-gateway-sdk\bindings\nodejs\src\nodejs.cpp(22): fatal error C1083: Cannot open include file: 'uv.h': No such file or directory [C:\tmp\azure-iot-gateway-sdk\build\bindings\nodejs\nodejs_binding_static.vcxp roj] C:\tmp\azure-iot-gateway-sdk\bindings\nodejs\src\nodejs_idle.cpp(7): fatal error C1083: Cannot open include fi le: 'uv.h': No such file or directory [C:\tmp\azure-iot-gateway-sdk\build\bindings\nodejs\nodejs_binding_static. vcxproj] C:\tmp\azure-iot-gateway-sdk\bindings\nodejs\inc\nodejs_utils.h(12): fatal error C1083: Cannot open include fi le: 'uv.h': No such file or directory [C:\tmp\azure-iot-gateway-sdk\build\bindings\nodejs\nodejs_binding_static. vcxproj] C:\tmp\azure-iot-gateway-sdk\bindings\nodejs\src\modules_manager.cpp(8): fatal error C1083: Cannot open includ e file: 'uv.h': No such file or directory [C:\tmp\azure-iot-gateway-sdk\build\bindings\nodejs\nodejs_binding_sta tic.vcxproj]

avranju commented 7 years ago

These errors mean that the environment variables were not defined when you ran build.cmd. uv.h should be available in %NODE_INCLUDE%. If the compiler is not able to find it then the variables were not defined or they had the wrong path.