Hi LLVM forums,
I’m trying to create a Docker image with clang-15, llvm-config, and LLVM libs. I’ve been following the guide located at …A guide to Dockerfiles for building LLVM… and I have successfully built a Docker image with clang-15 and llvm-config but I’m unsure of how to keep the libraries that are used for building clang-15 and llvm-config. My end goal is to use these libraries in a LibTooling project.
I’m creating the Dockerfile with
./llvm/utils/docker/build_docker_image.sh \
--source debian10 \
--docker-repository clang-debian10 --docker-tag "staging" \
-p clang -i install-clang -i install-clang-resource-headers \
-i install-llvm-config \
-- \
-DCMAKE_BUILD_TYPE=Release
Could anybody help me or point me in the right direction?
Thank you.
I managed to solve my own problem by running the following commands:
# Clone LLVM repo
git clone https://github.com/llvm/llvm-project.git && \
cd llvm-project && git checkout release/14.x && \
cd llvm && mkdir build
# CMake llvm build
cmake -GNinja \
-DCMAKE_INSTALL_PREFIX=/tmp/llvm \
-DCMAKE_MAKE_PROGRAM=/usr/local/bin/ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS=clang \
-S /llvm-project/llvm -B /llvm-project/llvm/build
# Build libraries, headers, and binaries
cd /llvm-project/llvm/build && \
ninja install-llvm-libraries install-llvm-headers \
install-clang-libraries install-clang-headers install-clang \
install-clang-resource-headers install-llvm-config install-cmake-exports
1 Like
As of llvm-12, this unfortunately does not work, because install-cmake-exports
exports many additional targets, which are apparently not installed by the other install-*
arguments used in this command. Missing CMake exported targets make the CMake build of a user application project to fail. That’s why I believe this install-*
system is in fact unusable and hasn’t been designed thoughtfully enough. Only using a plain install
results into a fully usable installation.