MichaReiser / llvm-node

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

yarn add llvm-node build error in macOS #139

Closed TbhT closed 2 years ago

TbhT commented 2 years ago

The system info: mac 12.0.1 , macOS Monterey.

When i run yarn add llvm-node, it occurs as follows:

info RUN cmake "/Users/[**user-path**]/llvm-node" --no-warn-unused-cli -G"Unix Makefiles" 
-DCMAKE_JS_VERSION="6.1.0" -DCMAKE_BUILD_TYPE="Release" 
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY="/Users/[**user-path**]/llvm-node/build/Release" 
-DCMAKE_JS_INC="/Users/[**user-path**]/.cmake-js/node-x64/v14.17.4/include/node;
/Users/[**user-path**]/llvm-node/node_modules/nan" -DCMAKE_JS_SRC="" 
-DNODE_RUNTIME="node" 
-DNODE_RUNTIMEVERSION="14.17.4" -DNODE_ARCH="x64" -DCMAKE_CXX_FLAGS="
-D_DARWIN_USE_64_BIT_INODE=1 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DBUILDING_NODE_EXTENSION" 
-DCMAKE_SHARED_LINKER_FLAGS="-undefined dynamic_lookup"
Not searching for unused variables given on the command line.
-- The C compiler identification is AppleClang 13.0.0.13000029
-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/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: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found ZLIB: /Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/lib/libz.tbd (found version "1.2.11")
-- Found LibXml2: /Library/Developer/CommandLineTools/SDKs/MacOSX12.0.sdk/usr/lib/libxml2.tbd (found version "2.9.4")
-- Found LLVM 13.0.0
-- Using LLVMConfig.cmake in: /usr/local/opt/llvm/lib/cmake/llvm
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/[**user-path**]/llvm-node/build
info CMD BUILD
info RUN cmake --build "/Users/[**user-path**]/llvm-node/build" --config Release
[  2%] Building CXX object CMakeFiles/llvm-node.dir/src/bitcode/bitcode-writer.cc.o
/Users/[**user-path**]/llvm-node/src/bitcode/bitcode-writer.cc:24:77: error: no member named 'F_None' in namespace 'llvm::sys::fs'; did you mean 'OF_None'?
    llvm::raw_fd_ostream byteCodeFile { fileName, errorCode, llvm::sys::fs::F_None };
                                                             ~~~~~~~~~~~~~~~^~~~~~
                                                                            OF_None
/usr/local/opt/llvm/include/llvm/Support/FileSystem.h:757:3: note: 'OF_None' declared here
  OF_None = 0,
  ^
1 error generated.
make[2]: *** [CMakeFiles/llvm-node.dir/src/bitcode/bitcode-writer.cc.o] Error 1
make[1]: *** [CMakeFiles/llvm-node.dir/all] Error 2
make: *** [all] Error 2
ERR! OMG Process terminated: 2
error Command failed with exit code 1.

Is it some problems about macos system?

thanks for the response.

ApsarasX commented 2 years ago

你这个错误是LLVM版本不兼容导致的,LLVM 13删除了llvm::sys::fs::F_None这个枚举,你可以把本机的LLVM版本换成12.0.1,或者手动修改源码,把F_None换成OF_None并重新编译.

TbhT commented 2 years ago

你这个错误是LLVM版本不兼容导致的,LLVM 13删除了llvm::sys::fs::F_None这个枚举,你可以把本机的LLVM版本换成12.0.1,或者手动修改源码,把F_None换成OF_None并重新编译.

你可以试试我写的llvm-bindings, 跟llvm-node功能相同,不过是基于Node.js最新的插件技术做的,最新版本兼容LLVM 13

Yes , the problem is resolved by downgrade llvm13 to llvm12, and I will try llvm-bindings later .

Thanks .