/usr/bin/ld: cannot find -lLLVMX86AsmPrinter
/usr/bin/ld: cannot find -lLLVMX86Utils
/usr/bin/ld: cannot find -lLLVMipa
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [CMakeFiles/goodcommit.dir/build.make:97: goodcommit] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/goodcommit.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
here is my CMakeLists.txt file:
cmake_minimum_required(VERSION 3.22)
project(goodcommit)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
set(LLVM_PATH /usr/lib/llvm-14)
link_directories(${LLVM_PATH}/lib)
include_directories(${LLVM_PATH}/include)
add_definitions(
-D__STDC_LIMIT_MACROS
-D__STDC_CONSTANT_MACROS
)
# Use llvm-config to get compilation flags
execute_process(
COMMAND llvm-config --cxxflags
OUTPUT_VARIABLE LLVM_CXX_FLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Use llvm-config to get linking flags
execute_process(
COMMAND llvm-config --ldflags
OUTPUT_VARIABLE LLVM_LD_FLAGS
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Set the compilation flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LLVM_CXX_FLAGS}")
# Set the linking flags
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LLVM_LD_FLAGS}")
set(SOURCE_FILE main.cpp)
add_executable(goodcommit ${SOURCE_FILE})
target_link_libraries(goodcommit
clangFrontend
clangSerialization
clangDriver
clangParse
clangSema
clangAnalysis
clangAST
clangBasic
clangEdit
clangLex
clangTooling
LLVMX86AsmParser
LLVMX86Desc
LLVMX86AsmPrinter
LLVMX86Info
LLVMX86Utils
LLVMipo
LLVMScalarOpts
LLVMInstCombine
LLVMTransformUtils
LLVMipa
LLVMAnalysis
LLVMTarget
LLVMOption
LLVMMCParser
LLVMMC
LLVMObject
LLVMBitReader
LLVMCore
LLVMSupport
-lgit2
)
I have tried following the steps of building llvm project but it doesn't seem to lead anywhere! Plus my header
doesn't seem to be recognized.
Does anyone know how to solve this ?
0 comments:
Post a Comment
Thanks