cmake-js / cmake-js Goto Github PK
View Code? Open in Web Editor NEWCMake.js - a Node.js native addon build tool
Home Page: https://www.npmjs.com/package/cmake-js
License: MIT License
CMake.js - a Node.js native addon build tool
Home Page: https://www.npmjs.com/package/cmake-js
License: MIT License
I don't want declare version directly. Is it possible setup always use the latest version?
something like
"cmake-js":
{
"runtime": "node",
"runtimeVersion": "*"
}
Thanks in advance.
perhaps this is documented somewhere that i couldn't find... but it'd be helpful for the folks that use heroku to know how to get cmake into the build system, e.g.,
heroku buildpacks:set https://github.com/ddollar/heroku-buildpack-multi.git --app $APP
then create .buildpacks with these two lines:
https://github.com/brave/heroku-cmake-buildpack.git
https://github.com/heroku/heroku-buildpack-nodejs.git
It has a meaning for developers who start new projects and don't have package.json
for root project yet or don't have cmake-js
section in it. And according to docs:
If you're creating a native module targeting nw.js for example, then do not specify anything in your module's package.json.
Thanks in advance.
Hi,
Just gathering feedback on the title. I think I can implement full MinGW toolchain support for Windows. That means Visual Studio (= 12 GBytes hog) won't required to build CMake.js based modules. MinGW could be installed from SourceForge: http://sourceforge.net/projects/mingw-w64/ and a far less PITA than installing Visual Sutdio. But even I can provide a DropBox based automatic install mechanism, which means to use CMake.js build system there should not be anything installed on Windows other than CMake!
My question is, does it worth my effort? Is the requirement of installing Visual Studio a real problem, or you can live with it?
If the main project has cmake-js as a dependency, you get:
amelie@Samsung-550P7C ~/workspace/projetPFE $ npm install
|
> [email protected] install /home/amelie/workspace/projetPFE/node_modules/albers-core-module
> node ./node_modules/cmake-js/bin/cmake-js rebuild
module.js:340
throw err;
^
Error: Cannot find module '/home/amelie/workspace/projetPFE/node_modules/albers-core-module/node_modules/cmake-js/bin/cmake-js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:935:3
If the main project has nan as a dependency, you get:
info CMD BUILD
info RUN cmake --build "/home/amelie/workspace/projetPFE/node_modules/albers-core-module/build" --config Release
Scanning dependencies of target addon
[ 5%] Building CXX object CMakeFiles/addon.dir/src/addon.cc.o
/home/amelie/workspace/projetPFE/node_modules/albers-core-module/src/addon.cc:2:10: fatal error: 'nan.h' file not found
#include <nan.h>
^
1 error generated.
make[2]: *** [CMakeFiles/addon.dir/src/addon.cc.o] Error 1
make[1]: *** [CMakeFiles/addon.dir/all] Error 2
make: *** [all] Error 2
ERR! OMG Process terminated: 2
But it works fine once your remove those dependencies.
Hi,
I'm wanted to run cmake-js on a machine with Ubuntu 14.04 and legacy node version installed. The default version of the nodejs package is v0.10.25. In your package.json the minimum required version is:
"engines": {
"node": ">= 0.10.0",
"iojs": ">= 1.0.0"
},
But if I want to run cmake-js compile
then I get the following error:
.../node_modules/cmake-js/bin/cmake-js:140
for (var key of _.keys(argv)) {
^^
SyntaxError: Unexpected identifier
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
On another machine with a newer node version cmake-js works perfect!
Is some special procedure required to add the cmake-js based project as part of a regular cmake based builds?
I have CMake based project that generates a cpp static library, which is the root project.
I am trying to add the cmake-js
addon project as a sub-directory that depends on the root static cpp library.
The cmake-js build
command is working fine from command prompt. But, when invoking through the parent project with ADD_SUBDIRECTORY(...)
it is not generating the correct js includes / libs, resulting in compiler errors.
Printing the ${CMAKE_JS_LIB}
value is giving empty values when building as part of the regular CMake projects.
Question:
How to integrate the cmake-js sub-project to be part of the bigger regular CMake project correctly?
Hello,
I'm working on this module https://github.com/AmelieA/albers-core which now compile thanks to unbornchikken. But I'm still having some trouble using any of the code on the deps folder because of some import issues.
I'm trying to run the code on examples/write.cc but the compiler does not recognize the albers namespace from one of the import.
I've tried importing the same import as the write.cc file on the addon.cc file but then the import file can't import its own header.
I've tried an include_directories("${PROJECT_SOURCE_DIR}/deps") with no success.
I've tried importing the write.cc on the addon.cc but nothing.
I ran out of ideas of what I could do without modifying the deps folder.
Any ideas ?
Hi,
Would be possible to turn off via CLI option the runtime environment update check that cmake-js does for every build?
It would make builds faster and be helpful for situations when there no connectivity.
Thanks!
Hello,
As far as I see, when cmake-js
initializes the Toolset
on Windows, we just grab the top version of Visual Studio as generator. Somewhere here
I could use an option which defines the generator explicitly, like in CMake:
cmake build . -G "Visual Studio 12 2013"
Any chance for that?
Thanks
If anyone has a chance to test this stuff running on Mac that would be greatly appreciated. Please report any issue that you found. And of course if it works as intended, please let me know that too. :)
Hello,
I would like to suggest adding a new CMake variable (e.g. NPM_CMAKEJS
) to the set of variables defined by CMake.js when configuring the project. (i.e. something like D.push({"NPM_CMAKEJS": "TRUE"});
in cMake.js
)
This would indicate that CMake has been invoked by CMake.js. (as opposed to a call from the command line or by an IDE such as CLion)
Having such a variable allows more flexibility in the CMakeLists.txt
. For instance, when working on a complex project, it can be used to switch between sub-projects:
if (NPM_CMAKEJS)
add_subdirectory(node_addon)
else()
add_subdirectory(other_subproject)
endif()
Thanks :)
Hi, I noticed that in the last version of cmake-js (version 3.2.2 to this date) there is some problem with line endings. Specifically if I npm install this version and then try to run cmake-js I get
$> cmake-js
: No such file or directory
on Linux (both Ubuntu 12.04 and 14.04), and
$> cmake-js
env: node\r: No such file or directory
on OSX (El Capitan)
I found a hint that this could be due to line endings thanks to [this StackOverflow post]((http://stackoverflow.com/questions/30344858/node-script-executable-not-working-on-mac-env-node-r-no-such-file-or-directo) and indeed by following the suggested procedure I was able to locally fix the cmake-js script.
Would it be possible to correct this in the Cmake.js project itself?
BTW, thanks for the great project : )
Hi,
have you considered, building cmake
itself upon installation of this module? Something like...
git clone -b master --single-branch --depth 1 https://github.com/Kitware/CMake node_modules/lib_cmake
./bootstrap --prefix=<this_modules_path> # path to node_modules/lib_cmake
make && make install
I currently like to integrate your module in peterbraden/node-opencv. Since opencv
and this module have a lot of dependencies itself, I care to reduce them by integrating the native dependencies like this.
This would obviously support you argument about cmake
being zero-dependent.
If it's worth a shot, I could send you a quick PR.
All the best!
On Windows 7 Enterprise (x64) with Node.js 0.12.4 (ia32), when building a native extension the following error occur:
cmake-js -D
info DIST Downloading distribution files.
http DIST - http://nodejs.org/dist/v0.12.4/SHASUMS256.txt
http DIST - http://nodejs.org/dist/v0.12.4/win-x86/node.lib
http DIST - http://nodejs.org/dist/v0.12.4/node-v0.12.4.tar.gz
ERR! OMG SHA sum of file 'win-x86/node.lib' mismatch!
ERR! OMG SHA sum of file 'win-x86/node.lib' mismatch!
Unhandled rejection Error: SHA sum of file 'win-x86/node.lib' mismatch!
Any idea on what may be wrong ?
Hi,
I have integrated a CMake based project with a cmake-js based one as a sub-project but cmake-js is not respecting my compiler preference informed through CC and CXX environment vars.
CMake-js has clang (at least under OSX) as its default compiler. I'm aware that cmake-js has -g option to switch to gcc instead but -g option is not a CMake supported feature, so it is not trivial to have cmake and cmake-js together using the same compiler seamlessly.
The main issue I'm facing now, as you may guess, is to have the nodejs native module which depends on a shared library built by the main project being compiled by two different compilers.
I would like to know your thoughts about this issue.
Thanks!
Allow to override runtime through command line for projects which are developed for some runtime but can be easily built for another. E.g. between node.js, NW.js and electron.
Do you know of anyone working on a tool to automate the process of transitioning from node-gyp to cmake.js?
H:\arrayfire_js-master>node_modules.bin\cmake-js
info CMD CONFIGURE
info RUN cmake "H:\arrayfire_js-master" --no-warn-unused-cli -G"Visual Studio 11
2012 [arch] Win64" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_JS_INC="C:\Users\un.cm
ake-js\node-x64\v0.12.4\src;C:\Users\un.cmake-js\node-x64\v0.12.4\deps\v8\inclu
de;C:\Users\un.cmake-js\node-x64\v0.12.4\deps\uv\include;H:\arrayfire_js-master
\node_modules\nan" -DNODE_RUNTIME="node" -DNODE_RUNTIMEVERSION="0.12.4" -DNODE_A
RCH="x64" -DCMAKE_JS_LIB="C:\Users\un.cmake-js\node-x64\v0.12.4\x64\node.lib" -
DAF_PATH="H:/v3"
Not searching for unused variables given on the command line.
CMake Error: Could not create named generator Visual Studio 11 2012 [arch] Win64
Generators
Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files.
Optional [arch] can be "Win64" or "ARM".
Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files.
Optional [arch] can be "Win64" or "ARM".
Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files.
Optional [arch] can be "Win64" or "ARM".
Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files.
Optional [arch] can be "Win64" or "IA64".
Visual Studio 9 2008 [arch] = Generates Visual Studio 2008 project files.
Optional [arch] can be "Win64" or "IA64".
Visual Studio 8 2005 [arch] = Generates Visual Studio 2005 project files.
Optional [arch] can be "Win64".
Visual Studio 7 .NET 2003 = Generates Visual Studio .NET 2003 project
files.
Visual Studio 7 = Deprecated. Generates Visual Studio .NET
2002 project files.
Visual Studio 6 = Deprecated. Generates Visual Studio 6
project files.
Borland Makefiles = Generates Borland makefiles.
NMake Makefiles = Generates NMake makefiles.
NMake Makefiles JOM = Generates JOM makefiles.
Green Hills MULTI = Generates Green Hills MULTI files
(experimental, work-in-progress).
MSYS Makefiles = Generates MSYS makefiles.
MinGW Makefiles = Generates a make file for use with
mingw32-make.
Unix Makefiles = Generates standard UNIX makefiles.
Ninja = Generates build.ninja files.
Watcom WMake = Generates Watcom WMake makefiles.
CodeBlocks - MinGW Makefiles = Generates CodeBlocks project files.
CodeBlocks - NMake Makefiles = Generates CodeBlocks project files.
CodeBlocks - Ninja = Generates CodeBlocks project files.
CodeBlocks - Unix Makefiles = Generates CodeBlocks project files.
CodeLite - MinGW Makefiles = Generates CodeLite project files.
CodeLite - NMake Makefiles = Generates CodeLite project files.
CodeLite - Ninja = Generates CodeLite project files.
CodeLite - Unix Makefiles = Generates CodeLite project files.
Eclipse CDT4 - MinGW Makefiles
= Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - NMake Makefiles
= Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - Ninja = Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.
Kate - MinGW Makefiles = Generates Kate project files.
Kate - NMake Makefiles = Generates Kate project files.
Kate - Ninja = Generates Kate project files.
Kate - Unix Makefiles = Generates Kate project files.
Sublime Text 2 - MinGW Makefiles
= Generates Sublime Text 2 project files.
Sublime Text 2 - NMake Makefiles
= Generates Sublime Text 2 project files.
Sublime Text 2 - Ninja = Generates Sublime Text 2 project files.
Sublime Text 2 - Unix Makefiles
= Generates Sublime Text 2 project files.
ERR! OMG Process terminated: 1
Unhandled rejection Error: Process terminated: 1
at ChildProcess. (H:\arrayfire_js-master\node_modules\cmake-js\li
b\cMake.js:367:24)
at ChildProcess.emit (events.js:110:17)
at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
Hi!
I'm writing an addon that needs several .dylib
libraries. On OSX after building them, I copy them to /usr/local/lib
. In my CMakeLists.txt
I write:
target_link_libraries(
${PROJECT_NAME}
${CMAKE_JS_LIB}
/usr/local/lib/libExample.dylib
)
And after compiling the addon with cmake-js
it runs correctly.
However if I don't copy it into /usr/local/lib
and specify its original path in CMakeLists.txt
, it doesn't work. It compiles, but at runtime it stops.
How should I link it correctly?
Thanks
node-gyp defines BUILDING_NODE_EXTENSION in addon.gypi (https://github.com/nodejs/node-gyp/blob/9bfa0876b46764978492fffea074d2d7aa8954f9/addon.gypi). It's used in node.h below.
cmake-js should define it, too.
#ifdef _WIN32
# ifndef BUILDING_NODE_EXTENSION
# define NODE_EXTERN __declspec(dllexport)
# else
# define NODE_EXTERN __declspec(dllimport)
# endif
#else
# define NODE_EXTERN /* nothing */
#endif
#ifdef BUILDING_NODE_EXTENSION
# undef BUILDING_V8_SHARED
# undef BUILDING_UV_SHARED
# define USING_V8_SHARED 1
# define USING_UV_SHARED 1
#endif
When doing this:
I've got:
No toolset specified. Please use --toolset option.
on FreeBSD shared hosting
I've read through the wiki's tutorial 1 and made some adjustments:
CMakeLists.txt
to use target_include_directories()
https://gist.github.com/MajorBreakfast/b92c82ad1701e604f788
Note: I can't provide a PR unfortunately because github doesn't support PRs for wiki repos.
BTW cmake-js worked great for me so far (on all three platforms). So, thanks for that!
Hi all,
Is this possible to use cmake-js
to make an addon that required to use OpenSSL? node-gyp
advises to do it like this: https://github.com/nodejs/node-gyp/wiki/Linking-to-OpenSSL
Is there any way to detect using runtime( io.js
/nw.js
/Electron
) inside CMakeLists.txt?
Thanks in advance.
from github and package.json
Thank you for creating this project. I've long wanted gyp to disappear.
In manual mode everything (building in from my source directory) works and builds fine. Now i tried to package it all up and do a test install on another machine and there cmake-js cannot find nan.h
My package.json looks like this:
{
"name": "vtk",
"version": "1.0.2",
"description": "node.js bindings to VTK",
"author": {
"name": "Axel Kittenberger",
"email": "[email protected]"
},
"repository": {
"type": "git",
"url": "https://github.com/axkibe/node-vtk"
},
"main": "./index",
"license": "BSD-3-Clause",
"devDependencies": {
"cmake-js": "^3.0.0",
"nan": "^2.2.0"
},
"dependencies": {
"cmake-js": "^3.0.0",
"nan": "^2.2.0"
},
"scripts": {
"install": "cmake-js compile"
}
}
Trying to install it:
$ npm install vtk
npm WARN deprecated [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm
> [email protected] install /home/axel/nvtk/node_modules/vtk
> cmake-js compile
info TOOL Using Unix Makefiles generator.
info TOOL Using c++11 compiler standard.
info CMD CONFIGURE
info RUN cmake "/home/axel/nvtk/node_modules/vtk" --no-warn-unused-cli -G"Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="/home/axel/nvtk/node_modules/vtk/build/Release" -DCMAKE_JS_INC="/home/axel/.cmake-js/node-x64/v5.5.0/include/node" -DNODE_RUNTIME="node" -DNODE_RUNTIMEVERSION="5.5.0" -DNODE_ARCH="x64" -DCMAKE_CXX_FLAGS="-std=c++11"
Not searching for unused variables given on the command line.
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- The imported target "vtkCommonCoreTCL" references the file
"/usr/lib/x86_64-linux-gnu/libvtkCommonCoreTCL-6.1.so.6.1.0"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-6.1/VTKTargets.cmake"
but not all the files it references.
[Many more of reference fail Wanrs]
-- Configuring done
-- Generating done
-- Build files have been written to: /home/axel/nvtk/node_modules/vtk/build
info CMD BUILD
info RUN cmake --build "/home/axel/nvtk/node_modules/vtk/build" --config Release
Scanning dependencies of target node-vtk
[ 0%] Building CXX object CMakeFiles/node-vtk.dir/src/vtkInteractorStyleTrackballCameraWrap.cc.o
/home/axel/nvtk/node_modules/vtk/src/vtkInteractorStyleTrackballCameraWrap.cc:6:17: fatal error: nan.h: No such file or directory
#include <nan.h>
^
compilation terminated.
CMakeFiles/node-vtk.dir/build.make:54: recipe for target 'CMakeFiles/node-vtk.dir/src/vtkInteractorStyleTrackballCameraWrap.cc.o' failed
make[2]: *** [CMakeFiles/node-vtk.dir/src/vtkInteractorStyleTrackballCameraWrap.cc.o] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/node-vtk.dir/all' failed
make[1]: *** [CMakeFiles/node-vtk.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2
info REP Build has been failed, trying to do a full rebuild.
info CMD CLEAN
info RUN cmake -E remove_directory "/home/axel/nvtk/node_modules/vtk/build"
info CMD CONFIGURE
info RUN cmake "/home/axel/nvtk/node_modules/vtk" --no-warn-unused-cli -G"Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="/home/axel/nvtk/node_modules/vtk/build/Release" -DCMAKE_JS_INC="/home/axel/.cmake-js/node-x64/v5.5.0/include/node" -DNODE_RUNTIME="node" -DNODE_RUNTIMEVERSION="5.5.0" -DNODE_ARCH="x64" -DCMAKE_CXX_FLAGS="-std=c++11"
Not searching for unused variables given on the command line.
-- The C compiler identification is GNU 4.9.2
-- The CXX compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- The imported target "vtkCommonCoreTCL" references the file
"/usr/lib/x86_64-linux-gnu/libvtkCommonCoreTCL-6.1.so.6.1.0"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-6.1/VTKTargets.cmake"
but not all the files it references.
-- The imported target "vtkCommonMathTCL" references the file
"/usr/lib/x86_64-linux-gnu/libvtkCommonMathTCL-6.1.so.6.1.0"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/lib/cmake/vtk-6.1/VTKTargets.cmake"
but not all the files it references.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/axel/nvtk/node_modules/vtk/build
info CMD BUILD
info RUN cmake --build "/home/axel/nvtk/node_modules/vtk/build" --config Release
Scanning dependencies of target node-vtk
[ 0%] Building CXX object CMakeFiles/node-vtk.dir/src/vtkInteractorStyleTrackballCameraWrap.cc.o
/home/axel/nvtk/node_modules/vtk/src/vtkInteractorStyleTrackballCameraWrap.cc:6:17: fatal error: nan.h: No such file or directory
#include <nan.h>
^
compilation terminated.
CMakeFiles/node-vtk.dir/build.make:54: recipe for target 'CMakeFiles/node-vtk.dir/src/vtkInteractorStyleTrackballCameraWrap.cc.o' failed
make[2]: *** [CMakeFiles/node-vtk.dir/src/vtkInteractorStyleTrackballCameraWrap.cc.o] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/node-vtk.dir/all' failed
make[1]: *** [CMakeFiles/node-vtk.dir/all] Error 2
Makefile:76: recipe for target 'all' failed
make: *** [all] Error 2
ERR! OMG Process terminated: 2
npm WARN ENOENT ENOENT: no such file or directory, open '/home/axel/nvtk/package.json'
npm WARN EPACKAGEJSON nvtk No description
npm WARN EPACKAGEJSON nvtk No repository field.
npm WARN EPACKAGEJSON nvtk No README data
npm WARN EPACKAGEJSON nvtk No license field.
npm ERR! Linux 3.16.0-4-amd64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "vtk"
npm ERR! node v5.5.0
npm ERR! npm v3.3.12
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `cmake-js compile`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'cmake-js compile'.
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 vtk package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cmake-js compile
npm ERR! You can get their info via:
npm ERR! npm owner ls vtk
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/axel/nvtk/npm-debug.log
I tried on that machine again manually cloning https://github.com/axkibe/node-vtk and running ./node_modules/.bin/cmake-js bulid
manually and that works again...
I need to build with a especified vs version (-G"Visual Studio 11 Win64") , but the machine also contains VS 2015. There are any option to force the generator?
Why does running cmake-js configure
not generate compile_commands.json
. I have in my CMake file:
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Instead, I have to run cmake on my own after cmake-js configure... it's quite annoying.
I need to do it inside Travis-CI. Is it possible, how do you think?
Please add regex support.
I'm building my addon for Electron v0.29.2. Previously I use node-gyp to build the addon and everything is fine. However after building with cmake-js, requiring the addon in js will throw an exception:
Uncaught Exception:
Error: Module did not self-register.
at Error (native)
at Object.module.(anonymous function) (ATOM_SHELL_ASAR.js:137:20)
at Object.module.(anonymous function) [as .node] (ATOM_SHELL_ASAR.js:137:20)
at Module.load (module.js:353:32)
at Function.Module._load (module.js:308:12)
at Module.require (module.js:363:17)
at require (module.js:382:17)
at Object.<anonymous> (/tmp/MyApp.app/Contents/Resources/app/main.js:147:16)
at Module._compile (module.js:428:26)
at Object.Module._extensions..js (module.js:446:10)
I've already set the cmake-js.runtime in package.json to electron and runtimeVersion to 0.29.2 with arch set to ia32. The folder node_modules
has always been deleted before take a cmake-js rebuild. Could you please give some suggestions about how to fix this issue?
Thanks.
the current node version is 6.5.0
the headers it's including is ~/.cmake-js/node-x64/v6.3.1/include/node
There's no env.h Header?
%subj%
I'm receiving this error when running cmake-js compile
on Windows 10 with Visual Studio 2015 Community installed. I have all the Visual Studio Visual C++ tools installed, and even restarted for good measure, yet the error remains.
I also tried adding C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\Bin\
to my PATH and even tried to run it as Administrator but that doesn't work either.
Any ideas as to what could be going wrong?
I am currently developing a website to visualize data coming from the particle collider (or similar data) for my last year of engineering school. To do that, I am looking at a way to create a module of the cern c++ code and integrate it to my nodeJS website.
Since the cern code (https://github.com/cbernet/albers-core based on https://root.cern.ch/drupal/content/downloading-root) is compiled with a CMakeLists.txt, I naturally found your cmake-js project really interesting. I tried your demo code and it worked flawlessly but I can't figure out how to make it work when the code used already have a CMakeLists.txt.
Here is the module project https://github.com/AmelieA/albers-core, I know it is not much but I don't know anything about cmake (apart from the doc I've read) and I am just trying to make the albers-core/examples/read.cc work with nodeJS without changing too much the architecture of the project (you can see that my code is almost only the files in the albers-core/javascript/ folder).
Here is the error code after an npm install :
[ 94%] Building CXX object javascript/CMakeFiles/albers-read-adapter.dir/readAdapter.cc.o
ERR! OMG In file included from /home/amelie/workspace/albers-core-module-noSRC/javascript/readAdapter.cc:1:
ERR! OMG In file included from /home/amelie/workspace/albers-core-module-noSRC/node_modules/nan/nan.h:24:
ERR! OMG In file included from /home/amelie/.cmake-js/node-x64/v0.10.38/src/node.h:62:
ERR! OMG /home/amelie/.cmake-js/node-x64/v0.10.38/deps/v8/include/v8.h:3005:5: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
ERR! OMG struct {
ERR! OMG ^
ERR! OMG 1 warning generated.
ERR! OMG Linking CXX executable albers-read-adapter
ERR! OMG CMakeFiles/albers-read-adapter.dir/readAdapter.cc.o: In function returnValue(v8::Arguments const&)': ERR! OMG /home/amelie/workspace/albers-core-module-noSRC/javascript/readAdapter.cc:(.text+0x55d): undefined reference to
v8::HandleScope::HandleScope()'
ERR! OMG /home/amelie/workspace/albers-core-module-noSRC/javascript/readAdapter.cc:(.text+0x56e): undefined reference to v8::Undefined()' ERR! OMG /home/amelie/workspace/albers-core-module-noSRC/javascript/readAdapter.cc:(.text+0x576): undefined reference to
v8::Value::Uint32Value() const'
ERR! OMG /home/amelie/workspace/albers-core-module-noSRC/javascript/readAdapter.cc:(.text+0x57f): undefined reference to v8::Number::New(double)' ERR! OMG /home/amelie/workspace/albers-core-module-noSRC/javascript/readAdapter.cc:(.text+0x58b): undefined reference to
v8::HandleScope::RawClose(v8::internal::Object*)'
ERR! OMG /home/amelie/workspace/albers-core-module-noSRC/javascript/readAdapter.cc:(.text+0x597): undefined reference to v8::HandleScope::~HandleScope()' ERR! OMG /home/amelie/workspace/albers-core-module-noSRC/javascript/readAdapter.cc:(.text+0x5ac): undefined reference to
v8::HandleScope::~HandleScope()'
ERR! OMG CMakeFiles/albers-read-adapter.dir/readAdapter.cc.o: In function InitAll(v8::Handle<v8::Object>)': ERR! OMG /home/amelie/workspace/albers-core-module-noSRC/javascript/readAdapter.cc:(.text+0x5d4): undefined reference to
v8::String::New(char const, int)'
ERR! OMG /home/amelie/workspace/albers-core-module-noSRC/javascript/readAdapter.cc:(.text+0x5e7): undefined reference to v8::FunctionTemplate::New(v8::Handle<v8::Value> (*)(v8::Arguments const&), v8::Handle<v8::Value>, v8::Handle<v8::Signature>)' ERR! OMG /home/amelie/workspace/albers-core-module-noSRC/javascript/readAdapter.cc:(.text+0x5ef): undefined reference to
v8::FunctionTemplate::GetFunction()'
ERR! OMG /home/amelie/workspace/albers-core-module-noSRC/javascript/readAdapter.cc:(.text+0x606): undefined reference to `v8::Object::Set(v8::Handlev8::Value, v8::Handlev8::Value, v8::PropertyAttribute)'
ERR! OMG clang-3.6: error: linker command failed with exit code 1 (use -v to see invocation)
ERR! OMG make[2]: *** [javascript/albers-read-adapter] Error 1
ERR! OMG make[1]: *** [javascript/CMakeFiles/albers-read-adapter.dir/all] Error 2
ERR! OMG make: *** [all] Error 2
ERR! OMG
Any help is appreciated.
Amélie.
Hi,
After update cmake-js from v1.1.1 to v2.0.0, I'm getting the following output:
$ cmake-js print-configure
info CFG Applying CMake.js config from root package.json:
info CFG {"runtime":"node","runtimeVersion":"0.12.7","arch":"x64"}
undefined
Any idea?
Commit 881f86e introduced the keyword let without strict mode.
This breaks compatibility with ES5, so 0.10 and 0.12.
I'm maintaining the nbind
project which autogenerates NAN and Emscripten bindings (and TypeScript definitions) for C++ classes and functions. It makes writing Node.js addons extremely easy but requires a number of compiler options to use especially when targeting Emscripten, so it comes with a couple of .gypi
files.
Another tool, autogypi
autogenerates a binding.gyp
file for a new project given names of packages it depends on. It plays nicely with both nbind
and nan
, noticing the former depends on the latter and sets everything up.
I'd like to add support for cmake-js
in nbind
and autogypi
, so that these quick start instructions would be equally easy when using cmake-js
instead of node-gyp
(this would be an option). That would also get rid of the Python 2 dependency (unless targeting Emscripten, which still depends on it).
For this, maybe some sort of interaction between cmake-js
and autogypi
would be useful? Do you have any thoughts for a standard way to include the necessary CMakeLists
options in npm packages intended to be used as C++ libraries?
Running cmake-js rebuild --runtime=electron --runtime-version=0.28.3 --arch=x64
On a 32-bit windows machine NODE_ARCH=ia32 and on a 64 bit machine NODE_ARCH=x64.
Looks like a typo in bin/cmake-js at line 123
arch: argv.A
should be arch: argv.a
Hi, I have to use cmake for my module building and I've ran into some errors. I've decided to try an example and it also failed. Here's the log:
lyssdod@lynn /storage/work $ git clone https://github.com/cmake-js/cmake-js-tut-04-boost-module
Cloning into 'cmake-js-tut-04-boost-module'...
remote: Counting objects: 47, done.
remote: Total 47 (delta 0), reused 0 (delta 0), pack-reused 47
Unpacking objects: 100% (47/47), done.
Checking connectivity... done.
lyssdod@lynn /storage/work $ cd cmake-js-tut-04-boost-module/
lyssdod@lynn /storage/work/cmake-js-tut-04-boost-module $ npm install
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No license field.
npm WARN deprecated [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm
-
> [email protected] install /storage/work/cmake-js-tut-04-boost-module
> cmake-js compile
info TOOL Using Ninja generator, because ninja is available.
info TOOL Using c++11 compiler standard.
info DIST Downloading distribution files.
http DIST - http://nodejs.org/dist/v4.4.1/SHASUMS256.txt
http DIST - http://nodejs.org/dist/v4.4.1/node-v4.4.1-headers.tar.gz
info CMD CONFIGURE
info RUN cmake "/storage/work/cmake-js-tut-04-boost-module" --no-warn-unused-cli -G"Ninja" -DCMAKE_JS_VERSION="3.3.0" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="/storage/work/cmake-js-tut-04-boost-module/build/Release" -DCMAKE_JS_INC="/home/lyssdod/.cmake-js/node-x64/v4.4.1/include/node;/storage/work/cmake-js-tut-04-boost-module/node_modules/nan" -DNODE_RUNTIME="node" -DNODE_RUNTIMEVERSION="4.4.1" -DNODE_ARCH="x64" -DCMAKE_CXX_FLAGS="-std=c++11"
Not searching for unused variables given on the command line.
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Require Boost Libs module started.
-- Required Boost version: >= 1.58.0
-- Required libs: coroutine
-- Boost Lib Installer starting.
-- Invoking boost-lib to download Boost >= 1.58.0.
info BOOST Searching for Boost >= 1.58.0 in '/home/lyssdod/.cmake-js/boost'.
info BOOST Boost found in '/home/lyssdod/.cmake-js/boost/1.61.0'.
-- Boost path: /home/lyssdod/.cmake-js/boost/1.61.0
-- Boost version: 1.61.0
-- Boost library postfix: 1_61
-- b2 executable found.
-- Generating b2 args.
-- variant=release
-- b2 args: link=static;threading=multi;runtime-link=shared;--build-dir=Build;stage;--stagedir=stage;-d+2;--hash;variant=release;--layout=tagged;-sNO_BZIP2=1;cxxflags=-fPIC;cxxflags=-std=c++11;toolset=gcc-5.4
-- Resolving Boost library: coroutine
-- Setting up external project to build coroutine.
-- Setting boost_coroutine dependent on boost_context
-- Setting boost_coroutine dependent on boost_system
-- Resolving Boost library: context
-- Setting up external project to build context.
-- Setting boost_context dependent on boost_thread
-- Resolving Boost library: system
-- Setting up external project to build system.
-- Resolving Boost library: thread
-- Setting up external project to build thread.
-- Setting boost_thread dependent on boost_chrono
-- Resolving Boost library: chrono
-- Setting up external project to build chrono.
-- Setting boost_chrono dependent on boost_system
-- Boost libs scheduled for build: boost_coroutine;boost_context;boost_system;boost_thread;boost_chrono
-- Generating headers ...
CMake Error at node_modules/boost-lib/cmake/BoostLibInstaller.cmake:185 (message):
b2 error:
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/build/feature.jam:494:
in feature.validate-value-string from module feature
error: "none" is not a known value of feature <optimization>
error: legal values: "off" "speed" "space"
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/build/property.jam:276:
in validate1 from module property
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/build/property.jam:302:
in property.validate from module property
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/tools/builtin.jam:381:
in variant from module builtin
/usr/share/boost-build/site-config.jam:9: in modules.load from module
site-config
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/build-system.jam:249:
in load-config from module build-system
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/build-system.jam:351:
in load-configuration-files from module build-system
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/build-system.jam:524:
in load from module build-system
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/kernel/modules.jam:295:
in import from module modules
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/kernel/bootstrap.jam:139:
in boost-build from module
/home/lyssdod/.cmake-js/boost/1.61.0/boost-build.jam:17: in module scope
from module
Call Stack (most recent call first):
node_modules/boost-lib/cmake/BoostLib.cmake:19 (boost_lib_installer)
CMakeLists.txt:16 (require_boost_libs)
-- Configuring incomplete, errors occurred!
See also "/storage/work/cmake-js-tut-04-boost-module/build/CMakeFiles/CMakeOutput.log".
info REP Build has been failed, trying to do a full rebuild.
info CMD CLEAN
info RUN cmake -E remove_directory "/storage/work/cmake-js-tut-04-boost-module/build"
info CMD CONFIGURE
info RUN cmake "/storage/work/cmake-js-tut-04-boost-module" --no-warn-unused-cli -G"Ninja" -DCMAKE_JS_VERSION="3.3.0" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="/storage/work/cmake-js-tut-04-boost-module/build/Release" -DCMAKE_JS_INC="/home/lyssdod/.cmake-js/node-x64/v4.4.1/include/node;/storage/work/cmake-js-tut-04-boost-module/node_modules/nan" -DNODE_RUNTIME="node" -DNODE_RUNTIMEVERSION="4.4.1" -DNODE_ARCH="x64" -DCMAKE_CXX_FLAGS="-std=c++11"
Not searching for unused variables given on the command line.
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Require Boost Libs module started.
-- Required Boost version: >= 1.58.0
-- Required libs: coroutine
-- Boost Lib Installer starting.
-- Invoking boost-lib to download Boost >= 1.58.0.
info BOOST Searching for Boost >= 1.58.0 in '/home/lyssdod/.cmake-js/boost'.
info BOOST Boost found in '/home/lyssdod/.cmake-js/boost/1.61.0'.
-- Boost path: /home/lyssdod/.cmake-js/boost/1.61.0
-- Boost version: 1.61.0
-- Boost library postfix: 1_61
-- b2 executable found.
-- Generating b2 args.
-- variant=release
-- b2 args: link=static;threading=multi;runtime-link=shared;--build-dir=Build;stage;--stagedir=stage;-d+2;--hash;variant=release;--layout=tagged;-sNO_BZIP2=1;cxxflags=-fPIC;cxxflags=-std=c++11;toolset=gcc-5.4
-- Resolving Boost library: coroutine
-- Setting up external project to build coroutine.
-- Setting boost_coroutine dependent on boost_context
-- Setting boost_coroutine dependent on boost_system
-- Resolving Boost library: context
-- Setting up external project to build context.
-- Setting boost_context dependent on boost_thread
-- Resolving Boost library: system
-- Setting up external project to build system.
-- Resolving Boost library: thread
-- Setting up external project to build thread.
-- Setting boost_thread dependent on boost_chrono
-- Resolving Boost library: chrono
-- Setting up external project to build chrono.
-- Setting boost_chrono dependent on boost_system
-- Boost libs scheduled for build: boost_coroutine;boost_context;boost_system;boost_thread;boost_chrono
-- Generating headers ...
CMake Error at node_modules/boost-lib/cmake/BoostLibInstaller.cmake:185 (message):
b2 error:
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/build/feature.jam:494:
in feature.validate-value-string from module feature
error: "none" is not a known value of feature <optimization>
error: legal values: "off" "speed" "space"
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/build/property.jam:276:
in validate1 from module property
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/build/property.jam:302:
in property.validate from module property
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/tools/builtin.jam:381:
in variant from module builtin
/usr/share/boost-build/site-config.jam:9: in modules.load from module
site-config
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/build-system.jam:249:
in load-config from module build-system
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/build-system.jam:351:
in load-configuration-files from module build-system
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/build-system.jam:524:
in load from module build-system
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/kernel/modules.jam:295:
in import from module modules
/home/lyssdod/.cmake-js/boost/1.61.0/tools/build/src/kernel/bootstrap.jam:139:
in boost-build from module
/home/lyssdod/.cmake-js/boost/1.61.0/boost-build.jam:17: in module scope
from module
Call Stack (most recent call first):
node_modules/boost-lib/cmake/BoostLib.cmake:19 (boost_lib_installer)
CMakeLists.txt:16 (require_boost_libs)
-- Configuring incomplete, errors occurred!
See also "/storage/work/cmake-js-tut-04-boost-module/build/CMakeFiles/CMakeOutput.log".
ERR! OMG Process terminated: 1
npm ERR! Linux 4.5.2-aufs
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! node v4.4.1
npm ERR! npm v2.14.20
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `cmake-js compile`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'cmake-js compile'.
npm ERR! This is most likely a problem with the cmake-js-tut-04-boost-module package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! cmake-js compile
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs cmake-js-tut-04-boost-module
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls cmake-js-tut-04-boost-module
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /storage/work/cmake-js-tut-04-boost-module/npm-debug.log
Not so much of an issue as a documentation request I guess...
I tried to find, how do you create the header/lib packages that are hosted?
Building my addon with cmake-js throws "incorrect header check" error. This problem may caused by electron side though I'm not certain. So I opened an issue here.
$ cmake-js rebuild -r electron -v 0.32.1 -a ia32 -l=silly
...
info DIST Downloading distribution files.
http DIST - http://atom.io/download/atom-shell/v0.32.1/node-v0.32.1.tar.gz
events.js:85
throw er; // Unhandled 'error' event
^
Error: incorrect header check
at Zlib._handle.onerror (zlib.js:366:17)
Thanks in advance.
https://ci.appveyor.com/project/RSATom/webchimera-js/build/0.0.0.146/job/xjkvv4iyc0l8jgal
it seems it's something wrong with include search path:
c:\projects\webchimera-js\src\JsVlcAudio.h(5): fatal error C1083: Cannot open include file: 'v8.h': No such file or directory [C:\projects\webchimera-js\build\WebChimera.js.vcxproj]
but it builds fine if I force use cmake-js v1.0.2
I am getting the following after installing the new version (Both on OSx and Ubuntu):
$ cmake-js
: No such file or directory
reverting back to v3.0 fixes the problem which suggests that the new version is broken.
There should be an easy way to support Boost based code on all platforms, without needing to install anything by hand by module developers or consumers. All should be automatic and as fast as possible, like resolving node/io.js header and library dependencies.
It's being in development in a separate module: https://github.com/unbornchikken/boost-lib
I am wondering what has to be done to let CLion compile the addon from within the IDE. Currently I am just executing cmake-js rebuild from the command line, but in CLion everything associated with nan is red and I can't use the debugger CLion provides. It is not possible, at least as far as I know, to execute a custom command to build the project.
I tried to add CMAKE_JS_INC vatiable to the CMake project settings enviroment variables without success. I also tried to configure a external tool to build the project with, but that did not work either.
I have installed the build tools and when I run 'cmake-js build'. The command fails saying there is no Visual C++ compiler installed. Am I missing something? Does there need to be an environment variable setup?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.