harvard-acc / LLVM-Tracer

An LLVM pass to profile dynamic LLVM IR instructions and runtime values
Other
135 stars 35 forks source link

Can't build the project #34

Closed AtanuBarai closed 4 years ago

AtanuBarai commented 4 years ago

Hi I am trying to install LLVM-Tracer on CentOS 8 machine. But when I try to build it it fails with following output:

[ 14%] Built target full_trace [ 35%] Built target trace_logger [ 35%] Built target PROFILE_FUNC [ 42%] Linking CXX executable get-labeled-stmts /home/atanu/installs/llvm-6.0.1/lib/libclangFrontend.a(CompilerInvocation.cpp.o): In functionsetPGOUseInstrumentor(clang::CodeGenOptions&, llvm::Twine const&)': /home/atanu/installers/llvm-project-llvmorg-6.0.1/clang/lib/Frontend/CompilerInvocation.cpp:420: undefined reference to llvm::IndexedInstrProfReader::create(llvm::Twine const&)' /home/atanu/installs/llvm-6.0.1/lib/libLLVMCore.a(AsmWriter.cpp.o): In function(anonymous namespace)::MDFieldPrinter::printTag(llvm::DINode const)': /home/atanu/installers/llvm-project-llvmorg-6.0.1/llvm/lib/IR/AsmWriter.cpp:1485: undefined reference to llvm::dwarf::TagString(unsigned int)' /home/atanu/installs/llvm-6.0.1/lib/libLLVMCore.a(AsmWriter.cpp.o): In function(anonymous namespace)::MDFieldPrinter::printMacinfoType(llvm::DIMacroNode const)': /home/atanu/installers/llvm-project-llvmorg-6.0.1/llvm/lib/IR/AsmWriter.cpp:1494: undefined reference to llvm::dwarf::MacinfoString(unsigned int)' /home/atanu/installs/llvm-6.0.1/lib/libLLVMCore.a(AsmWriter.cpp.o): In functionwriteDIBasicType(llvm::raw_ostream&, llvm::DIBasicType const, (anonymous namespace)::TypePrinting, llvm::SlotTracker, llvm::Module const)': /home/atanu/installers/llvm-project-llvmorg-6.0.1/llvm/lib/IR/AsmWriter.cpp:1650: undefined reference to llvm::dwarf::AttributeEncodingString(unsigned int)' /home/atanu/installs/llvm-6.0.1/lib/libLLVMCore.a(AsmWriter.cpp.o): In functionwriteDICompositeType(llvm::raw_ostream&, llvm::DICompositeType const, (anonymous namespace)::TypePrinting, llvm::SlotTracker, llvm::Module const)': /home/atanu/installers/llvm-project-llvmorg-6.0.1/llvm/lib/IR/AsmWriter.cpp:1694: undefined reference to llvm::dwarf::LanguageString(unsigned int)' /home/atanu/installs/llvm-6.0.1/lib/libLLVMCore.a(AsmWriter.cpp.o): In functionwriteDISubroutineType(llvm::raw_ostream&, llvm::DISubroutineType const, (anonymous namespace)::TypePrinting, llvm::SlotTracker, llvm::Module const)': /home/atanu/installers/llvm-project-llvmorg-6.0.1/llvm/lib/IR/AsmWriter.cpp:1708: undefined reference to llvm::dwarf::ConventionString(unsigned int)' /home/atanu/installs/llvm-6.0.1/lib/libLLVMCore.a(AsmWriter.cpp.o): In functionwriteDICompileUnit(llvm::raw_ostream&, llvm::DICompileUnit const, (anonymous namespace)::TypePrinting, llvm::SlotTracker, llvm::Module const)': /home/atanu/installers/llvm-project-llvmorg-6.0.1/llvm/lib/IR/AsmWriter.cpp:1732: undefined reference to llvm::dwarf::LanguageString(unsigned int)' /home/atanu/installs/llvm-6.0.1/lib/libLLVMCore.a(AsmWriter.cpp.o): In functionwriteDISubprogram(llvm::raw_ostream&, llvm::DISubprogram const, (anonymous namespace)::TypePrinting, llvm::SlotTracker, llvm::Module const)': /home/atanu/installers/llvm-project-llvmorg-6.0.1/llvm/lib/IR/AsmWriter.cpp:1770: undefined reference to llvm::dwarf::VirtualityString(unsigned int)' /home/atanu/installs/llvm-6.0.1/lib/libLLVMCore.a(AsmWriter.cpp.o): In functionwriteDIExpression(llvm::raw_ostream&, llvm::DIExpression const, (anonymous namespace)::TypePrinting, llvm::SlotTracker, llvm::Module const)': /home/atanu/installers/llvm-project-llvmorg-6.0.1/llvm/lib/IR/AsmWriter.cpp:1928: undefined reference to llvm::dwarf::OperationEncodingString(unsigned int)' collect2: error: ld returned 1 exit status make[2]: *** [ast-pass/CMakeFiles/get-labeled-stmts.dir/build.make:86: ast-pass/get-labeled-stmts] Error 1 make[1]: *** [CMakeFiles/Makefile2:258: ast-pass/CMakeFiles/get-labeled-stmts.dir/all] Error 2 make: *** [Makefile:141: all] Error 2

