qe-compiler icon indicating copy to clipboard operation
qe-compiler copied to clipboard

Build errors

Open miniskar opened this issue 9 months ago • 5 comments

I am getting several compilation errors during the build. I have followed the steps exactly as mentioned in the README.

/home/nqx/.conan/data/llvm/17.0.5-0/_/_/package/fa4e83519b8c7ca96c21cb33c75ecc7a417721c3/include/llvm/Support/Error.h:1249: error: undefined reference to 'llvm::Twine::str() const' /home/nqx/Quantum/quantum-resources/tmp/qe-compiler/targets/systems/mock/MockTarget.cpp:282: error: undefined reference to 'llvm::sys::getDefaultTargetTriple()' /home/nqx/Quantum/quantum-resources/tmp/qe-compiler/targets/systems/mock/MockTarget.cpp:285: error: undefined reference to 'llvm::TargetRegistry::lookupTarget(llvm::StringRef, std::string&)' /home/nqx/Quantum/quantum-resources/tmp/qe-compiler/targets/systems/mock/MockTarget.cpp:294: error: undefined reference to 'llvm::SubtargetFeatures::getString() const' /home/nqx/Quantum/quantum-resources/tmp/qe-compiler/include/Conversion/QUIRToLLVM/QUIRToLLVM.h:85: error: undefined reference to 'mlir::FrozenRewritePatternSet::FrozenRewritePatternSet(mlir::RewritePatternSet&&, llvm::ArrayRef<std::string>, llvm::ArrayRef<std::string>)' /home/nqx/Quantum/quantum-resources/tmp/qe-compiler/targets/systems/mock/Conversion/QUIRToStandard/QUIRToStandard.cpp:293: error: undefined reference to 'mlir::FrozenRewritePatternSet::FrozenRewritePatternSet(mlir::RewritePatternSet&&, llvm::ArrayRef<std::string>, llvm::ArrayRef<std::string>)' /home/nqx/.conan/data/llvm/17.0.5-0/_/_/package/fa4e83519b8c7ca96c21cb33c75ecc7a417721c3/include/llvm/Support/CommandLine.h:652: error: undefined reference to 'vtable for llvm::cl::OptionValue<std::string>' /usr/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function /home/nqx/.conan/data/llvm/17.0.5-0/_/_/package/fa4e83519b8c7ca96c21cb33c75ecc7a417721c3/include/llvm/Support/CommandLine.h:1488: error: undefined reference to 'vtable for llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >' /usr/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function /home/nqx/.conan/data/llvm/17.0.5-0/_/_/package/fa4e83519b8c7ca96c21cb33c75ecc7a417721c3/include/llvm/Support/CommandLine.h:1158: error: undefined reference to 'vtable for llvm::cl::parser<std::string>' /usr/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function /home/nqx/.conan/data/llvm/17.0.5-0/_/_/package/fa4e83519b8c7ca96c21cb33c75ecc7a417721c3/include/llvm/Support/CommandLine.h:1158: error: undefined reference to 'vtable for llvm::cl::parser<std::string>' /usr/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function /home/nqx/Quantum/quantum-resources/tmp/qe-compiler/lib/Frontend/OpenQASM3/OpenQASM3Frontend.cpp:105: error: undefined reference to 'llvm::StringRef::lower() const' /home/nqx/Quantum/quantum-resources/tmp/qe-compiler/lib/Config/QSSConfig.cpp:326: error: undefined reference to 'mlir::DialectPlugin::load(std::string const&)' /home/nqx/Quantum/quantum-resources/tmp/qe-compiler/lib/Config/QSSConfig.cpp:336: error: undefined reference to 'mlir::PassPlugin::load(std::string const&)' /home/nqx/.conan/data/llvm/17.0.5-0/_/_/package/fa4e83519b8c7ca96c21cb33c75ecc7a417721c3/include/llvm/Support/CommandLine.h:652: error: undefined reference to 'vtable for llvm::cl::OptionValue<std::string>' /usr/bin/ld.gold: the vtable symbol may be undefined because the class is missing its key function /home/nqx/.conan/data/llvm/17.0.5-0/_/_/package/fa4e83519b8c7ca96c21cb33c75ecc7a417721c3/include/llvm/Support/CommandLine.h:1226: error: undefined reference to 'llvm::cl::parser<std::string>::printOptionDiff(llvm::cl::Option const&, llvm::StringRef, llvm::cl::OptionValue<std::string> const&, unsigned long) const' /home/nqx/Quantum/quantum-resources/tmp/qe-compiler/lib/Dialect/QUIR/Transforms/BreakReset.cpp:159: error: undefined reference to 'mlir::FrozenRewritePatternSet::FrozenRewritePatternSet(mlir::RewritePatternSet&&, llvm::ArrayRef<std::string>, llvm::ArrayRef<std::string>)' /home/nqx/Quantum/quantum-resources/tmp/qe-compiler/lib/Dialect/QUIR/Transforms/ReorderMeasurements.cpp:236: error: undefined reference to 'mlir::FrozenRewritePatternSet::FrozenRewritePatternSet(mlir::RewritePatternSet&&, llvm::ArrayRef<std::string>, llvm::ArrayRef<std::string>)' lib/libMLIRPulseTransforms.a(Passes.cpp.o):Passes.cpp:vtable for mlir::Pass::Option<std::string, llvm::cl::parser<std::string> >: error: undefined reference to 'llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::handleOccurrence(unsigned int, llvm::StringRef, llvm::StringRef)' lib/libMLIRPulseTransforms.a(Passes.cpp.o):Passes.cpp:vtable for mlir::Pass::Option<std::string, llvm::cl::parser<std::string> >: error: undefined reference to 'llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::getValueExpectedFlagDefault() const' lib/libMLIRPulseTransforms.a(Passes.cpp.o):Passes.cpp:vtable for mlir::Pass::Option<std::string, llvm::cl::parser<std::string> >: error: undefined reference to 'llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::getOptionWidth() const' lib/libMLIRPulseTransforms.a(Passes.cpp.o):Passes.cpp:vtable for mlir::Pass::Option<std::string, llvm::cl::parser<std::string> >: error: undefined reference to 'llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::printOptionInfo(unsigned long) const' lib/libMLIRPulseTransforms.a(Passes.cpp.o):Passes.cpp:vtable for mlir::Pass::Option<std::string, llvm::cl::parser<std::string> >: error: undefined reference to 'llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::printOptionValue(unsigned long, bool) const' lib/libMLIRPulseTransforms.a(Passes.cpp.o):Passes.cpp:vtable for mlir::Pass::Option<std::string, llvm::cl::parser<std::string> >: error: undefined reference to 'llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::setDefault()' lib/libMLIRPulseTransforms.a(Passes.cpp.o):Passes.cpp:vtable for mlir::Pass::Option<std::string, llvm::cl::parser<std::string> >: error: undefined reference to 'llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::getExtraOptionNames(llvm::SmallVectorImpl<llvm::StringRef>&)' lib/libMLIRPulseTransforms.a(Passes.cpp.o):Passes.cpp:typeinfo for mlir::detail::PassOptions::Option<std::string, llvm::cl::parser<std::string> >: error: undefined reference to 'typeinfo for llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >' lib/libMLIRPulseTransforms.a(Passes.cpp.o):Passes.cpp:vtable for mlir::detail::PassOptions::Option<std::string, llvm::cl::parser<std::string> >: error: undefined reference to 'llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::handleOccurrence(unsigned int, llvm::StringRef, llvm::StringRef)' lib/libMLIRPulseTransforms.a(Passes.cpp.o):Passes.cpp:vtable for mlir::detail::PassOptions::Option<std::string, llvm::cl::parser<std::string> >: error: undefined reference to 'llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::getValueExpectedFlagDefault() const' lib/libMLIRPulseTransforms.a(Passes.cpp.o):Passes.cpp:vtable for mlir::detail::PassOptions::Option<std::string, llvm::cl::parser<std::string> >: error: undefined reference to 'llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::getOptionWidth() const' lib/libMLIRPulseTransforms.a(Passes.cpp.o):Passes.cpp:vtable for mlir::detail::PassOptions::Option<std::string, llvm::cl::parser<std::string> >: error: undefined reference to 'llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::printOptionInfo(unsigned long) const' lib/libMLIRPulseTransforms.a(Passes.cpp.o):Passes.cpp:vtable for mlir::detail::PassOptions::Option<std::string, llvm::cl::parser<std::string> >: error: undefined reference to 'llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::printOptionValue(unsigned long, bool) const' lib/libMLIRPulseTransforms.a(Passes.cpp.o):Passes.cpp:vtable for mlir::detail::PassOptions::Option<std::string, llvm::cl::parser<std::string> >: error: undefined reference to 'llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::setDefault()' lib/libMLIRPulseTransforms.a(Passes.cpp.o):Passes.cpp:vtable for mlir::detail::PassOptions::Option<std::string, llvm::cl::parser<std::string> >: error: undefined reference to 'llvm::cl::opt<std::string, false, llvm::cl::parser<std::string> >::getExtraOptionNames(llvm::SmallVectorImpl<llvm::StringRef>&)' /home/nqx/Quantum/quantum-resources/tmp/qe-compiler/lib/Dialect/Pulse/Transforms/SchedulePort.cpp:252: error: undefined reference to 'llvm::toString(llvm::Error)' /home/nqx/Quantum/quantum-resources/tmp/qe-compiler/lib/Dialect/Pulse/Transforms/SchedulePort.cpp:260: error: undefined reference to 'llvm::toString(llvm::Error)' /home/nqx/Quantum/quantum-resources/tmp/qe-compiler/lib/Dialect/Pulse/Transforms/Scheduling.cpp:135: error: undefined reference to 'llvm::toString(llvm::Error)' /home/nqx/Quantum/quantum-resources/tmp/qe-compiler/lib/Conversion/QUIRToPulse/LoadPulseCals.cpp:388: error: undefined reference to 'mlir::openInputFile(llvm::StringRef, std::string*)' /home/nqx/Quantum/quantum-resources/tmp/qe-compiler/lib/Conversion/QUIRToPulse/QUIRToPulse.cpp:655: error: undefined reference to 'mlir::openInputFile(llvm::StringRef, std::string*)' /home/nqx/Quantum/quantum-resources/tmp/qe-compiler/lib/Dialect/Pulse/IR/PulseOps.cpp:183: error: undefined reference to 'llvm::toString(llvm::Error)'

