sci-ml/pytorch: unbundle dev-cpp/cpp-httplib for distributed build

Link to system shared httplib instead of using bundled header-only version

Closes: https://bugs.gentoo.org/980398
Signed-off-by: Sv. Lockal <lockalsash@gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/46650
Closes: https://github.com/gentoo/gentoo/pull/46650
Signed-off-by: Alfredo Tupone <tupone@gentoo.org>
This commit is contained in:
Sv. Lockal
2026-08-06 02:16:46 +08:00
committed by Alfredo Tupone
parent a97be8d5e7
commit 17faa2ddff
2 changed files with 34 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
Link to system shared httplib instead of using bundled header-only version
Bug: https://bugs.gentoo.org/980398
--- a/caffe2/CMakeLists.txt
+++ b/caffe2/CMakeLists.txt
@@ -1338,8 +1338,9 @@ if(USE_KINETO)
${TORCH_ROOT}/third_party/kineto/libkineto/src)
endif()
-target_include_directories(torch_cpu PRIVATE
- ${TORCH_ROOT}/third_party/cpp-httplib)
+if(USE_DISTRIBUTED)
+ target_link_libraries(torch_cpu PRIVATE httplib)
+endif()
target_include_directories(torch_cpu PRIVATE
${TORCH_ROOT}/third_party/nlohmann/include)
--- a/cmake/Dependencies.cmake
+++ b/cmake/Dependencies.cmake
@@ -1732,8 +1732,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/FlatBuffers.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/FlatBuffers.cmake)
# Include cpp-httplib
-add_library(httplib INTERFACE IMPORTED)
-target_include_directories(httplib SYSTEM INTERFACE ${PROJECT_SOURCE_DIR}/third_party/cpp-httplib)
+if(USE_DISTRIBUTED)
+ find_package(httplib REQUIRED)
+ add_library(httplib ALIAS httplib::httplib)
+endif()
# Include nlohmann-json
add_library(nlohmann INTERFACE IMPORTED)

View File

@@ -85,6 +85,7 @@ RDEPEND="
)
distributed? (
!rocm? ( sci-ml/tensorpipe[cuda?] )
dev-cpp/cpp-httplib:=
)
fbgemm? ( >=sci-ml/FBGEMM-1.4 )
gloo? ( >=sci-ml/gloo-2025.06.04[cuda?,rocm?] )
@@ -148,7 +149,6 @@ DEPEND="
dev-python/typing-extensions[${PYTHON_USEDEP}]
')
cuda? ( ~dev-libs/cutlass-4.4.2[tools(+)] )
distributed? ( dev-cpp/cpp-httplib:= )
onednn? ( sci-ml/ideep )
rocm? (
>=sci-libs/hipCUB-6.3:= <sci-libs/hipCUB-7.3:=
@@ -169,6 +169,7 @@ PATCHES=(
"${FILESDIR}"/${P}-unbundle_flatbuffers.patch
"${FILESDIR}"/${P}-unbundle_fmt.patch
"${FILESDIR}"/${P}-unbundle_fxdiv.patch
"${FILESDIR}"/${P}-unbundle_httplib.patch
"${FILESDIR}"/${P}-unbundle_kineto.patch
"${FILESDIR}"/${P}-unbundle_mkldnn.patch
"${FILESDIR}"/${P}-unbundle_nnpack.patch