Add Dockerfile to simplify local builds
After realizing the latest (0.1.1) release available through apt didn't have some of the features I was hoping for, I attempted to build from source using the provided instructions. However, my Ubuntu Jammy system doesn't provide the version of clang (18) required for building.
Offering a Dockerfile using a base like silkeh/clang would simplify the build and usage for those in a similar position. This could also be taken a step further to deploy a pre-built image to some container registry.
@jmagnuson I'll consider creating a Docker image, however first I want to finalize version 0.2.0, but I have a few features I want to complete before that.
Regardless, clang-include-graph doesn't require LLVM 18 specifically, I've just checked in a fresh ubuntu:jammy Docker container:
docker run -it ubuntu:jammy bash
$ apt update
$ apt -y install git make gcc g++ cmake clang-15 libclang-15-dev libclang-cpp15-dev libboost-graph1.74-dev libboost-filesystem1.74-dev libboost-test1.74-dev libboost-program-options1.74-dev libboost-log1.74-dev
$ git clone https://github.com/bkryza/clang-include-graph
$ cd clang-include-graph
$ LLVM_CONFIG_PATH=/usr/bin/llvm-config-15 make test
$ debug/clang-include-graph --version
clang-include-graph 0.1.1-26-g0a64705
Copyright (C) 2022-present Bartek Kryza <[email protected]>
Built with libclang: 15.0.7
Awesome, thanks for verifying it's not specific to LLVM version. Admittedly, I didn't look at the internals, but have wrestled with gnarly LLVM components in the past, so this ticket was a bit hasty. Happy to create a PR with the above, in any case.
@jmagnuson I've published this week 0.2.0, and I looked into this clang Docker, but honestly I'm not sure it will work for clang-include-graph. The problem is that, as as Clang-based tool, clang-include-graph requires that all headers that are needed to parse a single translation unit (i.e. a single cpp file and all it's header dependencies), must be available to it. Now if for instance your project uses some library like libcurl, and it's headers are not in the Docker, but only on the system where you're running the Docker, clang-include-graph will complain unless you somehow mount all necessary include paths into the Docker itself (like entire /usr/include), but then that will likely break the Docker container itself...