JPenuchot / ctbench

Compiler-assisted variable size benchmarking for the study of C++ metaprogram compile times.

Home Page:https://jpenuchot.github.io/ctbench-docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider removing LLVM dependency

r-barnes opened this issue · comments

If I edit CMakeLists.txt to read:

cmake_minimum_required(VERSION 3.22)

and then run

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ..
ninja

I see

/z/ctbench/grapher/lib/grapher/plotters/debug.cpp:1:10: fatal error: llvm/Support/raw_ostream.h: No such file or directory
    1 | #include <llvm/Support/raw_ostream.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/z/ctbench/grapher/grapher-utils.cpp:1:10: fatal error: llvm/Support/CommandLine.h: No such file or directory
    1 | #include <llvm/Support/CommandLine.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Is it possible to remove this LLVM dependency in favour of using the C++ STL instead? If not, is it possible to make the LLVM linking mechanism more robust?

openjournals/joss-reviews#5165

commented

Hello,

Is it possible to remove this LLVM dependency in favour of using the C++ STL instead?

The LLVM can't be dropped so easily as the CLI code relies heavily on LLVM's CommandLine support library, which doesn't have any equivalent in the STL. It is also required for symbol demangling in the compare_by plotter.

If not, is it possible to make the LLVM linking mechanism more robust?

I'm not sure what you mean by more robust? The find_package command is called with the REQUIRED tag (here: https://github.com/JPenuchot/ctbench/blob/main/cmake/dependencies.cmake) and the grapher target is being linked against the export target exposed by LLVM (here: https://github.com/JPenuchot/ctbench/blob/main/grapher/cmake/grapher-target.cmake). I'm very surprised that CMake didn't catch any error and I'm suspecting that Ubuntu's way of splitting packages might be responsible for that.

It seems like most of your issues are due to the project not being built on Ubuntu as I use Arch for development, so I will likely set up an additional GitHub Action to check that ctbench compiles well on a recent Ubuntu system. I'll investigate that next week and come back to you, thanks for bringing that up.

commented

Hello, this issue was not encountered on the Ubuntu 23.04 CI and might be related to a missing package on your system, maybe libllvm15 or llvm-dev? I'll be waiting for your feedback.

commented

I'm closing the issue as it was resolved for Ubuntu 23.04, feel free to reopen if I missed something.