Skip to content

Commit

Permalink
Make uv and nng private and static (#323) (#339)
Browse files Browse the repository at this point in the history
### Issue
Original PR was #323, then the reverted one was #336

### Description
libnng.so is no longer a public dependency as of this PR:
#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 <module>
    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 <[email protected]>
  • Loading branch information
broskoTT and blozano-tt authored Dec 2, 2024
1 parent b3b5f1a commit 7b9ea7d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
11 changes: 9 additions & 2 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions device/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ target_link_libraries(
gtest
pthread
fmt::fmt-header-only
nng
)
target_include_directories(
test_common
Expand Down

0 comments on commit 7b9ea7d

Please sign in to comment.