From 7b9ea7d8d796281d2187e8cd29fb6baae05beec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bojan=20Ro=C5=A1ko?= <156314064+broskoTT@users.noreply.github.com> Date: Mon, 2 Dec 2024 10:34:12 +0100 Subject: [PATCH] Make uv and nng private and static (#323) (#339) ### Issue Original PR was #323, then the reverted one was #336 ### Description libnng.so is no longer a public dependency as of this PR: https://github.com/tenstorrent/tt-umd/pull/224 Additionally, given that it is only consumed here it would be advantageous to statically link it. Why? So we don't have to: - Install it - Package it in a debian - Bundle it in a ttnn python wheel ... etc ... Along the above lines, I don't want to run into issues like this: ``` Traceback (most recent call last): File "/usr/lib/python3.8/runpy.py", line 185, in _run_module_as_main mod_name, mod_spec, code = _get_module_details(mod_name, _Error) File "/usr/lib/python3.8/runpy.py", line [11](https://github.com/tenstorrent/tt-metal/actions/runs/11964313949/job/33356936955#step:6:12)1, in _get_module_details __import__(pkg_name) File "/home/ubuntu/actions-runner/_work/tt-metal/tt-metal/tests/end_to_end_tests/env/lib/python3.8/site-packages/ttnn/__init__.py", line 20, in import ttnn._ttnn ImportError: libnng.so.1: cannot open shared object file: No such file or directory ``` ### List of the changes Build nng as static Make it private linkage ### Testing Hoping CI is good enough ### API Changes There are no API changes in this PR. --------- Co-authored-by: Bryan Wilder Field Lozano --- cmake/dependencies.cmake | 11 +++++++++-- device/CMakeLists.txt | 5 ++--- tests/CMakeLists.txt | 1 + 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 86152401..8f87ba7a 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -56,7 +56,7 @@ function(fetch_dependencies) GITHUB_REPOSITORY nanomsg/nng GIT_TAG v1.8.0 OPTIONS - "BUILD_SHARED_LIBS ON" + "BUILD_SHARED_LIBS OFF" "NNG_TESTS OFF" "NNG_TOOLS OFF" ) @@ -97,7 +97,14 @@ function(fetch_dependencies) ################################################################################################################### # libuv (for process management) ################################################################################################################### - CPMAddPackage(NAME libuv GITHUB_REPOSITORY libuv/libuv GIT_TAG v1.48.0 OPTIONS "LIBUV_BUILD_TESTS OFF") + CPMAddPackage( + NAME libuv + GITHUB_REPOSITORY libuv/libuv + GIT_TAG v1.48.0 + OPTIONS + "LIBUV_BUILD_TESTS OFF" + "LIBUV_BUILD_SHARED OFF" + ) ################################################################################################################### # fmt : https://github.com/fmtlib/fmt diff --git a/device/CMakeLists.txt b/device/CMakeLists.txt index 592de0e4..30231543 100644 --- a/device/CMakeLists.txt +++ b/device/CMakeLists.txt @@ -41,18 +41,17 @@ target_include_directories( ) # flatbuffers is public - exposed to tt_metal by tt_simulation_device_generated.h -# nng is public - exposed to tt_metal by tt_simulation_host.hpp target_link_libraries( device PUBLIC - nng flatbuffers - uv PRIVATE umd::Common umd::Firmware hwloc + nng rt + uv_a Boost::interprocess spdlog::spdlog_header_only fmt::fmt-header-only diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bfb6057f..060d64d7 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -13,6 +13,7 @@ target_link_libraries( gtest pthread fmt::fmt-header-only + nng ) target_include_directories( test_common