The output of cmake .. command is as follows:

`- use LLVM_ROOT : /home/atanu/installs/llvm-6.0.1 -- find LLVM-Config : /home/atanu/installs/llvm-6.0.1/bin/llvm-config -- LLVM version : 6.0.1 CMake Warning (dev) at cmake-scripts/LLVMFinder/loadLLVMModule.cmake:35 (find_package): Policy CMP0074 is not set: find_package uses _ROOT variables. Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

CMake variable LLVM_ROOT is set to:

/home/atanu/installs/llvm-6.0.1

For compatibility, CMake is ignoring the variable. Call Stack (most recent call first): cmake-scripts/LLVMFinder/findLLVM.cmake:95 (loadLLVMModule) cmake-scripts/LLVMFinder/findLLVM.cmake:135 (LOAD_LLVM_SETTINGS) cmake-scripts/findAndSetLLVM.cmake:13 (FIND_LLVM) CMakeLists.txt:8 (include) This warning is for project developers. Use -Wno-dev to suppress it.

llvm-config: unknown component name: jit -- LLVM_LINK found : /home/atanu/installs/llvm-6.0.1/bin/llvm-link -- LLVM_OPT found : /home/atanu/installs/llvm-6.0.1/bin/opt -- LLVM_LLC found : /home/atanu/installs/llvm-6.0.1/bin/llc -- LLVM_COMPILER found : /home/atanu/installs/llvm-6.0.1/bin/clang-6.0 -- Found Curses: /usr/lib64/libcurses.so
-- Configuring done -- Generating done -- Build files have been written to: /home/atanu/work/LLVM-Tracer/build ` The GCC version is 8.0.1

AtanuBarai commented 4 years ago

On macOS Catalina, the build also fails with

ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [full-trace/full_trace.dylib] Error 1 make[1]: *** [full-trace/CMakeFiles/full_trace.dir/all] Error 2 make: *** [all] Error 2

xyzsam commented 4 years ago

Sorry for the delay. It doesn't look like you're using the Docker image, and we don't support MacOS either.

AtanuBarai commented 4 years ago

Hi,

I have tried to build the llvm-6.0 branch of LLVM-Tracer on Ubuntu 18.04. But it also failed in there. The cmake command worked fine and generated the build files. But the make command failed with the following error.

