Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure #16

Open
svkeerthy opened this issue Aug 1, 2024 · 1 comment
Open

Build failure #16

svkeerthy opened this issue Aug 1, 2024 · 1 comment

Comments

@svkeerthy
Copy link

Hello,

I am trying to build LLVM-MCAD with main branch of the llvm project. The build fails with the following error -

[63/2914] Building CXX object CMakeFiles/llvm-mcad.dir/Brokers/AsmUtils/CodeRegionGenerator.cpp.o
FAILED: CMakeFiles/llvm-mcad.dir/Brokers/AsmUtils/CodeRegionGenerator.cpp.o 
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -I/home/VK/llvm-project/llvm/include -I/home/VK/llvm-project/build/include -I/home/VK/LLVM-MCA-Daemon -fno-rtti -g -std=gnu++17   -D_GNU_SOURCE -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS  -fno-exceptions -funwind-tables -fno-rtti -MD -MT CMakeFiles/llvm-mcad.dir/Brokers/AsmUtils/CodeRegionGenerator.cpp.o -MF CMakeFiles/llvm-mcad.dir/Brokers/AsmUtils/CodeRegionGenerator.cpp.o.d -o CMakeFiles/llvm-mcad.dir/Brokers/AsmUtils/CodeRegionGenerator.cpp.o -c /home/VK/LLVM-MCA-Daemon/Brokers/AsmUtils/CodeRegionGenerator.cpp
/home/VK/LLVM-MCA-Daemon/Brokers/AsmUtils/CodeRegionGenerator.cpp: In member function ‘virtual llvm::Expected<const llvm::mca::CodeRegions&> llvm::mca::AsmCodeRegionGenerator::parseCodeRegions()’:
/home/VK/LLVM-MCA-Daemon/Brokers/AsmUtils/CodeRegionGenerator.cpp:126:57: error: no matching function for call to ‘llvm::Target::createAsmTargetStreamer(llvm::mca::MCStreamerWrapper&, llvm::formatted_raw_ostream&, std::unique_ptr<llvm::MCInstPrinter>::pointer, bool&) const’
  126 |                                          Opts.AsmVerbose);
      |                                                         ^
In file included from /home/VK/LLVM-MCA-Daemon/Brokers/AsmUtils/CodeRegionGenerator.h:23,
                 from /home/VK/LLVM-MCA-Daemon/Brokers/AsmUtils/CodeRegionGenerator.cpp:16:
/home/VK/llvm-project/llvm/include/llvm/MC/TargetRegistry.h:553:21: note: candidate: ‘llvm::MCTargetStreamer* llvm::Target::createAsmTargetStreamer(llvm::MCStreamer&, llvm::formatted_raw_ostream&, llvm::MCInstPrinter*) const’
  553 |   MCTargetStreamer *createAsmTargetStreamer(MCStreamer &S,
      |                     ^~~~~~~~~~~~~~~~~~~~~~~
/home/VK/llvm-project/llvm/include/llvm/MC/TargetRegistry.h:553:21: note:   candidate expects 3 arguments, 4 provided
[84/2914] Building CXX object _deps/grpc-build/CMakeFiles...rc/core/ext/filters/channel_idle/channel_idle_filter.cc.o
In file included from /home/VK/LLVM-MCA-Daemon/build/_deps/grpc-src/src/core/ext/filters/channel_idle/channel_idle_filter.cc:48:
/home/VK/LLVM-MCA-Daemon/build/_deps/grpc-src/src/core/lib/promise/loop.h:127:31: warning: attribute ignored in declaration of ‘union grpc_core::promise_detail::Loop<F>::<unnamed>’ [-Wattributes]
  127 |   GPR_NO_UNIQUE_ADDRESS union {
      |                               ^
/home/VK/LLVM-MCA-Daemon/build/_deps/grpc-src/src/core/lib/promise/loop.h:127:31: note: attribute for ‘union grpc_core::promise_detail::Loop<F>::<unnamed>’ must follow the ‘union’ keyword
[88/2914] Building CXX object _deps/grpc-build/CMakeFiles...r/src/core/ext/filters/client_channel/client_channel.cc.o
ninja: build stopped: subcommand failed.

Any inputs on how to handle this?

Also, would it be possible to use MCAD with other versions of LLVM? Say 17.x? Build with LLVM 17.x also fails with a similar error -

[8/10] Building CXX object CMakeFiles/llvm-mcad.dir/llvm-mcad.cpp.o
FAILED: CMakeFiles/llvm-mcad.dir/llvm-mcad.cpp.o 
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -I/home/VK/llvm-project/install/include -I/home/VK/LLVM-MCA-Daemon -fno-rtti -g -std=gnu++17   -D_GNU_SOURCE -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_LIBCPP_ENABLE_HARDENED_MODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS  -fno-exceptions -funwind-tables -fno-rtti -MD -MT CMakeFiles/llvm-mcad.dir/llvm-mcad.cpp.o -MF CMakeFiles/llvm-mcad.dir/llvm-mcad.cpp.o.d -o CMakeFiles/llvm-mcad.dir/llvm-mcad.cpp.o -c /home/VK/LLVM-MCA-Daemon/llvm-mcad.cpp
/home/VK/LLVM-MCA-Daemon/llvm-mcad.cpp: In function ‘int main(int, char**)’:
/home/VK/LLVM-MCA-Daemon/llvm-mcad.cpp:361:71: error: no matching function for call to ‘llvm::mca::InstrBuilder::InstrBuilder(llvm::MCSubtargetInfo&, llvm::MCInstrInfo&, llvm::MCRegisterInfo&, std::unique_ptr<llvm::MCInstrAnalysis>::pointer, llvm::mca::InstrumentManager&, llvm::cl::opt<unsigned int>&)’
  361 |   mca::InstrBuilder IB(*STI, *MCII, *MRI, MCIA.get(), *IM, CallLatency);
      |                                                                       ^
In file included from /home/VK/LLVM-MCA-Daemon/llvm-mcad.cpp:18:
/home/VK/llvm-project/install/include/llvm/MCA/InstrBuilder.h:100:3: note: candidate: ‘llvm::mca::InstrBuilder::InstrBuilder(const llvm::MCSubtargetInfo&, const llvm::MCInstrInfo&, const llvm::MCRegisterInfo&, const llvm::MCInstrAnalysis*, const llvm::mca::InstrumentManager&)’
  100 |   InstrBuilder(const MCSubtargetInfo &STI, const MCInstrInfo &MCII,
      |   ^~~~~~~~~~~~
/home/VK/llvm-project/install/include/llvm/MCA/InstrBuilder.h:100:3: note:   candidate expects 5 arguments, 6 provided
[9/10] Building CXX object CMakeFiles/llvm-mcad.dir/MCAWorker.cpp.o
ninja: build stopped: subcommand failed.

Thanks!

@chinmaydd
Copy link
Member

chinmaydd commented Aug 11, 2024

Hi @svkeerthy, I would recommend using the main branch to work with upstream LLVM. After following instructions in the README (using upstream LLVM commit and applying the Identifier patch) I am able to get MCAD working.

Here's the commit I am working with -

commit 846dccce9cd030a1984a4d4336267cd2850e6bd8 (upstream/main)
Author: Jacek Caban <[email protected]>
Date:   Sun Aug 11 19:03:09 2024 +0200

    [LLD][COFF] Validate import library machine type. (#102738)

Let me know if you run into issues. That branch is still a bit experimental, so I would advise some caution when using it.

Working with other versions of LLVM is going to be tricky as some core MCA APIs have changed in the past few years. We only support custom LLVM (with the broker-improvements branch) or upstream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants