MichaReiser / llvm-node

LLVM 9.0+ Node Bindings
MIT License
183 stars 29 forks source link

error: no member named 'getTypeByName' in 'llvm::Module' #132

Closed leap0x7b closed 3 years ago

leap0x7b commented 3 years ago

This happens when I try to install lllvm-node via yarn on Termux. Possibly because I'm using LLVM 12 which is incompatible with llvm-node (contributions probably can make it compatible with llvm-node)

Full log:

❯ yarn add llvm-node
yarn add v1.22.10
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error /data/data/com.termux/files/home/tlang_js/node_modules/llvm-node: Command failed.
Exit code: 1
Command: cmake-js compile
Arguments:
Directory: /data/data/com.termux/files/home/tlang_js/node_modules/llvm-node
Output:
[
  '/data/data/com.termux/files/usr/bin/node',
  '/data/data/com.termux/files/home/tlang_js/node_modules/llvm-node/node_modules/.bin/cmake-js',
  'compile'
]
info TOOL Using Ninja generator, because ninja is available.
info CMD CONFIGURE
info RUN [
info RUN   'cmake',
info RUN   '/data/data/com.termux/files/home/tlang_js/node_modules/llvm-node',
info RUN   '--no-warn-unused-cli',
info RUN   '-G',
info RUN   'Ninja',
info RUN   '-DCMAKE_JS_VERSION=6.2.1',
info RUN   '-DCMAKE_BUILD_TYPE=Release',
info RUN   '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/data/data/com.termux/files/home/tlang_js/node_modules/llvm-node/build/Release',
info RUN   '-DCMAKE_JS_INC=/data/data/com.termux/files/home/.cmake-js/node-arm64/v14.15.4/include/node;/data/data/com.termux/files/home/tlang_js/node_modules/nan',
info RUN   '-DCMAKE_JS_SRC=',
info RUN   '-DNODE_RUNTIME=node',
info RUN   '-DNODE_RUNTIMEVERSION=14.15.4',
info RUN   '-DNODE_ARCH=arm64',
info RUN   '-DLLVM_DIR=/data/data/com.termux/files/usr/lib/cmake/llvm'
info RUN ]
Not searching for unused variables given on the command line.
-- The C compiler identification is Clang 12.0.0
-- The CXX compiler identification is Clang 12.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /data/data/com.termux/files/usr/lib/libz.so (found version "1.2.11")
-- Found LibXml2: /data/data/com.termux/files/usr/lib/libxml2.so (found version "2.9.12")
-- Found LLVM 12.0.0
-- Using LLVMConfig.cmake in: /data/data/com.termux/files/usr/lib/cmake/llvm
-- Configuring done
-- Generating done
-- Build files have been written to: /data/data/com.termux/files/home/tlang_js/node_modules/llvm-node/build
info CMD BUILD
info RUN [
info RUN   'cmake',
info RUN   '--build',
info RUN   '/data/data/com.termux/files/home/tlang_js/node_modules/llvm-node/build',
info RUN   '--config',
info RUN   'Release'
info RUN ]
[1/45] Building CXX object CMakeFiles/llvm-node.dir/src/config/llvm-config.cc.o
[2/45] Building CXX object CMakeFiles/llvm-node.dir/src/config/config.cc.o
[3/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/attribute.cc.o
[4/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/array-type.cc.o
[5/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/atomic-rmw-inst.cc.o
[6/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/calling-conv.cc.o
[7/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/basic-block.cc.o
[8/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/alloca-inst.cc.o
[9/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/argument.cc.o
[10/45] Building CXX object CMakeFiles/llvm-node.dir/src/bitcode/bitcode.cc.o
[11/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-array.cc.o
[12/45] Building CXX object CMakeFiles/llvm-node.dir/src/bitcode/bitcode-writer.cc.o
[13/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-data-array.cc.o
[14/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/call-inst.cc.o
[15/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-pointer-null.cc.o
[16/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-struct.cc.o
[17/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-fp.cc.o
[18/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-int.cc.o
[19/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant.cc.o
[20/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/data-layout.cc.o
[21/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/function-type.cc.o
[22/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/integer-type.cc.o
[23/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/llvm-context.cc.o
[24/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/global-variable.cc.o
[25/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/linkage-types.cc.o
[26/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/function.cc.o
[27/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/module.cc.o
FAILED: CMakeFiles/llvm-node.dir/src/ir/module.cc.o
/data/data/com.termux/files/usr/bin/c++ -DNOMINMAX -Dllvm_node_EXPORTS -I/data/data/com.termux/files/home/.cmake-js/node-arm64/v14.15.4/include/node -I/data/data/com.termux/files/home/tlang_js/node_modules/nan -I/data/data/com.termux/files/home/tlang_js/node_modules/llvm-node/./node_modules/nan -O3 -DNDEBUG -fPIC   -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=gnu++14 -MD -MT CMakeFiles/llvm-node.dir/src/ir/module.cc.o -MF CMakeFiles/llvm-node.dir/src/ir/module.cc.o.d -o CMakeFiles/llvm-node.dir/src/ir/module.cc.o -c /data/data/com.termux/files/home/tlang_js/node_modules/llvm-node/src/ir/module.cc
/data/data/com.termux/files/home/tlang_js/node_modules/llvm-node/src/ir/module.cc:139:38: error: no member named 'getTypeByName' in 'llvm::Module'
    llvm::StructType* type = module->getTypeByName(name);
                             ~~~~~~  ^
1 error generated.
[28/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/pointer-type.cc.o
[29/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/struct-type.cc.o
[30/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/unnamed-addr.cc.o
[31/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/type.cc.o
[32/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/undef-value.cc.o
[33/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/ir.cc.o
[34/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/phi-node.cc.o
[35/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/value.cc.o
[36/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/ir-builder.cc.o
ninja: build stopped: subcommand failed.
info REP Build has been failed, trying to do a full rebuild.
info CMD CLEAN
info RUN [
info RUN   'cmake',
info RUN   '-E',
info RUN   'remove_directory',
info RUN   '/data/data/com.termux/files/home/tlang_js/node_modules/llvm-node/build'
info RUN ]                                                                              info CMD CONFIGURE
info RUN [                                                                              info RUN   'cmake',
info RUN   '/data/data/com.termux/files/home/tlang_js/node_modules/llvm-node',          info RUN   '--no-warn-unused-cli',
info RUN   '-G',                                                                        info RUN   'Ninja',
info RUN   '-DCMAKE_JS_VERSION=6.2.1',                                                  info RUN   '-DCMAKE_BUILD_TYPE=Release',
info RUN   '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/data/data/com.termux/files/home/tlang_js/node_modules/llvm-node/build/Release',
info RUN   '-DCMAKE_JS_INC=/data/data/com.termux/files/home/.cmake-js/node-arm64/v14.15.4/include/node;/data/data/com.termux/files/home/tlang_js/node_modules/nan',
info RUN   '-DCMAKE_JS_SRC=',                                                           info RUN   '-DNODE_RUNTIME=node',
info RUN   '-DNODE_RUNTIMEVERSION=14.15.4',
info RUN   '-DNODE_ARCH=arm64',                                                         info RUN   '-DLLVM_DIR=/data/data/com.termux/files/usr/lib/cmake/llvm'                  info RUN ]
Not searching for unused variables given on the command line.
-- The C compiler identification is Clang 12.0.0
-- The CXX compiler identification is Clang 12.0.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /data/data/com.termux/files/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /data/data/com.termux/files/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /data/data/com.termux/files/usr/lib/libz.so (found version "1.2.11")     -- Found LibXml2: /data/data/com.termux/files/usr/lib/libxml2.so (found version "2.9.12")                                                                                       -- Found LLVM 12.0.0
-- Using LLVMConfig.cmake in: /data/data/com.termux/files/usr/lib/cmake/llvm            -- Configuring done
-- Generating done                                                                      -- Build files have been written to: /data/data/com.termux/files/home/tlang_js/node_modules/llvm-node/build                                                                     info CMD BUILD
info RUN [                                                                              info RUN   'cmake',                                                                     info RUN   '--build',
info RUN   '/data/data/com.termux/files/home/tlang_js/node_modules/llvm-node/build',
info RUN   '--config',
info RUN   'Release'
info RUN ]
[1/45] Building CXX object CMakeFiles/llvm-node.dir/src/config/config.cc.o
[2/45] Building CXX object CMakeFiles/llvm-node.dir/src/config/llvm-config.cc.o
[3/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/attribute.cc.o
[4/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/array-type.cc.o
[5/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/calling-conv.cc.o
[6/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/argument.cc.o
[7/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/basic-block.cc.o
[8/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/atomic-rmw-inst.cc.o
[9/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/alloca-inst.cc.o
[10/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-array.cc.o         [11/45] Building CXX object CMakeFiles/llvm-node.dir/src/bitcode/bitcode.cc.o
[12/45] Building CXX object CMakeFiles/llvm-node.dir/src/bitcode/bitcode-writer.cc.o    [13/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-data-array.cc.o
[14/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/call-inst.cc.o              [15/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-int.cc.o
[16/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-fp.cc.o            [17/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-pointer-null.cc.o
[18/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant-struct.cc.o        [19/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/data-layout.cc.o
[20/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/function-type.cc.o          [21/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/constant.cc.o               [22/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/integer-type.cc.o
[23/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/linkage-types.cc.o
[24/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/llvm-context.cc.o
[25/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/global-variable.cc.o
[26/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/function.cc.o
[27/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/pointer-type.cc.o
[28/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/module.cc.o
FAILED: CMakeFiles/llvm-node.dir/src/ir/module.cc.o
/data/data/com.termux/files/usr/bin/c++ -DNOMINMAX -Dllvm_node_EXPORTS -I/data/data/com.termux/files/home/.cmake-js/node-arm64/v14.15.4/include/node -I/data/data/com.termux/files/home/tlang_js/node_modules/nan -I/data/data/com.termux/files/home/tlang_js/node_modules/llvm-node/./node_modules/nan -O3 -DNDEBUG -fPIC   -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -std=gnu++14 -MD -MT CMakeFiles/llvm-node.dir/src/ir/module.cc.o -MF CMakeFiles/llvm-node.dir/src/ir/module.cc.o.d -o CMakeFiles/llvm-node.dir/src/ir/module.cc.o -c /data/data/com.termux/files/home/tlang_js/node_modules/llvm-node/src/ir/module.cc
/data/data/com.termux/files/home/tlang_js/node_modules/llvm-node/src/ir/module.cc:139:38: error: no member named 'getTypeByName' in 'llvm::Module'
    llvm::StructType* type = module->getTypeByName(name);                                                            ~~~~~~  ^
1 error generated.                                                                      [29/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/struct-type.cc.o
[30/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/undef-value.cc.o            [31/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/phi-node.cc.o
[32/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/unnamed-addr.cc.o           [33/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/type.cc.o                   [34/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/ir.cc.o
[35/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/value.cc.o
[36/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/ir-builder.cc.o
[37/45] Building CXX object CMakeFiles/llvm-node.dir/src/ir/verifier.cc.o
ninja: build stopped: subcommand failed.
ERR! OMG Process terminated: 1
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
MichaReiser commented 3 years ago

Hi @leapofazzam123

Thanks for reporting this issue. Can you try the latest version from github? I think all that needs to be done is to make release the latest version.

I believe the following should work

yarn add https://github.com/MichaReiser/llvm-node.git
leap0x7b commented 3 years ago

It worked :). You just need to make a new release with LLVM 12 support on npm