#Linking Error

21 messages · Page 1 of 1 (latest)

uneven obsidian
teal spadeBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

#

@uneven obsidian

Screenshots!

Your message appears to contain screenshots but no code. Please send code and error messages in text instead of screenshots if applicable!

uneven obsidian
#
void ExecutableModule::write_obj_file(const std::filesystem::path& path)
{
    auto target_triple = llvm::sys::getDefaultTargetTriple();
    this->module->setTargetTriple(target_triple);
    std::string error;
    auto target = llvm::TargetRegistry::lookupTarget(target_triple, error);
    if (target == nullptr)
    {
        throw std::runtime_error(error);
    }
    const char* cpu = "generic";
    const char* features = "";
    llvm::TargetOptions options;
    auto machine = target->createTargetMachine(target_triple, cpu, features, options, llvm::Reloc::PIC_);
    // TODO finish
}
#

I link with LLVM like so:

find_package(LLVM REQUIRED CONFIG)
include_directories(${LLVM_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})
llvm_map_components_to_libnames(LLVM_LIBS support core irreader)
target_link_libraries(requite PRIVATE ${LLVM_LIBS})
#

I have not had any issues so far until trying to use the target stuff from LLVM in the function write_obj_file. If you try commenting that stuff out, it should compile fine without linking errors.

uneven obsidian
#

I think I am missing a component. I used the command line to get a list of all of them

#

^ need to do horizontal scrolling

uneven obsidian
#

After a lot of invetigation I figured out I was indeed missing a component, and it was mc

#

.solved

#

++done

#

.done

#

oh fine, whatever

#

just stay open then

shell thorn
#

!done

uneven obsidian
#

!done

uneven obsidian
dire citrus
uneven obsidian
#

!solved