Я следую этому учебнику, чтобы выучить LLVM. Однако, когда я пытаюсь запустить первый скелет с clang -Xclang -load -Xclang build/skeleton/libSkeletonPass.* something.c
, возникают ошибки:
$ clang -Xclang -load -Xclang build/skeleton/libSkeletonPass.* something.c
I saw a function called main!
Stack dump:
... elided some output ...
0 clang-9 0x000000010da27de6 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 clang-9 0x000000010da28238 SignalHandler(int) + 180
2 libsystem_platform.dylib 0x00007fff61560b5d _sigtramp + 29
3 libsystem_platform.dylib 0x0000000000000001 _sigtramp + 18446603338883134657
4 clang-9 0x000000010d6c0a25 llvm::object_deleter<llvm::SmallVector<std::__1::pair<llvm::PassManagerBuilder::ExtensionPointTy, std::__1::function<void (llvm::PassManagerBuilder const&, llvm::legacy::PassManagerBase&)> >, 8u> >::call(void*) + 19
5 clang-9 0x000000010d9d7fa5 llvm::llvm_shutdown() + 53
6 clang-9 0x000000010d9bf371 llvm::InitLLVM::~InitLLVM() + 15
7 clang-9 0x000000010c860847 main + 7249
8 libdyld.dylib 0x00007fff613753d5 start + 1
clang-9: error: unable to execute command: Segmentation fault: 11
clang-9: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 9.0.1
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
clang-9: note: diagnostic msg: PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
clang-9: error: unable to execute command: Segmentation fault: 11
clang-9: note: diagnostic msg: Error generating preprocessed source(s).
Я могу правильно скомпилировать файл C / C ++ с помощью clang в LLVM. Я использовал флаг clang''s
-v ':
$ /usr/local/opt/llvm/bin/clang++ -v -x c++ /dev/null -fsyntax-only
clang version 9.0.1
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
... elided some output ...
lang -cc1 version 9.0.1 based upon LLVM 9.0.1 default target x86_64-apple-darwin18.7.0
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/opt/llvm/bin/../include/c++/v1
/usr/local/Cellar/llvm/9.0.1/lib/clang/9.0.1/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
Как я могу исправить эти ошибки? Я не знаю, что делать.