Any suggestions to resolve these errors?

miniskar avatar Feb 28 '25 08:02 miniskar

HI @miniskar, this seems to be a linking error. Could you please post your Conan profile configuration and the system configuration you are using (os, compiler toolchain, etc.) as well as the exact commands you entered to build?

taalexander avatar Feb 28 '25 13:02 taalexander

I tried it using two different profiles.

  1. using gcc
[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=11
compiler.libcxx=libstdc++
build_type=Release
[options]
[build_requires]
[env]
  1. using clang
[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=clang
compiler.version=17
compiler.libcxx=libstdc++
build_type=Release
[options]
[build_requires]
[env]

Both are reporting same link time errors.

miniskar avatar Feb 28 '25 14:02 miniskar

Hmm, do you think you could post the full Cmakelogs so that I could look in more detail?

taalexander avatar Feb 28 '25 15:02 taalexander

I can reproduce this problem, here is my cmakelogs:

output_file.txt

bruno-ah-um avatar Aug 18 '25 19:08 bruno-ah-um

The problem was in the configuration of the conan profile. This project still uses Conan 1. In my case, the gcc version (14) was not recognized by Conan, and it defaults to use the old libsttdc standard. You need to change the configuration to libstdc+11 in your profile. When using libstc++ it looks like some projects like llvm still uses the new standard and but this project uses the old one, so it cannot link some functions.

Please verify that your configuration is:

compile.libcxx=libstdc++11

bruno-ah-um avatar Aug 19 '25 14:08 bruno-ah-um