Closed episage closed 4 years ago
Try the following:
$ npm i -g nan
$ NODE_PATH=$(npm config get prefix)/lib/node_modules CMAKE_LIBRARY_PATH=$(node -e "require('nan')") npm i --save-dev llvm-node
@vihanb Almost. It went past nan.h
with your solution.
info RUN cmake "/root/p/node_modules/llvm-node" --no-warn-unused-cli -G"Unix Makefiles" -DCMAKE_JS_VERSION="4.0.1" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_LIBRARY_OUTPUT_DIRECTO
RY="/root/p/node_modules/llvm-node/build/Release" -DCMAKE_JS_INC="/root/.cmake-js/node-x64/v12.16.0/include/node" -DNODE_RUNTIME="node" -DNODE_RUNTIMEVERSION="12.16.0" -DNODE
_ARCH="x64"
Not searching for unused variables given on the command line.
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.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
-- Found LLVM 7.0.1
-- Using LLVMConfig.cmake in: /usr/lib/llvm-7/cmake
-- Configuring done
-- Generating done
-- Build files have been written to: /root/p/node_modules/llvm-node/build
info CMD BUILD
info RUN cmake --build "/root/p/node_modules/llvm-node/build" --config Release
Scanning dependencies of target llvm-node
[ 2%] Building CXX object CMakeFiles/llvm-node.dir/src/bitcode/bitcode-writer.cc.o
[ 4%] Building CXX object CMakeFiles/llvm-node.dir/src/bitcode/bitcode.cc.o
[ 7%] Building CXX object CMakeFiles/llvm-node.dir/src/config/config.cc.o
[ 9%] Building CXX object CMakeFiles/llvm-node.dir/src/config/llvm-config.cc.o
[ 11%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/alloca-inst.cc.o
[ 14%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/argument.cc.o
[ 16%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/array-type.cc.o
[ 19%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/attribute.cc.o
[ 21%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/basic-block.cc.o
[ 23%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/call-inst.cc.o
[ 26%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/calling-conv.cc.o
[ 28%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-array.cc.o
[ 30%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-data-array.cc.o
[ 33%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-fp.cc.o
[ 35%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-int.cc.o
[ 38%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-pointer-null.cc.o
[ 40%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-struct.cc.o
[ 42%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant.cc.o
[ 45%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/data-layout.cc.o
/root/p/node_modules/llvm-node/src/ir/data-layout.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE DataLayoutWrapper::New(Nan::NAN_METHOD_ARGS_TYPE)’:
/root/p/node_modules/llvm-node/src/ir/data-layout.cc:47:58: error: no matching function for call to ‘v8::Value::ToString()’
llvm::DataLayout layout { ToString(info[0]->ToString()) };
^
In file included from /root/.cmake-js/node-x64/v12.16.0/include/node/node.h:63,
from /root/.cmake-js/node-x64/v12.16.0/include/node/nan.h:54,
from /root/p/node_modules/llvm-node/src/ir/../util/string.h:8,
from /root/p/node_modules/llvm-node/src/ir/data-layout.cc:5:
/root/.cmake-js/node-x64/v12.16.0/include/node/v8.h:2668:44: note: candidate: ‘v8::MaybeLocal<v8::String> v8::Value::ToString(v8::Local<v8::Context>) const’
V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
^~~~~~~~
/root/.cmake-js/node-x64/v12.16.0/include/node/v8.h:2668:44: note: candidate expects 1 argument, 0 provided
In file included from /root/.cmake-js/node-x64/v12.16.0/include/node/v8-internal.h:14,
from /root/.cmake-js/node-x64/v12.16.0/include/node/v8.h:27,
from /root/.cmake-js/node-x64/v12.16.0/include/node/node.h:63,
from /root/.cmake-js/node-x64/v12.16.0/include/node/nan.h:54,
from /root/p/node_modules/llvm-node/src/ir/../util/string.h:8,
from /root/p/node_modules/llvm-node/src/ir/data-layout.cc:5:
/root/.cmake-js/node-x64/v12.16.0/include/node/v8.h:2684:31: note: candidate: ‘v8::Local<v8::String> v8::Value::ToString(v8::Isolate*) const’
Local<String> ToString(Isolate* isolate) const);
^~~~~~~~
/root/.cmake-js/node-x64/v12.16.0/include/node/v8config.h:335:44: note: in definition of macro ‘V8_DEPRECATED’
#define V8_DEPRECATED(message, declarator) declarator
^~~~~~~~~~
/root/.cmake-js/node-x64/v12.16.0/include/node/v8.h:2684:31: note: candidate expects 1 argument, 0 provided
Local<String> ToString(Isolate* isolate) const);
^~~~~~~~
/root/.cmake-js/node-x64/v12.16.0/include/node/v8config.h:335:44: note: in definition of macro ‘V8_DEPRECATED’
#define V8_DEPRECATED(message, declarator) declarator
^~~~~~~~~~
/root/p/node_modules/llvm-node/src/ir/data-layout.cc:47:61: error: no matching function for call to ‘llvm::DataLayout::DataLayout(<brace-enclosed initializer list>)’
llvm::DataLayout layout { ToString(info[0]->ToString()) };
^
In file included from /root/p/node_modules/llvm-node/src/ir/data-layout.h:9,
from /root/p/node_modules/llvm-node/src/ir/data-layout.cc:6:
/usr/lib/llvm-7/include/llvm/IR/DataLayout.h:193:3: note: candidate: ‘llvm::DataLayout::DataLayout(const llvm::DataLayout&)’
DataLayout(const DataLayout &DL) { *this = DL; }
^~~~~~~~~~
/usr/lib/llvm-7/include/llvm/IR/DataLayout.h:193:3: note: conversion of argument 1 would be ill-formed:
/usr/lib/llvm-7/include/llvm/IR/DataLayout.h:191:12: note: candidate: ‘llvm::DataLayout::DataLayout(const llvm::Module*)’
explicit DataLayout(const Module *M);
^~~~~~~~~~
/usr/lib/llvm-7/include/llvm/IR/DataLayout.h:191:12: note: conversion of argument 1 would be ill-formed:
/usr/lib/llvm-7/include/llvm/IR/DataLayout.h:186:12: note: candidate: ‘llvm::DataLayout::DataLayout(llvm::StringRef)’
explicit DataLayout(StringRef LayoutDescription) {
^~~~~~~~~~
/usr/lib/llvm-7/include/llvm/IR/DataLayout.h:186:12: note: conversion of argument 1 would be ill-formed:
make[2]: *** [CMakeFiles/llvm-node.dir/build.make:297: CMakeFiles/llvm-node.dir/src/ir/data-layout.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/llvm-node.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
ERR! OMG Process terminated: 2
root@coco:~/p# llvm-ar --version
LLVM (http://llvm.org/):
LLVM version 7.0.1
Optimized build.
Default target: x86_64-pc-linux-gnu
Host CPU: core2
No clue how to proceed further. Do I have the correct LLVM version?
Can you try installing the latest version from master?
`npm install https://github.com/MichaReiser/llvm-node/‘
@MichaReiser Works. Thanks!
apt install git zlib*
npm i MichaReiser/llvm-node#master
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
> llvm-node@2.1.0 install /root/p/node_modules/llvm-node
> cmake-js compile
[
'/usr/bin/node',
'/root/p/node_modules/llvm-node/node_modules/.bin/cmake-js',
'compile'
]
info TOOL Using Unix Makefiles generator.
info CMD CONFIGURE
info RUN cmake "/root/p/node_modules/llvm-node" --no-warn-unused-cli -G"Unix Makefiles" -DCMAKE_JS_VERSION="6.0.0" -DCMAKE_BUILD_TYPE="Release" -DCMAKE_LIBRARY_OUTPUT_DIRECTORY="/root/p/node_modules/llvm-node/build/Release" -DCMAKE_JS_INC="/root/.cmake-js/node-x64/v12.16.0/include/node" -DCMAKE_JS_SRC="" -DNODE_RUNTIME="node" -DNODE_RUNTIMEVERSION="12.16.0" -DNODE_ARCH="x64"
Not searching for unused variables given on the command line.
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.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
-- Found LLVM 7.0.1
-- Using LLVMConfig.cmake in: /usr/lib/llvm-7/cmake
-- Configuring done
-- Generating done
-- Build files have been written to: /root/p/node_modules/llvm-node/build
info CMD BUILD
info RUN cmake --build "/root/p/node_modules/llvm-node/build" --config Release
Scanning dependencies of target llvm-node
[ 2%] Building CXX object CMakeFiles/llvm-node.dir/src/bitcode/bitcode-writer.cc.o
[ 4%] Building CXX object CMakeFiles/llvm-node.dir/src/bitcode/bitcode.cc.o
[ 6%] Building CXX object CMakeFiles/llvm-node.dir/src/config/config.cc.o
[ 9%] Building CXX object CMakeFiles/llvm-node.dir/src/config/llvm-config.cc.o
[ 11%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/alloca-inst.cc.o
[ 13%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/argument.cc.o
[ 16%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/array-type.cc.o
[ 18%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/attribute.cc.o
[ 20%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/basic-block.cc.o
[ 23%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/call-inst.cc.o
[ 25%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/calling-conv.cc.o
[ 27%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-array.cc.o
[ 30%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-data-array.cc.o
[ 32%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-fp.cc.o
[ 34%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-int.cc.o
[ 37%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-pointer-null.cc.o
[ 39%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-struct.cc.o
[ 41%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant.cc.o
[ 44%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/data-layout.cc.o
[ 46%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/function-type.cc.o
[ 48%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/function.cc.o
[ 51%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/global-variable.cc.o
[ 53%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/integer-type.cc.o
[ 55%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/ir-builder.cc.o
[ 58%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/ir.cc.o
[ 60%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/linkage-types.cc.o
[ 62%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/llvm-context.cc.o
[ 65%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/module.cc.o
[ 67%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/phi-node.cc.o
[ 69%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/pointer-type.cc.o
[ 72%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/struct-type.cc.o
[ 74%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/type.cc.o
[ 76%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/undef-value.cc.o
[ 79%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/unnamed-addr.cc.o
[ 81%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/value.cc.o
[ 83%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/verifier.cc.o
[ 86%] Building CXX object CMakeFiles/llvm-node.dir/src/ir/visibility-types.cc.o
[ 88%] Building CXX object CMakeFiles/llvm-node.dir/src/llvm-node.cc.o
[ 90%] Building CXX object CMakeFiles/llvm-node.dir/src/support/support.cc.o
[ 93%] Building CXX object CMakeFiles/llvm-node.dir/src/support/target-registry.cc.o
[ 95%] Building CXX object CMakeFiles/llvm-node.dir/src/target/target-machine.cc.o
[ 97%] Building CXX object CMakeFiles/llvm-node.dir/src/util/string.cc.o
[100%] Linking CXX shared library Release/llvm-node.node
[100%] Built target llvm-node
npm WARN saveError ENOENT: no such file or directory, open '/root/p/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/root/p/package.json'
npm WARN p No description
npm WARN p No repository field.
npm WARN p No README data
npm WARN p No license field.
+ llvm-node@2.1.0
updated 1 package, moved 141 packages and audited 210 packages in 151.222s
1 package is looking for funding
run `npm fund` for details
found 0 vulnerabilities
Hi,
clean Debian install, c++, cmake, llvm installed via apt. Build keeps failing on missing
nan.h
I did
cp node_modules/nan/nan*.h /root/.cmake-js/node-x64/v12.16.0/include/node/
andAny ideas on what am I doing wrong?