[ 50%] Linking CXX executable get-labeled-stmts /home/atanu/Installs/llvm-6.0/lib/libclangFrontend.a(CompilerInvocation.cpp.o): In function clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, char const* const*, char const* const*, clang::DiagnosticsEngine&)': CompilerInvocation.cpp:(.text._ZN5clang18CompilerInvocation14CreateFromArgsERS0_PKPKcS5_RNS_17DiagnosticsEngineE+0x4b70): undefined reference tollvm::IndexedInstrProfReader::create(llvm::Twine const&)' /home/atanu/Installs/llvm-6.0/lib/libLLVMCore.a(AsmWriter.cpp.o): In function writeDIExpression(llvm::raw_ostream&, llvm::DIExpression const*, (anonymous namespace)::TypePrinting*, llvm::SlotTracker*, llvm::Module const*) [clone .isra.261]': AsmWriter.cpp:(.text._ZL17writeDIExpressionRN4llvm11raw_ostreamEPKNS_12DIExpressionEPN12_GLOBAL__N_112TypePrintingEPNS_11SlotTrackerEPKNS_6ModuleE.isra.261+0x6c): undefined reference tollvm::dwarf::OperationEncodingString(unsigned int)' /home/atanu/Installs/llvm-6.0/lib/libLLVMCore.a(AsmWriter.cpp.o): In function (anonymous namespace)::MDFieldPrinter::printTag(llvm::DINode const*)': AsmWriter.cpp:(.text._ZN12_GLOBAL__N_114MDFieldPrinter8printTagEPKN4llvm6DINodeE+0x3e): undefined reference tollvm::dwarf::TagString(unsigned int)' /home/atanu/Installs/llvm-6.0/lib/libLLVMCore.a(AsmWriter.cpp.o): In function WriteMDNodeBodyInternal(llvm::raw_ostream&, llvm::MDNode const*, (anonymous namespace)::TypePrinting*, llvm::SlotTracker*, llvm::Module const*)': AsmWriter.cpp:(.text._ZL23WriteMDNodeBodyInternalRN4llvm11raw_ostreamEPKNS_6MDNodeEPN12_GLOBAL__N_112TypePrintingEPNS_11SlotTrackerEPKNS_6ModuleE+0xc8): undefined reference tollvm::dwarf::MacinfoString(unsigned int)' AsmWriter.cpp:(.text._ZL23WriteMDNodeBodyInternalRN4llvm11raw_ostreamEPKNS_6MDNodeEPN12_GLOBALN_112TypePrintingEPNS_11SlotTrackerEPKNS_6ModuleE+0xc5f): undefined reference to llvm::dwarf::ConventionString(unsigned int)' AsmWriter.cpp:(.text._ZL23WriteMDNodeBodyInternalRN4llvm11raw_ostreamEPKNS_6MDNodeEPN12_GLOBAL__N_112TypePrintingEPNS_11SlotTrackerEPKNS_6ModuleE+0xf1e): undefined reference tollvm::dwarf::AttributeEncodingString(unsigned int)' AsmWriter.cpp:(.text._ZL23WriteMDNodeBodyInternalRN4llvm11raw_ostreamEPKNS_6MDNodeEPN12_GLOBALN_112TypePrintingEPNS_11SlotTrackerEPKNS_6ModuleE+0xf6f): undefined reference to llvm::dwarf::LanguageString(unsigned int)' AsmWriter.cpp:(.text._ZL23WriteMDNodeBodyInternalRN4llvm11raw_ostreamEPKNS_6MDNodeEPN12_GLOBAL__N_112TypePrintingEPNS_11SlotTrackerEPKNS_6ModuleE+0x14bd): undefined reference tollvm::dwarf::VirtualityString(unsigned int)' AsmWriter.cpp:(.text._ZL23WriteMDNodeBodyInternalRN4llvm11raw_ostreamEPKNS_6MDNodeEPN12_GLOBAL__N_112TypePrintingEPNS_11SlotTrackerEPKNS_6ModuleE+0x17ca): undefined reference to `llvm::dwarf::LanguageString(unsigned int)' collect2: error: ld returned 1 exit status ast-pass/CMakeFiles/get-labeled-stmts.dir/build.make:102: recipe for target 'ast-pass/get-labeled-stmts' failed make[2]: [ast-pass/get-labeled-stmts] Error 1 CMakeFiles/Makefile2:274: recipe for target 'ast-pass/CMakeFiles/get-labeled-stmts.dir/all' failed make[1]: [ast-pass/CMakeFiles/get-labeled-stmts.dir/all] Error 2 Makefile:157: recipe for target 'all' failed make: *** [all] Error 2

I am trying to build LLVM-Tracer on a machine where I don't have access to docker. Any help regarding this issue will be really helpful for me.

xyzsam commented 4 years ago

Not sure why your system isn't finding the libraries, but have you looked at this thread? http://lists.llvm.org/pipermail/llvm-dev/2012-July/051613.html

Sam Xi Google Inc., Software Engineer http://www.samxi.org

On Wed, Mar 25, 2020 at 12:30 PM Atanu Barai notifications@github.com wrote:

Hi,

I have tried to build the llvm-6.0 branch of LLVM-Tracer on Ubuntu 18.04. But it also failed in there. The cmake command worked fine and generated the build files. But the make command failed with the following error.

[ 50%] Linking CXX executable get-labeled-stmts /home/atanu/Installs/llvm-6.0/lib/libclangFrontend.a(CompilerInvocation.cpp.o): In function clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, char const const, char const const, clang::DiagnosticsEngine&)': CompilerInvocation.cpp:(.text._ZN5clang18CompilerInvocation14CreateFromArgsERS0_PKPKcS5_RNS_17DiagnosticsEngineE+0x4b70): undefined reference to llvm::IndexedInstrProfReader::create(llvm::Twine const&)' /home/atanu/Installs/llvm-6.0/lib/libLLVMCore.a(AsmWriter.cpp.o): In function writeDIExpression(llvm::raw_ostream&, llvm::DIExpression const, (anonymous namespace)::TypePrinting, llvm::SlotTracker, llvm::Module const) [clone .isra.261]': AsmWriter.cpp:(.text._ZL17writeDIExpressionRN4llvm11raw_ostreamEPKNS_12DIExpressionEPN12_GLOBALN_112TypePrintingEPNS_11SlotTrackerEPKNS_6ModuleE.isra.261+0x6c): undefined reference to llvm::dwarf::OperationEncodingString(unsigned int)' /home/atanu/Installs/llvm-6.0/lib/libLLVMCore.a(AsmWriter.cpp.o): In function (anonymous namespace)::MDFieldPrinter::printTag(llvm::DINode const)': AsmWriter.cpp:(.text._ZN12_GLOBAL__N_114MDFieldPrinter8printTagEPKN4llvm6DINodeE+0x3e): undefined reference to llvm::dwarf::TagString(unsigned int)' /home/atanu/Installs/llvm-6.0/lib/libLLVMCore.a(AsmWriter.cpp.o): In function WriteMDNodeBodyInternal(llvm::raw_ostream&, llvm::MDNode const, (anonymous namespace)::TypePrinting, llvm::SlotTracker, llvm::Module const*)': AsmWriter.cpp:(.text._ZL23WriteMDNodeBodyInternalRN4llvm11raw_ostreamEPKNS_6MDNodeEPN12_GLOBAL__N_112TypePrintingEPNS_11SlotTrackerEPKNS_6ModuleE+0xc8): undefined reference to llvm::dwarf::MacinfoString(unsigned int)' AsmWriter.cpp:(.text._ZL23WriteMDNodeBodyInternalRN4llvm11raw_ostreamEPKNS_6MDNodeEPN12_GLOBALN_112TypePrintingEPNS_11SlotTrackerEPKNS_6ModuleE+0xc5f): undefined reference to llvm::dwarf::ConventionString(unsigned int)' AsmWriter.cpp:(.text._ZL23WriteMDNodeBodyInternalRN4llvm11raw_ostreamEPKNS_6MDNodeEPN12_GLOBALN_112TypePrintingEPNS_11SlotTrackerEPKNS_6ModuleE+0xf1e): undefined reference to llvm::dwarf::AttributeEncodingString(unsigned int)' AsmWriter.cpp:(.text._ZL23WriteMDNodeBodyInternalRN4llvm11raw_ostreamEPKNS_6MDNodeEPN12_GLOBAL__N_112TypePrintingEPNS_11SlotTrackerEPKNS_6ModuleE+0xf6f): undefined reference to llvm::dwarf::LanguageString(unsigned int)' AsmWriter.cpp:(.text._ZL23WriteMDNodeBodyInternalRN4llvm11raw_ostreamEPKNS_6MDNodeEPN12_GLOBALN_112TypePrintingEPNS_11SlotTrackerEPKNS_6ModuleE+0x14bd): undefined reference to llvm::dwarf::VirtualityString(unsigned int)' AsmWriter.cpp:(.text._ZL23WriteMDNodeBodyInternalRN4llvm11raw_ostreamEPKNS_6MDNodeEPN12_GLOBAL__N_112TypePrintingEPNS_11SlotTrackerEPKNS_6ModuleE+0x17ca): undefined reference to `llvm::dwarf::LanguageString(unsigned int)' collect2: error: ld returned 1 exit status ast-pass/CMakeFiles/get-labeled-stmts.dir/build.make:102: recipe for target 'ast-pass/get-labeled-stmts' failed make[2]: [ast-pass/get-labeled-stmts] Error 1 CMakeFiles/Makefile2:274: recipe for target 'ast-pass/CMakeFiles/get-labeled-stmts.dir/all' failed make[1]: [ast-pass/CMakeFiles/get-labeled-stmts.dir/all] Error 2 Makefile:157: recipe for target 'all' failed make: *** [all] Error 2

I am trying to build LLVM-Tracer on a machine where I don't have access to docker. Any help regarding this issue will be really helpful for me.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ysshao/LLVM-Tracer/issues/34#issuecomment-604041100, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKLCXHMAP6DMENUFK4LKMLRJJLWZANCNFSM4LKLHPIQ .

xyzsam commented 4 years ago

Closing due to lack of activity. Feel free to reopen if you still have this issue.

arunkmv commented 3 years ago

Got the same LLVM / Clang linker errors as above, adding the LLVM install directory to $PATHsolved it.