-
Notifications
You must be signed in to change notification settings - Fork 566
CONFIGURE: added a configure option to add SONAME suffix #11483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
61f87c0
322570f
bae9f33
0350617
514e20b
40f47f7
9b24baf
c38c388
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,202 @@ | ||
| # | ||
| # Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # See file LICENSE for terms. | ||
| # | ||
|
|
||
| check_elf_soname() { | ||
| lib_path=$1 | ||
| soname=$2 | ||
|
|
||
| if [ ! -f "$lib_path" ]; then | ||
| azure_log_error "Missing library $lib_path" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! readelf -d "$lib_path" | grep -q "Library soname: \\[$soname\\]"; then | ||
| azure_log_error "Library $lib_path does not have SONAME $soname" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| check_elf_needed() { | ||
| binary_path=$1 | ||
| needed=$2 | ||
|
|
||
| if [ ! -f "$binary_path" ]; then | ||
| azure_log_error "Missing binary $binary_path" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! readelf -d "$binary_path" | grep -q "Shared library: \\[$needed\\]"; then | ||
| azure_log_error "Binary $binary_path is not linked to $needed" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| check_linker_symlink() { | ||
| link_path=$1 | ||
| target_pattern=$2 | ||
|
|
||
| if [ ! -L "$link_path" ]; then | ||
| azure_log_error "Missing linker symlink $link_path" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if ! readlink "$link_path" | grep -q "$target_pattern"; then | ||
| azure_log_error "Linker symlink $link_path does not point to $target_pattern" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| check_uct_module_linkage() { | ||
| module=$1 | ||
| suffix=$2 | ||
| module_path="${ucx_inst}/lib/ucx/libuct_${module}-${suffix}.so.0.0.0" | ||
| shift 2 | ||
|
|
||
| check_elf_soname "$module_path" "libuct_${module}-${suffix}.so.0" | ||
| for needed in "$@"; do | ||
| check_elf_needed "$module_path" "$needed" | ||
| done | ||
| } | ||
|
|
||
| build_soname_suffix() { | ||
| suffix=ci | ||
| foreign_build_dir=${ucx_build_dir}/foreign | ||
| foreign_inst=${ucx_build_dir}/foreign-install | ||
| soname_suffix_check_hw=${soname_suffix_check_hw:-no} | ||
| common_soname_config_args=( | ||
| --without-java | ||
| --without-go | ||
| --without-rocm | ||
| --without-xpmem | ||
| --without-knem | ||
| --disable-doxygen-doc | ||
| ) | ||
|
|
||
| if [ "${soname_suffix_check_hw}" = "yes" ]; then | ||
| echo "==== Enable CUDA and IB for SONAME suffix build ====" | ||
| cuda_local_dir="/usr/local/cuda" | ||
| have_gdrcopy=no | ||
|
|
||
| if ! nvidia-smi -L; then | ||
| azure_log_error "SONAME suffix CUDA/IB check requires a GPU" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -d /dev/infiniband ]; then | ||
| azure_log_error "SONAME suffix CUDA/IB check requires IB devices" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -d "$cuda_local_dir" ] && | ||
| find "$cuda_local_dir" -name 'libcudart.so.1[2-9]*' | grep -q .; then | ||
| common_soname_config_args+=(--with-cuda=$cuda_local_dir) | ||
| elif az_module_load $CUDA_MODULE; then | ||
| common_soname_config_args+=(--with-cuda) | ||
| else | ||
| azure_log_error "SONAME suffix CUDA/IB check requires CUDA" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -w "/dev/gdrdrv" ] && az_module_load $GDRCOPY_MODULE; then | ||
| have_gdrcopy=yes | ||
| common_soname_config_args+=(--with-gdrcopy) | ||
| else | ||
| common_soname_config_args+=(--without-gdrcopy) | ||
| fi | ||
|
|
||
| common_soname_config_args+=(--with-verbs --with-rdmacm) | ||
| else | ||
| common_soname_config_args+=( | ||
| --without-verbs | ||
| --without-rdmacm | ||
| --without-cuda | ||
| ) | ||
| fi | ||
|
|
||
| echo "==== Build foreign UCX without SONAME suffix ====" | ||
| mkdir -p $foreign_build_dir | ||
| pushd $foreign_build_dir | ||
| ${WORKSPACE}/contrib/configure-release --prefix=$foreign_inst \ | ||
| "${common_soname_config_args[@]}" | ||
| $MAKEP | ||
| $MAKEP install | ||
| popd | ||
|
|
||
| echo "==== Build with SONAME suffix and module deepbind ====" | ||
| ${WORKSPACE}/contrib/configure-release --prefix=$ucx_inst \ | ||
| --enable-gtest \ | ||
| --enable-test-apps \ | ||
| --with-soname-suffix=$suffix \ | ||
| --enable-module-deepbind \ | ||
| "${common_soname_config_args[@]}" | ||
| $MAKEP | ||
| $MAKEP install | ||
|
|
||
| grep "#define UCX_MODULE_FILE_SUFFIX \"-$suffix\"" config.h | ||
| grep "#define UCX_MODULE_DLOPEN_DEEPBIND 1" config.h | ||
| grep " -lucp-${suffix}" "${ucx_inst}/lib/pkgconfig/ucx.pc" | ||
| grep " -lucs-${suffix} -lucm-${suffix}" \ | ||
| "${ucx_inst}/lib/pkgconfig/ucx-ucs.pc" | ||
| grep " -luct-${suffix}" "${ucx_inst}/lib/pkgconfig/ucx-uct.pc" | ||
| for lib in ucs ucp uct; do | ||
| grep "lib${lib}-${suffix}.so" \ | ||
| "${ucx_inst}/lib/cmake/ucx/ucx-targets.cmake" | ||
| done | ||
| if [ "${soname_suffix_check_hw}" = "yes" ]; then | ||
| grep "#define HAVE_CUDA 1" config.h | ||
| grep "#define HAVE_IB 1" config.h | ||
| fi | ||
|
|
||
| for lib in ucm ucs uct ucp; do | ||
| check_elf_soname \ | ||
| "${ucx_inst}/lib/lib${lib}-${suffix}.so.0.0.0" \ | ||
| "lib${lib}-${suffix}.so.0" | ||
| check_linker_symlink \ | ||
| "${ucx_inst}/lib/lib${lib}.so" \ | ||
| "lib${lib}-${suffix}\\.so" | ||
| done | ||
|
|
||
| check_uct_module_linkage cma $suffix \ | ||
| "libuct-${suffix}.so.0" \ | ||
| "libucs-${suffix}.so.0" | ||
| if [ "${soname_suffix_check_hw}" = "yes" ]; then | ||
| for module in cuda ib rdmacm; do | ||
| check_uct_module_linkage $module $suffix \ | ||
| "libuct-${suffix}.so.0" \ | ||
| "libucs-${suffix}.so.0" | ||
| done | ||
| if [ "${have_gdrcopy}" = "yes" ]; then | ||
| check_uct_module_linkage cuda_gdrcopy $suffix \ | ||
| "libuct_cuda-${suffix}.so.0" | ||
| fi | ||
| fi | ||
| check_elf_soname \ | ||
| "${ucx_build_dir}/test/gtest/ucs/test_module/.libs/libtest_module-${suffix}.so.0.0.0" \ | ||
| "libtest_module-${suffix}.so.0" | ||
| check_elf_needed \ | ||
| "${ucx_inst}/lib/libucp-${suffix}.so.0.0.0" \ | ||
| "libuct-${suffix}.so.0" | ||
| check_elf_needed \ | ||
| "${ucx_inst}/lib/libucp-${suffix}.so.0.0.0" \ | ||
| "libucs-${suffix}.so.0" | ||
| for lib in ucp uct ucs; do | ||
| check_elf_needed \ | ||
| "${ucx_inst}/bin/ucx_info" \ | ||
| "lib${lib}-${suffix}.so.0" | ||
| done | ||
| check_elf_needed \ | ||
| "${ucx_build_dir}/test/apps/.libs/libtest_ucx_isolation_plugin.so" \ | ||
| "libucp-${suffix}.so.0" | ||
|
|
||
| LD_LIBRARY_PATH="${ucx_inst}/lib:${foreign_inst}/lib${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}" \ | ||
| "${ucx_build_dir}/test/apps/test_ucx_dlopen_isolation" \ | ||
| "${foreign_inst}/lib/libucp.so.0.0.0" \ | ||
| "${ucx_build_dir}/test/apps/.libs/libtest_ucx_isolation_plugin.so" \ | ||
| "$suffix" deepbind | ||
|
|
||
| GTEST_FILTER=test_sys.module_file_suffix:test_sys.module \ | ||
| $MAKE -C test/gtest test | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,6 +72,43 @@ AC_SUBST(EXTRA_VERSION) | |
| AC_SUBST(SCM_VERSION) | ||
| AC_SUBST(SOVERSION) | ||
|
|
||
| UCX_LT_RELEASE= | ||
| UCX_LIBRARY_FILE_SUFFIX= | ||
| ucx_soname_suffix_summary="<disabled>" | ||
| ucx_module_deepbind_summary="no" | ||
| AC_ARG_WITH([soname-suffix], | ||
| AS_HELP_STRING([--with-soname-suffix=SUFFIX], | ||
| [Append SUFFIX to UCX installed shared library names and SONAMEs. Disabled by default. [default=NO]]), | ||
| [], [with_soname_suffix=no]) | ||
| AS_IF([test "x$with_soname_suffix" != xno], | ||
| [AS_IF([test "x$with_soname_suffix" = xyes], | ||
| [AC_MSG_ERROR([--with-soname-suffix requires an explicit suffix value])]) | ||
| case "$with_soname_suffix" in | ||
| @<:@A-Za-z0-9@:>@*) ;; | ||
| *) AC_MSG_ERROR([--with-soname-suffix must start with a letter or digit]) ;; | ||
| esac | ||
| case "$with_soname_suffix" in | ||
| *@<:@!A-Za-z0-9_-@:>@*) | ||
| AC_MSG_ERROR([--with-soname-suffix must contain only letters, digits, underscores, and dashes]) | ||
| ;; | ||
| esac | ||
| UCX_LIBRARY_FILE_SUFFIX="-$with_soname_suffix" | ||
| UCX_LT_RELEASE="-release $with_soname_suffix" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ℹ️ INFO only the four core libs (ucm/ucp/ucs/uct) get |
||
| AC_DEFINE_UNQUOTED([UCX_MODULE_FILE_SUFFIX], | ||
| ["$UCX_LIBRARY_FILE_SUFFIX"], | ||
| [Suffix appended to private UCX module file names]) | ||
| ucx_soname_suffix_summary="$with_soname_suffix"]) | ||
| AC_SUBST([UCX_LT_RELEASE]) | ||
| AC_SUBST([UCX_LIBRARY_FILE_SUFFIX]) | ||
|
|
||
| AC_ARG_ENABLE([module-deepbind], | ||
| AS_HELP_STRING([--enable-module-deepbind], | ||
| [Load UCX modules with RTLD_DEEPBIND. Intended for private UCX bundles. Disabled by default. [default=NO]]), | ||
| [], [enable_module_deepbind=no]) | ||
| AS_IF([test "x$enable_module_deepbind" = xyes], | ||
| [AS_IF([test "x$with_soname_suffix" = xno], | ||
| [AC_MSG_ERROR([--enable-module-deepbind requires --with-soname-suffix])])]) | ||
|
|
||
| AC_PROG_CC | ||
| AC_PROG_CXX | ||
| AC_OPENMP | ||
|
|
@@ -87,6 +124,14 @@ AC_FUNC_STRERROR_R | |
|
|
||
| AC_PATH_TOOL([PKG_CONFIG], [pkg-config], [pkg-config]) | ||
|
|
||
| AS_IF([test "x$enable_module_deepbind" = xyes], | ||
| [AC_CHECK_DECLS([RTLD_DEEPBIND], | ||
| [AC_DEFINE([UCX_MODULE_DLOPEN_DEEPBIND], [1], | ||
| [Load UCX modules with RTLD_DEEPBIND]) | ||
| ucx_module_deepbind_summary="yes"], | ||
| [AC_MSG_ERROR([--enable-module-deepbind requires RTLD_DEEPBIND support from <dlfcn.h>])], | ||
| [[#include <dlfcn.h>]])]) | ||
|
roiedanino marked this conversation as resolved.
|
||
|
|
||
|
|
||
| # | ||
| # Define SHARED_LIB preprocessor macro when building a shared library | ||
|
|
@@ -435,6 +480,8 @@ AC_MSG_NOTICE([ Multi-thread: ${mt_enable}]) | |
| AC_MSG_NOTICE([ MPI tests: ${mpi_enable}]) | ||
| AC_MSG_NOTICE([ VFS support: ${vfs_enable}]) | ||
| AC_MSG_NOTICE([ Devel headers: ${enable_devel_headers}]) | ||
| AC_MSG_NOTICE([ SONAME suffix: ${ucx_soname_suffix_summary}]) | ||
| AC_MSG_NOTICE([ Module deepbind: ${ucx_module_deepbind_summary}]) | ||
| AC_MSG_NOTICE([io_demo CUDA support: ${with_iodemo_cuda}]) | ||
| AC_MSG_NOTICE([ Bindings: <$(echo ${build_bindings}|tr ':' ' ') >]) | ||
| AC_MSG_NOTICE([ UCS modules: <$(echo ${ucs_modules}|tr ':' ' ') >]) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚨 BLOCKER
libtool's
-releasechanges the installed library filename (e.g.libucp-SUFFIX.so.0), not just the SONAME. With this set,ucx.pc(which emits-lucp) andcmake/ucx-targets.cmake.in(which hardcodeslibucp.so/libucs.so/libuct.so) will fail to locate the libs for downstream consumers. Either also template these files with the suffix, or use a mechanism that only alters the SONAME (e.g.,-Wl,-soname=...) if the intent really is SONAME-only as the option name suggests.