Skip to content

build: replace build.py with Conan 2 + CMakePresets build system - #8734

Draft
mc-nv wants to merge 2 commits into
mainfrom
mchornyi/TRI-122/conan-next
Draft

build: replace build.py with Conan 2 + CMakePresets build system#8734
mc-nv wants to merge 2 commits into
mainfrom
mchornyi/TRI-122/conan-next

Conversation

@mc-nv

@mc-nv mc-nv commented Apr 13, 2026

Copy link
Copy Markdown
Contributor
Resolves: TRI-122
triton-inference-server/backend#123
triton-inference-server/common#154
triton-inference-server/core#490
triton-inference-server/third_party#74

Description

Replaces the legacy build.py script with a Conan 2 package manager and CMakePresets-based build system for the main server repository. Adds Conan recipes for internal dependencies (cnmem, dcgm, libevhtp), build presets for all target platforms/architectures, and migrates CMakeLists.txt to use Conan-provided imported targets.

Changes

  • build: replace build.py with Conan 2 + CMakePresets build system

Affected Files

  • CMakeLists.txt
  • CMakePresets.json
  • build.py.legacy
  • cmake/CMakePresets.json
  • cmake/TritonCheckCxxAbi.cmake
  • cmake/presets/ (platform-specific presets for all targets)
  • conan/profiles/ (linux-gcc13 release/debug profiles)
  • conan/recipes/cnmem/conanfile.py
  • conan/recipes/dcgm/conanfile.py
  • conan/recipes/libevhtp/conanfile.py
  • conanfile.py
  • requirements.txt
  • src/CMakeLists.txt
  • src/test/CMakeLists.txt

Retire the build.py / ExternalProject / third_party workflow.  Every
external dependency is now resolved through Conan 2 (private NVIDIA
Artifactory remote or Conan Center).  Internal Triton repos (common,
core, backend) are consumed as local add_subdirectory checkouts whose
paths are set by conanfile.py or overridden on the cmake command line.

New files:
- conanfile.py: server dependency manifest (grpc, protobuf, re2, boost,
  libevent, libevhtp, prometheus-cpp, gtest, nlohmann_json, …)
- requirements.txt: Python wheel deps (tritonfrontend, tritonserver)
- CMakePresets.json: thin include wrapper (points to cmake/presets/)
- cmake/CMakePresets.json: aggregated include list for all platform files
- cmake/presets/CMakePresets.TritonInferenceServer.*.json (6 presets):
  Release targets for CPU/CUDA × Ubuntu/manylinux × x86_64/aarch64
- cmake/presets/CMakePresets.TritonClient.*.json (6 presets): client variants
- cmake/presets/CMakePresets.TritonPerfAnalyzer.*.json (2 presets)
- cmake/presets/CMakePresets.TritonVLLMBackend.*.json (1 preset)
- cmake/presets/CMakePresets.TritonTRTLLMBackend.*.json (2 presets)
- conan/profiles/linux-gcc13-{release,debug,-aarch64,-manylinux,…}: build profiles
- conan/recipes/{libevhtp,cnmem,dcgm}/conanfile.py: custom Conan recipes
- build.py → build.py.legacy: retired (kept for reference)

Modified files:
- CMakeLists.txt: replace ExternalProject/FetchContent with
  add_subdirectory for sibling repos; add triton_add_backend /
  triton_add_plugin macros; add FetchContent compatibility shims so
  existing ${repo-core_SOURCE_DIR} references in test targets still resolve
- src/CMakeLists.txt: replace legacy Find-module variable refs with Conan
  imported targets (libevent::*, opentelemetry-cpp::*, AWSSDK::*);
  add rapidjson to simple target; fix relative ldscript path → absolute
- src/test/CMakeLists.txt: use libevent::core + libevent::extra instead of
  ${LIBEVENT_LIBRARIES}; drop ${LIBEVENT_INCLUDE_DIRS} (propagated via
  target interface)
