I downloaded LLVM (12.0.1) from the script file llvm.sh
which they have now started to include on their Debian downloads page.
Ran clang and everything was working as expected(good job dev team I guess?).
The installation script installed LLVM in /usr/lib/LLVM-12/
and /usr/include/LLVM-12/
(these had some .h files)
So I tried writing some passes; created an out-of-tree build using the answer given here: Facing issue with makefile for Hello pass in llvm
But when I ran the make, it gave me this error:
/usr/include/llvm-12/llvm/Pass.h:337:10: fatal error: llvm/PassAnalysisSupport.h: No file or directory
337 | #include "llvm/PassAnalysisSupport.h"
|
compilation terminated.
So I checked /usr/include/llvm-12/llvm/
and found that Pass.h
and PassAnalysisSupport.h
both were present in the current directory, so shouldn't the Pass.h
file have #include "PassAnalysisSupport.h"
instead of the present #include "llvm/PassAnalysisSupport.h"
?
I also checked the code for Pass.h
online and it also had #include "llvm/PassAnalysisSupport.h"
. Other header files in the llvm directory also used the same format #include "llvm/<name>"
So what is going on here, who messed up, the devs or my llvm.sh (also the devs) or the problem is something else?
Any help would be appreciated (Im using Mint MATE 20.2 if thats relevant)
Source file (headers; firstpass/first/fpass.cpp
):
#include <llvm-12/llvm/Pass.h>
#include <llvm-12/llvm/IR/Function.h>
#include <llvm-12/llvm/Support/raw_ostream.h>
#include <llvm-12/llvm/IR/LegacyPassManager.h>
#include <llvm-12/llvm/Transforms/IPO/PassManagerBuilder.h>
(firstpass/CMakeLists.txt
):
find_package(LLVM REQUIRED CONFIG)
include_directories($(LLVM_INCLUDE_DIRS))
add_subdirectory(first)
(firstpass/first/CMakeLists.txt
):
add_library(LLVMfirst MODULE fpass.cpp)