# Multi-stage build for XGBoost from source on Ubuntu jammy
FROM ubuntu:jammy-20260210.1 as builder
# Install build dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
ca-certificates \
pkg-config \
python3-pip \
libopenmpi-dev \
openmpi-bin \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Copy source
COPY . .
# Configure and build
RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
RUN cmake --build build -j$(nproc)
# Install the built artifacts to /usr/local
RUN cmake --install build
FROM ubuntu:jammy-20260210.1 as runtime
# Runtime dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libstdc++6 \
ca-certificates \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Copy installed artifacts from builder
COPY --from=builder /usr/local /usr/local
# Ensure dynamic linker can find libs
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
WORKDIR /workspace
CMD ["/bin/bash"]
# Python virtual environments and caches venv/ __pycache__/ *.pyc *.pyo *.pyd # Git and SVN .git/ .gitignore # CMake and build CMakeFiles/ CMakeCache.txt build/ dist/ *.cmake # Misc .DS_Store .env *.log
Summary (under 1500 chars):
- Exact error message and exit code:
The process exited with code 1 during the build step:
"ERROR: process \"/bin/sh -c cmake -S . -B build -DCMAKE_BUILD_TYPE=Release\" did not complete successfully: exit code: 1"
CMake errors:
- "The source directory /workspace/dmlc-core does not contain a CMakeLists.txt file."
- "set_target_properties Can not find target to add properties to: dmlc"
- "Cannot specify link libraries for target \"dmlc\" which is not built by this project."
- "-- Configuring incomplete, errors occurred!"
- Failing command/step:
[builder 5/7] RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
- Missing packages or files mentioned:
- The source dir /workspace/dmlc-core is missing a CMakeLists.txt file:
The source directory /workspace/dmlc-core does not contain a CMakeLists.txt file.
- This leads to the dmlc target not being built, causing subsequent target_link_libraries errors.
- Version mismatch info:
- xgboost VERSION: 3.3.0 (as reported during the CMake/config step)
- The build environment uses Ubuntu jammy (jammy-20260210.1) as base image, with OpenMP and GCC toolchain pulled in during apt-get steps.# Multi-stage build for XGBoost from source on Ubuntu jammy
FROM ubuntu:jammy-20260210.1 as builder
# Install build dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
ca-certificates \
pkg-config \
python3-pip \
libopenmpi-dev \
openmpi-bin \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Copy source
COPY . .
# If submodules are present but not populated, attempt to fetch dmlc-core from its standalone repo
RUN if [ -d dmlc-core ]; then \
if [ ! -f dmlc-core/CMakeLists.txt ]; then \
rm -rf dmlc-core && git clone --depth 1 https://github.com/dmlc/dmlc-core.git dmlc-core; \
fi; fi
# Configure and build
RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
RUN cmake --build build -j$(nproc)
# Install the built artifacts to /usr/local
RUN cmake --install build
FROM ubuntu:jammy-20260210.1 as runtime
# Runtime dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libstdc++6 \
ca-certificates \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Copy installed artifacts from builder
COPY --from=builder /usr/local /usr/local
# Ensure dynamic linker can find libs
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
WORKDIR /workspace
CMD ["/bin/bash"]
Concerns: The submodule fetch logic appears inverted: it only attempts to fetch dmlc-core if the directory exists, which could skip fetching when the directory is missing. Consider flipping the condition to handle missing submodules correctly (e.g., if [ -d dmlc-core ]; then ... fi should be replaced with if [ -d dmlc-core ] || [ ! -f dmlc-core/CMakeLists.txt ]; then ...). Smoke [FAIL]: test -f /usr/local/include/xgboost/c_api.h && echo 'XGBoost C API header found Output: sh: 1: Syntax error: Unterminated quoted string Smoke [PASS]: test -e /usr/local/lib/libxgboost.so || (ls -1 /usr/local/lib/libxgboost.so* 2>/dev/null | head -n 1 >/dev/null && echo 'XGBoost library found' || exit 1) Smoke [FAIL]: echo "$LD_LIBRARY_PATH" | grep -q /usr/local/lib && echo 'LD_LIBRARY_PATH contains /usr/local/lib Output: sh: 1: Syntax error: Unterminated quoted string
# Multi-stage build for XGBoost from source on Ubuntu jammy
FROM ubuntu:jammy-20260210.1 as builder
# Install build dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
ca-certificates \
pkg-config \
python3-pip \
libopenmpi-dev \
openmpi-bin \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Copy source
COPY . .
# Ensure we have dmlc-core (build dependency) - fetch from upstream to ensure CMakeLists.txt exists
RUN rm -rf dmlc-core
RUN git clone --depth 1 https://github.com/dmlc/dmlc-core.git dmlc-core
# Configure and build
RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
RUN cmake --build build -j$(nproc)
# Install the built artifacts to /usr/local
RUN cmake --install build
FROM ubuntu:jammy-20260210.1 as runtime
# Runtime dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libstdc++6 \
ca-certificates \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Copy installed artifacts from builder
COPY --from=builder /usr/local /usr/local
# Ensure dynamic linker can find libs
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
WORKDIR /workspace
CMD ["/bin/bash"]
Smoke [PASS]: test -f /usr/local/lib/libxgboost.so Smoke [FAIL]: ldd /usr/local/lib/libxgboost.so | grep -q 'libstdc++.so.6 Output: sh: 1: Syntax error: Unterminated quoted string
# Multi-stage build for XGBoost from source on Ubuntu jammy
FROM ubuntu:jammy-20260210.1 as builder
# Install build dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
ca-certificates \
pkg-config \
python3-pip \
libopenmpi-dev \
openmpi-bin \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Copy source
COPY . .
# Initialize submodules (if present) to fetch dmlc-core and others
RUN git submodule update --init --recursive || true
# Configure and build
RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
RUN cmake --build build -j$(nproc)
# Install the built artifacts to /usr/local
RUN cmake --install build
FROM ubuntu:jammy-20260210.1 as runtime
# Runtime dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libstdc++6 \
ca-certificates \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Copy installed artifacts from builder
COPY --from=builder /usr/local /usr/local
# Ensure dynamic linker can find libs
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
WORKDIR /workspace
CMD ["/bin/bash"]
Failing step - Builder 6/8: RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release - Exit code: 1 Exact error messages (from cmake step) - CMake Error at CMakeLists.txt:297 (add_subdirectory): The source directory /workspace/dmlc-core does not contain a CMakeLists.txt file. - CMake Error at cmake/Utils.cmake:185 (set_target_properties): set_target_properties Can not find target to add properties to: dmlc - CMake Error at cmake/Utils.cmake:271 (target_link_libraries): Cannot specify link libraries for target "dmlc" which is not built by this project. - -- Configuring incomplete, errors occurred! - See also "/workspace/build/CMakeFiles/CMakeOutput.log". Missing files/packages mentioned - The source directory /workspace/dmlc-core does not contain a CMakeLists.txt file. Other relevant preconditions (from log) - fatal: not a git repository (or any of the parent directories): .git (from previous git submodule update attempt) Version/environment details observed - CMake version: 3.22.1 - C/C++ compiler: GNU 11.4.0 - OpenMP: found (4.5) - xgboost VERSION: 3.3.0 Notes - The git submodule step attempted earlier failed with a fatal git error, but was allowed to continue (|| true). The primary build failure is the missing CMakeLists.txt under /workspace/dmlc-core, causing the target dmlc to be unresolved.
# Multi-stage build for XGBoost from source on Ubuntu jammy
FROM ubuntu:jammy-20260210.1 as builder
# Install build dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
ca-certificates \
pkg-config \
python3-pip \
libopenmpi-dev \
openmpi-bin \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Copy source
COPY . .
# Ensure dmlc-core is available with a CMakeLists.txt (fallback to upstream if missing)
RUN if [ -d dmlc-core ]; then \
if [ ! -f dmlc-core/CMakeLists.txt ]; then \
rm -rf dmlc-core; \
git clone --depth 1 https://github.com/dmlc/dmlc-core.git dmlc-core; \
fi; \
fi
# Configure and build
RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
RUN cmake --build build -j$(nproc)
# Install the built artifacts to /usr/local
RUN cmake --install build
FROM ubuntu:jammy-20260210.1 as runtime
# Runtime dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libstdc++6 \
ca-certificates \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Copy installed artifacts from builder
COPY --from=builder /usr/local /usr/local
# Ensure dynamic linker can find libs
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
WORKDIR /workspace
CMD ["/bin/bash"]
Concerns: Potential runtime dependency gaps: the runtime image only installs libstdc++6, ca-certificates, and pkg-config. If the built libxgboost.so has additional runtime dependencies (e.g., MPI libraries or other shared libs), they may be missing at runtime., DMLC-core handling in builder: the script only clones dmlc-core if the directory exists and has a CMakeLists.txt, otherwise it does nothing. If the repository expects dmlc-core to be present but it isn’t, the build could fail. Consider auto-cloning or validating presence more robustly. Smoke [PASS]: test -f /usr/local/include/xgboost/c_api.h Smoke [PASS]: test -f /usr/local/lib/libxgboost.so Smoke [FAIL]: ldd /usr/local/lib/libxgboost.so | grep -q 'not found' && echo 'missing' || echo 'ok Output: sh: 1: Syntax error: Unterminated quoted string
# Multi-stage build for XGBoost from source on Ubuntu jammy
FROM ubuntu:jammy-20260210.1 as builder
# Install build dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
ca-certificates \
pkg-config \
python3-pip \
libopenmpi-dev \
openmpi-bin \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Copy source
COPY . .
# Configure and build (prefer system DMLC if available to avoid missing submodules)
RUN cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_WITH_SYSTEM_DMLC=ON \
-DUSE_OPENMP=ON
RUN cmake --build build -j$(nproc)
# Install the built artifacts to /usr/local
RUN cmake --install build
FROM ubuntu:jammy-20260210.1 as runtime
# Runtime dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libstdc++6 \
ca-certificates \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Copy installed artifacts from builder
COPY --from=builder /usr/local /usr/local
# Ensure dynamic linker can find libs
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
WORKDIR /workspace
CMD ["/bin/bash"]
Failing step:
- [builder 5/7] RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DBUILD_WITH_SYSTEM_DMLC=ON -DUSE_OPENMP=ON
Exact error message and exit code:
- Exit code: 1
- CMake output:
CMake Error at CMakeLists.txt:294 (find_package):
By not providing "Finddmlc.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "dmlc", but
CMake did not find one.
Could not find a package configuration file provided by "dmlc" with any of
the following names:
dmlcConfig.cmake
dmlc-config.cmake
Add the installation prefix of "dmlc" to CMAKE_PREFIX_PATH or set
"dmlc_DIR" to a directory containing one of the above files. If "dmlc"
provides a separate development package or SDK, be sure it has been
installed.
Configuring incomplete, errors occurred!
See also "/workspace/build/CMakeFiles/CMakeOutput.log".
Missing packages or files mentioned:
- Package not found: dmlc
- Missing configuration files: dmlcConfig.cmake or dmlc-config.cmake
- Missing module finder: Finddmlc.cmake in CMAKE_MODULE_PATH
Version and environment details (relevant context):
- CMake version: 3.22.1
- C/C++ compiler: GNU 11.4.0
- xgboost version: 3.3.0
Warnings (unique, not repeated):
- Warning: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 3; repeated later at line 33)
- Warning: UndefinedVar: Usage of undefined variable '$LD_LIBRARY_PATH' (line 47)# Multi-stage build for XGBoost from source on Ubuntu jammy
FROM ubuntu:jammy-20260210.1 as builder
# Install build dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
ca-certificates \
pkg-config \
python3-pip \
libopenmpi-dev \
openmpi-bin \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /workspace
# Copy source
COPY . .
# Ensure dmlc-core is available with a CMakeLists.txt (fallback to upstream if missing)
RUN if [ -d dmlc-core ]; then \
if [ ! -f dmlc-core/CMakeLists.txt ]; then \
rm -rf dmlc-core; \
git clone --depth 1 https://github.com/dmlc/dmlc-core.git dmlc-core; \
fi; \
else \
git clone --depth 1 https://github.com/dmlc/dmlc-core.git dmlc-core; \
fi
# Configure and build
RUN cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
RUN cmake --build build -j$(nproc)
# Install the built artifacts to /usr/local
RUN cmake --install build
FROM ubuntu:jammy-20260210.1 as runtime
# Runtime dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libstdc++6 \
libgomp1 \
ca-certificates \
pkg-config \
&& rm -rf /var/lib/apt/lists/*
# Copy installed artifacts from builder
COPY --from=builder /usr/local /usr/local
# Ensure dynamic linker can find libs
ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
WORKDIR /workspace
CMD ["/bin/bash"]
Concerns: Smoke tests only verify the presence of the library file; they do not verify functional runtime behavior or correctness of the compiled library., No tests verify header installation or API availability beyond file presence; consider adding a quick compile/link test or a small runnable snippet if feasible., The image relies on LD_LIBRARY_PATH for runtime library discovery; ensure downstream environments don't override or unset this variable. Smoke [PASS]: test -f /usr/local/lib/libxgboost.so Smoke [PASS]: ldd /usr/local/lib/libxgboost.so | head -n 5 Smoke [PASS]: test -f /usr/local/include/xgboost/c_api.h