- src/test/*/CMakeLists.txt (7 files): fix relative --version-script paths
  to ${CMAKE_CURRENT_BINARY_DIR}/... for Ninja compatibility
- .gitignore: exclude CMakeUserPresets.json (generated by conan install)

Developer workflow:
  conan install server/ \
    --profile:host=server/conan/profiles/linux-gcc13-release \
    --profile:build=server/conan/profiles/linux-gcc13-release \
    -o '&:enable_gpu=False' --build=missing \
    --output-folder=server/build/<preset>/conan
  cmake --preset triton-inference-server-release-cpu-ubuntu-x86_64
  cmake --build --preset triton-inference-server-release-cpu-ubuntu-x86_64

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Set CMAKE_CUDA_RUNTIME_LIBRARY=Shared in server/src and all CUDA
  preset JSONs so libtritonserver.so links libcudart.so dynamically,
  matching the production container (libcudart.so.13).

- Move all find_package() calls before add_subdirectory(core) in
  CMakeLists.txt so cnmem::cnmem and DCGM::dcgm imported targets
  exist when core/src/CMakeLists.txt evaluates if(TARGET cnmem::cnmem).

- Update dcgm/conanfile.py to search /usr/include and
  /usr/lib/x86_64-linux-gnu in addition to /usr/local/dcgm so the
  apt-installed datacenter-gpu-manager package is found correctly.

- Add rapidjson to memory_alloc example link libraries.
mc-nv added a commit to mc-nv/server that referenced this pull request Sep 8, 2026
The gRPC recipe used gRPC_<dep>_PROVIDER=module, compiling the abseil, protobuf,
re2 and c-ares submodules it ships. That built, and it guaranteed the versions
matched, but it hid those packages inside the gRPC package where Conan could not
see them. Nothing else could then share them: opentelemetry-cpp requires
protobuf for the OTLP HTTP exporter, which pulled a second abseil and collided
in CMake's target namespace.

    The link interface of target "absl::log_severity" contains:
      CONAN_LIB::abseil_..._RELEASE     but the target was not found.

Switching to PROVIDER=package keeps the same versions -- abseil 20250512.1,
protobuf v33.5 (Conan 6.33.5), re2, c-ares, resolved from gRPC v1.81.1's
submodule SHAs -- while making them ordinary packages that every consumer
resolves to one copy of. force=True on abseil and protobuf because protobuf pins
its own abseil and the two have to agree.

This also removes machinery rather than adding it:

  - triton_server_grpc_provide_bundle() is no longer used. It existed to locate
    gRPC's package tree and adopt five packages out of it in a fixed order,
    because gRPC's config referenced protobuf targets that had to already exist.
    Plain find_package() calls replace it.

  - The ZLIB/OpenSSL ordering workaround is gone. gRPC vendored BoringSSL and
    shipped a lib/cmake/OpenSSL that shadowed Conan's, omitting the
    package-level openssl::openssl libevent needs; SSL_PROVIDER=package means
    real OpenSSL and no shadowing. Verified: the rebuilt package's lib/cmake
    contains only grpc.

The recipe also needed a CMakeDeps generator. Under module providers gRPC never
called find_package and needed none; under package providers it calls
find_package(Protobuf) and find_package(c-ares), which failed until CMakeDeps
was generating the configs.

opentelemetry-cpp moves from 1.9.1 to 1.22.0. 1.9.1 was carried over from triton-inference-server#8734
and was never what Triton uses -- third_party pins v1.13.0 -- but neither can
configure: CMake 4 removed compatibility below policy 3.5 and both declare
cmake_minimum_required(VERSION 3.1). 1.22.0 (minimum 3.14) is the first release
ConanCenter carries that clears it. Building v1.13.0 ourselves would not help;
the constraint is upstream's. with_otlp_grpc=False because Triton uses only
otlp_http_exporter_factory.

The abseil/protobuf/re2/c-ares version variables are restored, having been
removed when the bundle made them unread. They expand into the graph references
now, and their absence produced "abseil/" with no version.

Verified: configure exits 0 with defaults and with TRITON_ENABLE_TRACING=ON,
fifteen packages in one graph sharing a single abseil and protobuf.

Not verified: whether core/src's tracing code compiles against opentelemetry
1.22.0, a nine-version jump from what it was written against.

Refs TRI-1611
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant