ucs: portability fixes for non-glibc / Clang environments#11354
Open
GenericRikka wants to merge 1 commit intoopenucx:masterfrom
Open
ucs: portability fixes for non-glibc / Clang environments#11354GenericRikka wants to merge 1 commit intoopenucx:masterfrom
GenericRikka wants to merge 1 commit intoopenucx:masterfrom
Conversation
d927ab5 to
5cdc7f6
Compare
tvegas1
reviewed
Apr 21, 2026
| #ifndef UCS_TYPE_FLOAT_H | ||
| #define UCS_TYPE_FLOAT_H | ||
|
|
||
| #include <ieee754.h> |
Contributor
There was a problem hiding this comment.
maybe we can simply manually define union ieee754_double when it is missing, and avoid most of the changes?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UCS: portability fixes for non-glibc/Clang environments
This PR addresses a set of portability issues in the UCS layer that
prevent UCX from building cleanly with Clang and/or non-glibc libc
implementations such as FreeBSD libc or musl. All changes are confined
to UCS and have no effect on the wire protocol or ABI.
Changes
sys.h/log.c— portable hostname buffer size (UCS_HOST_NAME_MAX)HOST_NAME_MAXis a Linux/glibc extension and is not defined by POSIX.Introduce
UCS_HOST_NAME_MAXderived from_POSIX_HOST_NAME_MAX(thePOSIX-mandated minimum of 255) with a fallback of 256, and use it
unconditionally in the hostname buffer in
log.c. The<limits.h>and<unistd.h>includes required to expose_POSIX_HOST_NAME_MAXareadded to
sys.h.compiler.h—UCS_F_NOOPTIMIZEwith ClangClang does not support GCC's
__attribute__((optimize("O0")))andsilently ignores it, producing no-op behaviour for
UCS_F_NOOPTIMIZE.Clang provides the equivalent
__attribute__((optnone)). Restructurethe macro into a clean three-branch
#if/#elif/#elseso eachcompiler gets the correct attribute.
float8.h— remove dependency on<ieee754.h><ieee754.h>definesunion ieee754_doubleusing C bitfields todecompose double-precision floats. This header is a glibc extension
absent from other libc implementations. Replace the bitfield-based
access with portable
memcpy-based helpers (ucs_double_to_words/ucs_words_to_double) that inspect the IEEE 754 bit layout withoutundefined behaviour, using
FLOAT_WORDS_BIGENDIAN(already defined byUCX's autoconf) for endianness.
aarch64/cpu.h— explicit<ucs/sys/ptr_arith.h>includeThe AArch64 CPU header uses macros from
ptr_arith.hbut relied ontransitive inclusion. Add the direct include to make the dependency
explicit and guard against breakage if include order changes.
debug.c— explicit<signal.h>and<stdlib.h>includesdebug.cuses signal-related types and stdlib functions withoutincluding the corresponding headers directly. Add explicit includes.
numa.c— replace__CPU_SETSIZEwithUCS_CPU_SETSIZEnuma.cused the glibc-internal__CPU_SETSIZE(double-underscorereserved namespace). UCX already defines
UCS_CPU_SETSIZEin<ucs/type/cpu_set.h>, which is available transitively via<ucs/sys/sys.h>, already included bynuma.c. Remove thenow-redundant fallback block and replace all three use sites with
UCS_CPU_SETSIZE. Using the UCX-internal constant is also semanticallycorrect: the NUMA CPU cache bound should align with UCX's own CPU set
abstraction, not the platform's reported
CPU_SETSIZE.