Skip to content

Commit

Permalink
Fix missing link libraries in host components (#87042)
Browse files Browse the repository at this point in the history
- All host components link against dl - effectively, this handles hostfxr, hostpolicy, and nethost which were missing it
- hostpolicy links against pthread
  • Loading branch information
elinor-fung authored Jun 2, 2023
1 parent fc486b4 commit 0c85307
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/native/corehost/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ function(set_common_libs TargetType)
if((CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_FREEBSD) AND NOT CLR_CMAKE_TARGET_ANDROID)
target_link_libraries (${DOTNET_PROJECT_NAME} PRIVATE "pthread")
endif()

target_link_libraries (${DOTNET_PROJECT_NAME} PRIVATE ${CMAKE_DL_LIBS})
endif()

if (NOT ${TargetType} STREQUAL "lib-static")
Expand All @@ -53,5 +51,7 @@ function(set_common_libs TargetType)
target_link_libraries(${DOTNET_PROJECT_NAME} PRIVATE atomic.a)
endif()
endif()

target_link_libraries (${DOTNET_PROJECT_NAME} PRIVATE ${CMAKE_DL_LIBS})
endif()
endfunction()
4 changes: 4 additions & 0 deletions src/native/corehost/hostpolicy/standalone/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ endif(CLR_CMAKE_HOST_UNIX)

install_with_stripped_symbols(hostpolicy TARGETS corehost)
target_link_libraries(hostpolicy PRIVATE libhostcommon)

if((CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_FREEBSD) AND NOT CLR_CMAKE_TARGET_ANDROID)
target_link_libraries (hostpolicy PRIVATE pthread)
endif()

0 comments on commit 0c85307

Please sign in to comment.