repo/gentoo:master commit in: sci-ml/pytorch/files/

"Alfredo Tupone" <[email protected]>
Newsgroups gmane.linux.gentoo.cvs
Message-ID <1786040395.1c651dff76d72b548435f0896f7b9253ecf3d8c2.tupone@gentoo>
commit:     1c651dff76d72b548435f0896f7b9253ecf3d8c2
Author:     Sv. Lockal <lockalsash <AT> gmail <DOT> com>
AuthorDate: Thu Aug  6 17:57:36 2026 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Thu Aug  6 18:19:55 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1c651dff

sci-ml/pytorch: fix compilation with USE="-distributed"

Closes: https://bugs.gentoo.org/980408
Signed-off-by: Sv. Lockal <lockalsash <AT> gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/46654
Closes: https://github.com/gentoo/gentoo/pull/46654
Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>

 .../files/pytorch-2.13.0-unbundle_httplib.patch    | 25 +++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/sci-ml/pytorch/files/pytorch-2.13.0-unbundle_httplib.patch b/sci-ml/pytorch/files/pytorch-2.13.0-unbundle_httplib.patch
index 679973a2d23e..25edd9c6f2a8 100644
--- a/sci-ml/pytorch/files/pytorch-2.13.0-unbundle_httplib.patch
+++ b/sci-ml/pytorch/files/pytorch-2.13.0-unbundle_httplib.patch
@@ -10,14 +10,14 @@ Bug: https://bugs.gentoo.org/980398
 -target_include_directories(torch_cpu PRIVATE
 -  ${TORCH_ROOT}/third_party/cpp-httplib)
 +if(USE_DISTRIBUTED)
-+  target_link_libraries(torch_cpu PRIVATE httplib)
++  target_link_libraries(torch_cpu PRIVATE httplib::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)
+@@ -1717,8 +1717,9 @@ endif()
  include(${CMAKE_CURRENT_LIST_DIR}/FlatBuffers.cmake)
  
  # Include cpp-httplib
@@ -25,8 +25,27 @@ Bug: https://bugs.gentoo.org/980398
 -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)
+--- a/torch/CMakeLists.txt
++++ b/torch/CMakeLists.txt
+@@ -78,13 +78,16 @@ list(APPEND TORCH_PYTHON_INCLUDE_DIRECTORIES ${LIBSHM_SRCDIR})
+ set(TORCH_PYTHON_LINK_LIBRARIES
+     Python::Module
+     pybind::pybind11
+-    httplib
+     nlohmann
+     moodycamel
+     shm
+     fmt
+     ATEN_CPU_FILES_GEN_LIB)
+ 
++if(USE_DISTRIBUTED)
++  list(APPEND TORCH_PYTHON_LINK_LIBRARIES httplib::httplib)
++endif()
++
+ if(USE_ASAN AND TARGET Sanitizer::address)
+   list(APPEND TORCH_PYTHON_LINK_LIBRARIES Sanitizer::address)
+ endif()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.