Build failure inside Ubuntu-based Docker container
Attempting to build CaGe inside a Docker container generated via the following Dockerfile:
FROM ubuntu:24.04
WORKDIR /opt
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -y && apt-get upgrade -y && apt-get install -y gcc g++ gdb cmake cmake-curses-gui python3 apt-utils wget gnupg git autoconf automake libtool zlib1g-dev zlib1g vim unzip python3-pip python3-pytest python3-pytest-cov openmpi-bin openmpi-common bison flex lsb-release wget software-properties-common gnupg ninja-build
RUN apt-get install -y libclang-common-18-dev libclang-18-dev libclang1-18
RUN wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh
RUN ./llvm.sh 18
RUN ln -s /usr/bin/clang-18 /usr/bin/clang && ln -s /usr/bin/clang++-18 /usr/bin/clang++ && ln -s /usr/lib/llvm-18/build/utils/lit/lit.py /usr/bin/lit && ln -s /usr/bin/opt-18 /usr/bin/opt && ln -s /usr/bin/FileCheck-18 /usr/bin/FileCheck
RUN useradd -m user
RUN mkdir -p /home/user/.ssh
RUN chown -R user:user /home/user/.ssh
USER user
results in a build failure caused by missing include directories for the spd-log
and nlohmann-json
metacg
-dependencies:
[5/37] Building CXX object lib/CMakeFiles/cage.dir/Plugin.cpp.o
FAILED: lib/CMakeFiles/cage.dir/Plugin.cpp.o
/usr/bin/c++ -DVIRTCALL_LOG_LEVEL -Dcage_EXPORTS -I/usr/lib/llvm-18/include -I/opt/dev/gencc/include -I/opt/dev/gencc/_build/_deps/llvm-metavirt-src/lib/metavirt -I/opt/dev/gencc/_build/_deps/metacg-src/graph/include -I/opt/dev/gencc/_build/_deps/metacg-build/graph/include -I/opt/dev/gencc/_build/_deps/metacg-build -O3 -DNDEBUG -std=gnu++17 -fPIC -MD -MT lib/CMakeFiles/cage.dir/Plugin.cpp.o -MF lib/CMakeFiles/cage.dir/Plugin.cpp.o.d -o lib/CMakeFiles/cage.dir/Plugin.cpp.o -c /opt/dev/gencc/lib/Plugin.cpp
In file included from /opt/dev/gencc/_build/_deps/metacg-src/graph/include/metadata/OverrideMD.h:10,
from /opt/dev/gencc/_build/_deps/metacg-src/graph/include/CgNode.h:11,
from /opt/dev/gencc/_build/_deps/metacg-src/graph/include/Callgraph.h:9,
from /opt/dev/gencc/include/Transform/CallgraphGenerator.h:15,
from /opt/dev/gencc/lib/Plugin.cpp:9:
/opt/dev/gencc/_build/_deps/metacg-src/graph/include/LoggerUtil.h:9:10: fatal error: spdlog/sinks/stdout_color_sinks.h: No such file or directory
9 | #include <spdlog/sinks/stdout_color_sinks.h>
[2/3] Building CXX object lib/CMakeFiles/cage.dir/Transform/CallGraphGenerator.cpp.o
FAILED: lib/CMakeFiles/cage.dir/Transform/CallGraphGenerator.cpp.o
/usr/bin/c++ -DVIRTCALL_LOG_LEVEL -Dcage_EXPORTS -I/usr/lib/llvm-18/include -I/opt/dev/gencc/include -I/opt/dev/gencc/_build/_deps/llvm-metavirt-src/lib/metavirt -I/opt/dev/gencc/_build/_deps/metacg-src/graph/include -I/opt/dev/gencc/_build/_deps/metacg-build/graph/include -I/opt/dev/gencc/_build/_deps/metacg-build -I/opt/dev/gencc/_build/_deps/spdlog-src/include -O3 -DNDEBUG -std=gnu++17 -fPIC -MD -MT lib/CMakeFiles/cage.dir/Transform/CallGraphGenerator.cpp.o -MF lib/CMakeFiles/cage.dir/Transform/CallGraphGenerator.cpp.o.d -o lib/CMakeFiles/cage.dir/Transform/CallGraphGenerator.cpp.o -c /opt/dev/gencc/lib/Transform/CallGraphGenerator.cpp
In file included from /opt/dev/gencc/_build/_deps/metacg-src/graph/include/metadata/OverrideMD.h:11,
from /opt/dev/gencc/_build/_deps/metacg-src/graph/include/CgNode.h:11,
from /opt/dev/gencc/_build/_deps/metacg-src/graph/include/Callgraph.h:9,
from /opt/dev/gencc/include/Transform/CallgraphGenerator.h:15,
from /opt/dev/gencc/lib/Transform/CallGraphGenerator.cpp:1:
/opt/dev/gencc/_build/_deps/metacg-src/graph/include/metadata/MetaData.h:12:10: fatal error: nlohmann/json.hpp: No such file or directory
12 | #include "nlohmann/json.hpp"
| ^~~~~~~~~~~~~~~~~~~